From be77c6324662133aee33e0a549e074d079084e28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Ruiz?= Date: Fri, 19 Jan 2024 15:44:23 +0100 Subject: [PATCH 1/5] Run workflow on push --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 96e6826794abc..af74a924a11b3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,7 @@ name: Build packages # This workflow runs when any of the following occur: # - Run manually on: - pull_request: + push: # Sequence of patterns matched against refs/heads branches: - 'ci/*' From 1bd13945ac0313f8a4bb2c45ba8b4044561b2fd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Ruiz?= Date: Fri, 19 Jan 2024 15:53:54 +0100 Subject: [PATCH 2/5] Set build workflow inputs to required --- .github/workflows/build.yml | 2 +- .github/workflows/r_assemble.yml | 4 ++-- .github/workflows/r_build.yml | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index af74a924a11b3..a6bb381c3b6ef 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ on: revision: # description: default: "1" - required: false + required: true type: string # ========================== diff --git a/.github/workflows/r_assemble.yml b/.github/workflows/r_assemble.yml index 82bfe9d0fe5a8..1c88ea9b2b5a4 100644 --- a/.github/workflows/r_assemble.yml +++ b/.github/workflows/r_assemble.yml @@ -8,12 +8,12 @@ on: distribution: description: 'One of [ "tar", "rpm", "deb" ]' default: "rpm" - required: false + required: true type: string architecture: description: 'One of [ "x64", "arm64" ]' default: "x64" - required: false + required: true type: string min: description: The name of the package to download. diff --git a/.github/workflows/r_build.yml b/.github/workflows/r_build.yml index 104c0a7da22c1..32a331839c6da 100644 --- a/.github/workflows/r_build.yml +++ b/.github/workflows/r_build.yml @@ -8,15 +8,17 @@ on: distribution: description: 'One of [ "tar", "rpm", "deb" ]' default: "rpm" - required: false + required: true type: string architecture: description: 'One of [ "x64", "arm64" ]' default: "x64" - required: false + required: true type: string revision: type: string + required: true + default: "1" name: description: The name of the package to upload. required: true From 7bcea7a0b0df2e59ed5cbd4d650f74f1e4cf224f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Ruiz?= Date: Fri, 19 Jan 2024 16:04:58 +0100 Subject: [PATCH 3/5] Normalize the use of quotes for the build workflow inputs --- .github/workflows/build.yml | 6 +++--- .github/workflows/r_assemble.yml | 6 +++--- .github/workflows/r_build.yml | 7 ++++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a6bb381c3b6ef..1558fd8732def 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,10 +10,10 @@ on: workflow_dispatch: inputs: revision: - # description: - default: "1" - required: true + description: "Any string or number used to extend the package's identifier" type: string + required: true + default: "1" # ========================== # Bibliography diff --git a/.github/workflows/r_assemble.yml b/.github/workflows/r_assemble.yml index 1c88ea9b2b5a4..d08b64cea23ed 100644 --- a/.github/workflows/r_assemble.yml +++ b/.github/workflows/r_assemble.yml @@ -6,17 +6,17 @@ on: workflow_call: inputs: distribution: - description: 'One of [ "tar", "rpm", "deb" ]' + description: "One of [ 'tar', 'rpm', 'deb' ]" default: "rpm" required: true type: string architecture: - description: 'One of [ "x64", "arm64" ]' + description: "One of [ 'x64', 'arm64' ]" default: "x64" required: true type: string min: - description: The name of the package to download. + description: "The name of the package to download." required: true type: string diff --git a/.github/workflows/r_build.yml b/.github/workflows/r_build.yml index 32a331839c6da..299eb8155f735 100644 --- a/.github/workflows/r_build.yml +++ b/.github/workflows/r_build.yml @@ -6,21 +6,22 @@ on: workflow_call: inputs: distribution: - description: 'One of [ "tar", "rpm", "deb" ]' + description: "One of [ 'tar', 'rpm', 'deb' ]" default: "rpm" required: true type: string architecture: - description: 'One of [ "x64", "arm64" ]' + description: "One of [ 'x64', 'arm64' ]" default: "x64" required: true type: string revision: + description: "Any string or number used to extend the package's identifier." type: string required: true default: "1" name: - description: The name of the package to upload. + description: "The name of the package to upload." required: true type: string From 23e9926366afa09fd67b59f704eafbf974b671ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Ruiz?= Date: Fri, 19 Jan 2024 16:30:54 +0100 Subject: [PATCH 4/5] Add ternary operator --- .github/workflows/build.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1558fd8732def..aa099b6d38eff 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,6 +25,8 @@ on: # | https://docs.github.com/en/actions/using-workflows/reusing-workflows#using-a-matrix-strategy-with-a-reusable-workflow # * Reading input from the called workflow # | https://docs.github.com/en/enterprise-cloud@latest/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow_callinputs +# * Ternary operator +# | https://docs.github.com/en/actions/learn-github-actions/expressions#example jobs: version: @@ -44,7 +46,7 @@ jobs: architecture: ${{ matrix.architecture }} distribution: ${{ matrix.distribution }} revision: ${{ inputs.revision }} - name: wazuh-indexer-min_${{ needs.version.outputs.version }}-${{ inputs.revision }}-${{ matrix.architecture }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.distribution }} + name: wazuh-indexer-min_${{ needs.version.outputs.version }}-${{ github.event_name == 'push' && '1' || inputs.revision }}-${{ matrix.architecture }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.distribution }} assemble: needs: [version, commit_sha, build] @@ -61,4 +63,4 @@ jobs: with: architecture: ${{ matrix.architecture }} distribution: ${{ matrix.distribution }} - min: wazuh-indexer-min_${{ needs.version.outputs.version }}-${{ inputs.revision }}-${{ matrix.architecture }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.distribution }} + min: wazuh-indexer-min_${{ needs.version.outputs.version }}-${{ github.event_name == 'push' && '1' || inputs.revision }}-${{ matrix.architecture }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.distribution }} From 6122032d3928fe8787a64d65f58733da0cfe08f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Ruiz?= Date: Fri, 19 Jan 2024 16:33:38 +0100 Subject: [PATCH 5/5] Add missing ternary operator --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index aa099b6d38eff..2c05d48c4a507 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,7 +45,7 @@ jobs: with: architecture: ${{ matrix.architecture }} distribution: ${{ matrix.distribution }} - revision: ${{ inputs.revision }} + revision: ${{ github.event_name == 'push' && '1' || inputs.revision }} name: wazuh-indexer-min_${{ needs.version.outputs.version }}-${{ github.event_name == 'push' && '1' || inputs.revision }}-${{ matrix.architecture }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.distribution }} assemble: