From 30713f3f39e9e14f0bdf6a1de2d35f9189f78421 Mon Sep 17 00:00:00 2001 From: Fede Tux Date: Thu, 4 Jan 2024 13:29:15 -0300 Subject: [PATCH 1/3] Switching to short SHA commit form in package names Signed-off-by: Fede Tux --- .github/workflows/build.yml | 13 ++++++++----- .github/workflows/r_commit_sha.yml | 22 ++++++++++++++++++++++ 2 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/r_commit_sha.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4b286884541c7..6b9395eb5a5dc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,8 +26,11 @@ jobs: version: uses: ./.github/workflows/r_version.yml + commit_sha: + uses: ./.github/workflows/r_commit_sha.yml + build: - needs: version + needs: [ version, commit_sha ] strategy: matrix: distribution: [tar, rpm, deb] @@ -36,13 +39,13 @@ jobs: with: architecture: ${{ matrix.architecture }} distribution: ${{ matrix.distribution }} - name: wazuh-indexer-min_${{ needs.version.outputs.version }}-${{ inputs.revision }}-${{ matrix.architecture }}_${{ github.sha }}.${{ matrix.distribution }} + name: wazuh-indexer-min_${{ needs.version.outputs.version }}-${{ inputs.revision }}-${{ matrix.architecture }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.distribution }} # wazuh-indexer-min_4.8.0-rc1_x64_ff98475f.deb # TODO arm64 != amd64 (deb), x64 != x86_64 (rpm) # TODO use short SHA https://stackoverflow.com/a/59819441/13918537 assemble: - needs: [version, build] + needs: [version, commit_sha, build] strategy: matrix: distribution: [tar, rpm, deb] @@ -56,5 +59,5 @@ jobs: with: architecture: ${{ matrix.architecture }} distribution: ${{ matrix.distribution }} - min: wazuh-indexer-min_${{ needs.version.outputs.version }}-${{ inputs.revision }}-${{ matrix.architecture }}_${{ github.sha }}.${{ matrix.distribution }} - name: wazuh-indexer_${{ needs.version.outputs.version }}-${{ inputs.revision }}-${{ matrix.architecture }}_${{ github.sha }}.${{ matrix.distribution }} + min: wazuh-indexer-min_${{ needs.version.outputs.version }}-${{ inputs.revision }}-${{ matrix.architecture }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.distribution }} + name: wazuh-indexer_${{ needs.version.outputs.version }}-${{ inputs.revision }}-${{ matrix.architecture }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.distribution }} diff --git a/.github/workflows/r_commit_sha.yml b/.github/workflows/r_commit_sha.yml new file mode 100644 index 0000000000000..97a881e8420d3 --- /dev/null +++ b/.github/workflows/r_commit_sha.yml @@ -0,0 +1,22 @@ +name: Get commit SHA (reusable) + +# This workflow runs when any of the following occur: +# - Run from another workflow +on: + workflow_call: + outputs: + commit_sha: + description: "Returns the SHA of the git commit" + value: ${{ jobs.r_commit_sha.outputs.commit_sha }} + +jobs: + r_commit_sha: + runs-on: ubuntu-latest + outputs: + commit_sha: ${{ steps.get_commit_sha.outputs.commit_sha }} + steps: + - uses: actions/checkout@v4 + - name: Get git commit SHA + id: get_commit_sha + run: | + echo "git rev-parse --short HEAD" >> $GITHUB_OUTPUT From 7fe12a1cf2b73a0e100f91ecc7d987221d91842a Mon Sep 17 00:00:00 2001 From: Federico Gustavo Galland <99492720+f-galland@users.noreply.github.com> Date: Thu, 4 Jan 2024 16:02:44 -0300 Subject: [PATCH 2/3] Update r_commit_sha.yml Signed-off-by: Federico Gustavo Galland <99492720+f-galland@users.noreply.github.com> --- .github/workflows/r_commit_sha.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/r_commit_sha.yml b/.github/workflows/r_commit_sha.yml index 97a881e8420d3..4fdb9eca183a8 100644 --- a/.github/workflows/r_commit_sha.yml +++ b/.github/workflows/r_commit_sha.yml @@ -19,4 +19,4 @@ jobs: - name: Get git commit SHA id: get_commit_sha run: | - echo "git rev-parse --short HEAD" >> $GITHUB_OUTPUT + echo "commit_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT From 9331b7ec7d28dd72b17a57a4d23ab8ab5b7ba730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Ruiz?= Date: Wed, 10 Jan 2024 16:26:44 +0100 Subject: [PATCH 3/3] Update r_commit_sha.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Álex Ruiz --- .github/workflows/r_commit_sha.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/r_commit_sha.yml b/.github/workflows/r_commit_sha.yml index 4fdb9eca183a8..44860cb3e7363 100644 --- a/.github/workflows/r_commit_sha.yml +++ b/.github/workflows/r_commit_sha.yml @@ -1,4 +1,4 @@ -name: Get commit SHA (reusable) +name: "Get commit's short SHA (reusable)" # This workflow runs when any of the following occur: # - Run from another workflow @@ -6,7 +6,7 @@ on: workflow_call: outputs: commit_sha: - description: "Returns the SHA of the git commit" + description: "Returns the short SHA of the latest commit" value: ${{ jobs.r_commit_sha.outputs.commit_sha }} jobs: