From ba9fc02441362149a5d7de4d6db64455ba169d05 Mon Sep 17 00:00:00 2001 From: Victor Carlos Erenu Date: Tue, 14 Apr 2026 22:51:44 +0700 Subject: [PATCH 1/2] Test bumper workflows --- .github/workflows/4_bumper_repository.yml | 19 +-- .github/workflows/5_bumper_repository.yml | 146 ++++++++++++++++++++++ 2 files changed, 152 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/5_bumper_repository.yml diff --git a/.github/workflows/4_bumper_repository.yml b/.github/workflows/4_bumper_repository.yml index a215726c..10106278 100644 --- a/.github/workflows/4_bumper_repository.yml +++ b/.github/workflows/4_bumper_repository.yml @@ -1,4 +1,4 @@ -name: Repository bumper +name: Repository bumper 4.x run-name: Bump ${{ github.ref_name }} (${{ inputs.id }}) on: @@ -14,11 +14,6 @@ on: default: '' required: false type: string - tag: - description: 'Change branches references to tag-like references (e.g. v4.12.0-alpha7)' - default: false - required: false - type: boolean issue-link: description: 'Issue link in format https://github.com/wazuh//issues/' required: true @@ -30,8 +25,8 @@ on: jobs: bump: - name: Repository bumper - runs-on: ubuntu-22.04 + name: Repository bumper 4.x + runs-on: ubuntu-24.04 permissions: contents: write pull-requests: write @@ -81,18 +76,16 @@ jobs: env: VERSION: ${{ inputs.version }} STAGE: ${{ inputs.stage }} - TAG: ${{ inputs.tag }} run: | script_params="" version=${{ env.VERSION }} stage=${{ env.STAGE }} - tag=${{ env.TAG }} # Both version and stage provided - if [[ -n "$version" && -n "$stage" && "$tag" != "true" ]]; then + if [[ -n "$version" && -n "$stage" ]]; then script_params="--version ${version} --stage ${stage}" - elif [[ -n "$version" && -n "$stage" && "$tag" == "true" ]]; then - script_params="--version ${version} --stage ${stage} --tag ${tag}" + elif [[ -z "$version" && -n "$stage" ]]; then + script_params="--stage ${stage}" fi issue_number=$(echo "${{ inputs.issue-link }}" | awk -F'/' '{print $NF}') diff --git a/.github/workflows/5_bumper_repository.yml b/.github/workflows/5_bumper_repository.yml new file mode 100644 index 00000000..04985874 --- /dev/null +++ b/.github/workflows/5_bumper_repository.yml @@ -0,0 +1,146 @@ +name: Repository bumper 5.x +run-name: Bump ${{ github.ref_name }} (${{ inputs.id }}) + +on: + workflow_dispatch: + inputs: + version: + description: 'Target version (e.g. 1.2.3)' + default: '' + required: false + type: string + stage: + description: 'Version stage (e.g. alpha0)' + default: '' + required: false + type: string + set_as_main: + description: "Enable main branch mode: bump version values only, keep branch references pointing to main" + required: false + type: boolean + default: false + issue-link: + description: 'Issue link in format https://github.com/wazuh//issues/' + required: true + type: string + id: + description: 'Optional identifier for the run' + required: false + type: string + +jobs: + bump: + name: Repository bumper 5.x + runs-on: ubuntu-24.04 + permissions: + contents: write + pull-requests: write + + env: + CI_COMMIT_AUTHOR: wazuhci + CI_COMMIT_EMAIL: 22834044+wazuhci@users.noreply.github.com + CI_GPG_PRIVATE_KEY: ${{ secrets.CI_WAZUHCI_GPG_PRIVATE }} + GH_TOKEN: ${{ secrets.CI_WAZUHCI_BUMPER_TOKEN }} + BUMP_SCRIPT_PATH: tools/repository_bumper.sh + BUMP_LOG_PATH: tools + + steps: + - name: Dump event payload + run: | + cat $GITHUB_EVENT_PATH | jq '.inputs' + + - name: Set up GPG key + id: signing_setup + run: | + echo "${{ env.CI_GPG_PRIVATE_KEY }}" | gpg --batch --import + KEY_ID=$(gpg --list-secret-keys --with-colons | awk -F: '/^sec/ {print $5; exit}') + echo "gpg_key_id=$KEY_ID" >> $GITHUB_OUTPUT + + - name: Set up git + run: | + git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}" + git config --global user.email "${{ env.CI_COMMIT_EMAIL }}" + git config --global commit.gpgsign true + git config --global user.signingkey "${{ steps.signing_setup.outputs.gpg_key_id }}" + echo "use-agent" >> ~/.gnupg/gpg.conf + echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf + echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf + echo RELOADAGENT | gpg-connect-agent + export DEBIAN_FRONTEND=noninteractive + export GPG_TTY=$(tty) + + - name: Checkout repository + uses: actions/checkout@v6 + with: + # Using workflow-specific GITHUB_TOKEN because currently CI_WAZUHCI_BUMPER_TOKEN + # doesn't have all the necessary permissions + token: ${{ env.GH_TOKEN }} + + - name: Determine branch name + id: vars + env: + VERSION: ${{ inputs.version }} + STAGE: ${{ inputs.stage }} + run: | + script_params="" + version=${{ env.VERSION }} + stage=${{ env.STAGE }} + + set_as_main=${{ inputs.set_as_main }} + + if [[ "$set_as_main" == "true" ]]; then + script_params="--set-as-main" + fi + + # Both version and stage provided + if [[ -n "$version" && -n "$stage" ]]; then + script_params+=" --version ${version} --stage ${stage}" + elif [[ -z "$version" && -n "$stage" ]]; then + script_params+=" --stage ${stage}" + fi + + issue_number=$(echo "${{ inputs.issue-link }}" | awk -F'/' '{print $NF}') + BRANCH_NAME="enhancement/wqa${issue_number}-bump-${{ github.ref_name }}" + echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT + echo "script_params=${script_params}" >> $GITHUB_OUTPUT + + - name: Create and switch to bump branch + run: | + git checkout -b ${{ steps.vars.outputs.branch_name }} + + - name: Make version bump changes + run: | + echo "Running bump script" + bash ${{ env.BUMP_SCRIPT_PATH }} ${{ steps.vars.outputs.script_params }} + + - name: Commit and push changes + run: | + git add . + git commit -m "feat: bump ${{ github.ref_name }}" + git push origin ${{ steps.vars.outputs.branch_name }} + + - name: Create pull request + id: create_pr + run: | + gh auth setup-git + PR_URL=$(gh pr create \ + --title "Bump ${{ github.ref_name }} branch" \ + --body "Issue: ${{ inputs.issue-link }}" \ + --base ${{ github.ref_name }} \ + --head ${{ steps.vars.outputs.branch_name }}) + + echo "Pull request created: ${PR_URL}" + echo "pull_request_url=${PR_URL}" >> $GITHUB_OUTPUT + + - name: Merge pull request + run: | + # Any checks for the PR are bypassed since the branch is expected to be functional (i.e. the bump process does not introduce any bugs) + gh pr merge "${{ steps.create_pr.outputs.pull_request_url }}" --merge --admin + + - name: Show logs + run: | + echo "Bump complete." + echo "Branch: ${{ steps.vars.outputs.branch_name }}" + echo "PR: ${{ steps.create_pr.outputs.pull_request_url }}" + echo "Bumper scripts logs:" + cat ${BUMP_LOG_PATH}/repository_bumper*log \ No newline at end of file From aa8677b0876b6619e2ce0bebb4ee04eeb3d11996 Mon Sep 17 00:00:00 2001 From: Victor Carlos Erenu Date: Tue, 14 Apr 2026 23:23:48 +0700 Subject: [PATCH 2/2] Add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 889b3e7a..9356fe62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file. ### Changed +- Adapt bumper workflows to change main branch ([#2294](https://github.com/wazuh/wazuh-docker/pull/2294)) - Delete all API user and password references and Wazuh agent references ([#2289](https://github.com/wazuh/wazuh-docker/pull/2289)) - Create certificate directory with default user and group ([#2287](https://github.com/wazuh/wazuh-docker/pull/2287)) - Standarize Artifact URL keys ([#2286](https://github.com/wazuh/wazuh-docker/pull/2286))