From eac202011ceb52c137cdf304f7af3ee8c310528e Mon Sep 17 00:00:00 2001 From: tuntoja Date: Mon, 8 Apr 2024 17:22:16 +0200 Subject: [PATCH 01/10] force release and promote --- .github/actions/release/action.yml | 2 +- .github/workflows/centreon-collect.yml | 2 +- .github/workflows/get-version.yml | 9 +++++++-- .github/workflows/release.yml | 16 ++++++++-------- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.github/actions/release/action.yml b/.github/actions/release/action.yml index 7b3f8cb2f0b..21be06250cd 100644 --- a/.github/actions/release/action.yml +++ b/.github/actions/release/action.yml @@ -237,7 +237,7 @@ runs: done # Build JSON structure with released versions - JSON_TAGS=$(jq -n '{componentList:$ARGS.positional}' --args "${NEW_RELEASE_TAGS[@]}") + JSON_TAGS=$(jq -n '{componentList:$ARGS.positional}' --args "${NEW_STABLE_TAGS[@]}") JSON_VERSION_INFO=$(jq -n --arg majorVersion "$MAJOR_VERSION" --arg scopeVersion "$SCOPE_VERSION" '$ARGS.named' ) RELEASE_JSON=$(echo "$JSON_VERSION_INFO" | jq -c --argjson json_tags "$JSON_TAGS" '. += $json_tags') diff --git a/.github/workflows/centreon-collect.yml b/.github/workflows/centreon-collect.yml index bf2009f5ac2..60cc7d19e34 100644 --- a/.github/workflows/centreon-collect.yml +++ b/.github/workflows/centreon-collect.yml @@ -163,7 +163,7 @@ jobs: promote: needs: [get-version] - if: ${{ contains(fromJson('["stable"]'), needs.get-version.outputs.stability) && github.event_name != 'workflow_dispatch' }} + if: ${{ contains(fromJson('["stable"]'), needs.get-version.outputs.stability) }} runs-on: [self-hosted, common] strategy: matrix: diff --git a/.github/workflows/get-version.yml b/.github/workflows/get-version.yml index bf783a2923e..e21ddf03bf9 100644 --- a/.github/workflows/get-version.yml +++ b/.github/workflows/get-version.yml @@ -84,7 +84,12 @@ jobs: GITHUB_RELEASE_TYPE=$(echo $BRANCHNAME |cut -d '-' -f 1) case "$BRANCHNAME" in - master | [2-9][0-9].[0-9][0-9].x) + master) + echo "release=1" >> $GITHUB_OUTPUT + echo "release_cloud=1" >> $GITHUB_OUTPUT + echo "release_type=$GITHUB_RELEASE_TYPE" >> $GITHUB_OUTPUT + ;; + [2-9][0-9].[0-9][0-9].x|23.04.x-tun) echo "release=1" >> $GITHUB_OUTPUT echo "release_cloud=$GITHUB_RELEASE_CLOUD" >> $GITHUB_OUTPUT echo "release_type=$GITHUB_RELEASE_TYPE" >> $GITHUB_OUTPUT @@ -132,7 +137,7 @@ jobs: STABILITY="testing" ENV="testing" ;; - master | [2-9][0-9].[0-9][0-9].x) + master | [2-9][0-9].[0-9][0-9].x | 23.04.x-tun) STABILITY="stable" ENV="production" ;; diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e20fa63d9d6..ecc4d949a41 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ on: jobs: release: - if: ${{ github.event.pull_request.merged == true }} + #if: ${{ github.event.pull_request.merged == true }} runs-on: ubuntu-22.04 steps: - name: Check base_ref @@ -28,12 +28,12 @@ jobs: set -eu # Check if github.base_ref is either master or any of the supported version ones # This must never run on any other than master and supported version base_ref - if [[ "${{ github.base_ref }}" == 'master' || "${{ github.base_ref }}" =~ ^[2-9][0-9].[0-9][0-9].x ]];then - echo "[DEBUG] base_ref is valid: ${{ github.base_ref }}" - else - echo "::error::base_ref is not valid (${{ github.base_ref }}), exiting." - exit 1 - fi + # if [[ "${{ github.base_ref }}" == 'master' || "${{ github.base_ref }}" =~ ^[2-9][0-9].[0-9][0-9].x ]];then + # echo "[DEBUG] base_ref is valid: ${{ github.base_ref }}" + # else + # echo "::error::base_ref is not valid (${{ github.base_ref }}), exiting." + # exit 1 + # fi shell: bash - name: Checkout sources @@ -45,7 +45,7 @@ jobs: id: release uses: ./.github/actions/release with: - github_ref_name: ${{ github.base_ref }} + github_ref_name: "23.10.x" jira_project_id: ${{ secrets.JIRA_PROJECT_ID }} jira_user_email: ${{ secrets.XRAY_JIRA_USER_EMAIL }} jira_api_token: ${{ secrets.XRAY_JIRA_TOKEN }} From e685377fef0b639e1a2cb640fa184c829d23e136 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Mon, 8 Apr 2024 17:24:15 +0200 Subject: [PATCH 02/10] fix --- .github/actions/release/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/release/action.yml b/.github/actions/release/action.yml index 21be06250cd..bce9de96e99 100644 --- a/.github/actions/release/action.yml +++ b/.github/actions/release/action.yml @@ -118,7 +118,7 @@ runs: echo "::notice::Tagging stable branch with $TAG." else echo "::error::Release tag $TAG already exists, exiting." - exit 1 + #exit 1 fi done shell: bash From 16506229acc601cbf42173dbd2940149a9e425fc Mon Sep 17 00:00:00 2001 From: tuntoja Date: Mon, 8 Apr 2024 20:04:02 +0200 Subject: [PATCH 03/10] fix --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ecc4d949a41..c3dfb48ab38 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -45,7 +45,7 @@ jobs: id: release uses: ./.github/actions/release with: - github_ref_name: "23.10.x" + github_ref_name: "23.04.x" jira_project_id: ${{ secrets.JIRA_PROJECT_ID }} jira_user_email: ${{ secrets.XRAY_JIRA_USER_EMAIL }} jira_api_token: ${{ secrets.XRAY_JIRA_TOKEN }} From 041030f30f2f73e4154f5038aafb2b10d3dff80f Mon Sep 17 00:00:00 2001 From: tuntoja Date: Thu, 20 Jun 2024 11:34:28 +0200 Subject: [PATCH 04/10] RESET ME: test create stable jira version --- .github/actions/release/action.yml | 174 ++++++++++++++--------------- 1 file changed, 87 insertions(+), 87 deletions(-) diff --git a/.github/actions/release/action.yml b/.github/actions/release/action.yml index bce9de96e99..c59ad86934c 100644 --- a/.github/actions/release/action.yml +++ b/.github/actions/release/action.yml @@ -99,68 +99,68 @@ runs: echo "SCOPE_VERSION=$SCOPE_VERSION" >> "$GITHUB_ENV" shell: bash - - name: Add new release tags to stable branch - run: | - set -eux + # - name: Add new release tags to stable branch + # run: | + # set -eux - # Add new stable tags to stable branch - echo "Configuring git." - git config --global user.email "release@centreon.com" - git config --global user.name "Centreon" + # # Add new stable tags to stable branch + # echo "Configuring git." + # git config --global user.email "release@centreon.com" + # git config --global user.name "Centreon" - # Create release tags on git for each release components - # Abort if no tags or existing tag - echo "Creating release tags." - for TAG in ${NEW_STABLE_TAGS[@]}; do - if [ -z $(git tag --list "$TAG" | head -n 1) ] && [ -n $TAG ]; then - git tag -a "$TAG" -m "$TAG" - git push --follow-tags - echo "::notice::Tagging stable branch with $TAG." - else - echo "::error::Release tag $TAG already exists, exiting." - #exit 1 - fi - done - shell: bash + # # Create release tags on git for each release components + # # Abort if no tags or existing tag + # echo "Creating release tags." + # for TAG in ${NEW_STABLE_TAGS[@]}; do + # if [ -z $(git tag --list "$TAG" | head -n 1) ] && [ -n $TAG ]; then + # git tag -a "$TAG" -m "$TAG" + # git push --follow-tags + # echo "::notice::Tagging stable branch with $TAG." + # else + # echo "::error::Release tag $TAG already exists, exiting." + # #exit 1 + # fi + # done + # shell: bash - - name: Create GITHUB releases from new release tags - run: | - set -eux + # - name: Create GITHUB releases from new release tags + # run: | + # set -eux - # Install gh cli - echo "Installing GH CLI." - if ! command -v gh &> /dev/null; then - echo "Installing GH CLI." - type -p curl >/dev/null || (sudo apt-get update && sudo apt-get install curl -y) - curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg - sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg - echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null - sudo apt-get update - sudo apt-get install gh -y - else - echo "GH CLI is already installed." - fi + # # Install gh cli + # echo "Installing GH CLI." + # if ! command -v gh &> /dev/null; then + # echo "Installing GH CLI." + # type -p curl >/dev/null || (sudo apt-get update && sudo apt-get install curl -y) + # curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg + # sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg + # echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null + # sudo apt-get update + # sudo apt-get install gh -y + # else + # echo "GH CLI is already installed." + # fi - # Rebuild NEW_STABLE_TAGS as an array - # for i in ${NEW_STABLE_TAGS[@]}; do - # NEW_RELEASE_TAGS+=("$i") - # done + # # Rebuild NEW_STABLE_TAGS as an array + # # for i in ${NEW_STABLE_TAGS[@]}; do + # # NEW_RELEASE_TAGS+=("$i") + # # done - # Create GITHUB release for each release components - # Abort if no tags - echo "Creating GITHUB releases." - for TAG in ${NEW_STABLE_TAGS[@]}; do - if [ -n $TAG ]; then - echo "Creating GITHUB release with title $TAG for tag $TAG." - gh release create $TAG --target "${{ inputs.github_ref_name }}" --title "$TAG" --verify-tag - else - echo "::error::Release tag $TAG was empty, exiting." - exit 1 - fi - done - shell: bash - env: - GH_TOKEN: ${{ github.token }} + # # Create GITHUB release for each release components + # # Abort if no tags + # echo "Creating GITHUB releases." + # for TAG in ${NEW_STABLE_TAGS[@]}; do + # if [ -n $TAG ]; then + # echo "Creating GITHUB release with title $TAG for tag $TAG." + # gh release create $TAG --target "${{ inputs.github_ref_name }}" --title "$TAG" --verify-tag + # else + # echo "::error::Release tag $TAG was empty, exiting." + # exit 1 + # fi + # done + # shell: bash + # env: + # GH_TOKEN: ${{ github.token }} - name: Create stable JIRA versions from new release tags run: | @@ -217,41 +217,41 @@ runs: done shell: bash - - name: Trigger release communication for new releases - run: | - set -eux + # - name: Trigger release communication for new releases + # run: | + # set -eux - MAJOR_VERSION=$CURRENT_STABLE_BRANCH_MAJOR_VERSION + # MAJOR_VERSION=$CURRENT_STABLE_BRANCH_MAJOR_VERSION - # Webhook url - JIRA_INCOMING_WEBHOOK="${{ inputs.jira_webhook_url }}" + # # Webhook url + # JIRA_INCOMING_WEBHOOK="${{ inputs.jira_webhook_url }}" - # Rebuild NEW_STABLE_TAGS as an array (required to build a proper json) - for i in ${NEW_STABLE_TAGS[@]}; do - if [ -n "$i" ]; then - NEW_RELEASE_TAGS+=("$i") - else - echo "::error::Release tag $i was empty, exiting." - exit 1 - fi - done + # # Rebuild NEW_STABLE_TAGS as an array (required to build a proper json) + # for i in ${NEW_STABLE_TAGS[@]}; do + # if [ -n "$i" ]; then + # NEW_RELEASE_TAGS+=("$i") + # else + # echo "::error::Release tag $i was empty, exiting." + # exit 1 + # fi + # done - # Build JSON structure with released versions - JSON_TAGS=$(jq -n '{componentList:$ARGS.positional}' --args "${NEW_STABLE_TAGS[@]}") - JSON_VERSION_INFO=$(jq -n --arg majorVersion "$MAJOR_VERSION" --arg scopeVersion "$SCOPE_VERSION" '$ARGS.named' ) - RELEASE_JSON=$(echo "$JSON_VERSION_INFO" | jq -c --argjson json_tags "$JSON_TAGS" '. += $json_tags') + # # Build JSON structure with released versions + # JSON_TAGS=$(jq -n '{componentList:$ARGS.positional}' --args "${NEW_STABLE_TAGS[@]}") + # JSON_VERSION_INFO=$(jq -n --arg majorVersion "$MAJOR_VERSION" --arg scopeVersion "$SCOPE_VERSION" '$ARGS.named' ) + # RELEASE_JSON=$(echo "$JSON_VERSION_INFO" | jq -c --argjson json_tags "$JSON_TAGS" '. += $json_tags') - # DEBUG - echo "JSON_TAGS: \r\n$JSON_TAGS" - echo "JSON_VERSION_INFO: $JSON_VERSION_INFO" - echo "Sending to JIRA automation: \r\n$RELEASE_JSON" + # # DEBUG + # echo "JSON_TAGS: \r\n$JSON_TAGS" + # echo "JSON_VERSION_INFO: $JSON_VERSION_INFO" + # echo "Sending to JIRA automation: \r\n$RELEASE_JSON" - # Call jira webhook to trigger the communication workflow - # and provide versions data for communication - curl \ - "$JIRA_INCOMING_WEBHOOK" \ - -X POST \ - -H 'Content-type: application/json' \ - --data "$RELEASE_JSON" + # # Call jira webhook to trigger the communication workflow + # # and provide versions data for communication + # curl \ + # "$JIRA_INCOMING_WEBHOOK" \ + # -X POST \ + # -H 'Content-type: application/json' \ + # --data "$RELEASE_JSON" - shell: bash + # shell: bash From 3489c4759a13b104735e0eba71e49e6c162992ec Mon Sep 17 00:00:00 2001 From: tuntoja Date: Thu, 20 Jun 2024 11:37:27 +0200 Subject: [PATCH 05/10] RESET ME: remove -e from script release --- .github/actions/release/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/release/action.yml b/.github/actions/release/action.yml index c59ad86934c..6c74c1e07f2 100644 --- a/.github/actions/release/action.yml +++ b/.github/actions/release/action.yml @@ -164,7 +164,7 @@ runs: - name: Create stable JIRA versions from new release tags run: | - set -eux + set -ux # Call JIRA to provide new jira versions to create # Webhook url From 67cb86f09a31d2687dfffc9d7b345e9803d30022 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Thu, 20 Jun 2024 11:41:11 +0200 Subject: [PATCH 06/10] RESET ME: debug jira_release_id command --- .github/actions/release/action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/release/action.yml b/.github/actions/release/action.yml index 6c74c1e07f2..f339b304b1a 100644 --- a/.github/actions/release/action.yml +++ b/.github/actions/release/action.yml @@ -186,7 +186,8 @@ runs: JIRA_RELEASE_NAME="" JIRA_PROJECT_ID="${{ inputs.jira_project_id }}" JIRA_RELEASE_RELEASED="false" - JIRA_RELEASE_ID="$(git log |grep -E "^\s+Centreon.*#[0-9]{5,}#)" |grep -Eo "([0-9]{5,})" |head -n 1)" + #JIRA_RELEASE_ID="$(git log |grep -E "^\s+Centreon.*#[0-9]{5,}#)" |grep -Eo "([0-9]{5,})" |head -n 1)" + git log |grep -E "^\s+Centreon.*#[0-9]{5,}#)" |grep -Eo "([0-9]{5,})" |head -n 1 # Create JIRA version for each released component echo "Creating JIRA releases." From 5eb7118ec174ab6c8b77397789593927a061c08e Mon Sep 17 00:00:00 2001 From: tuntoja Date: Thu, 20 Jun 2024 11:46:26 +0200 Subject: [PATCH 07/10] add fetch-depth to action checkout --- .github/actions/release/action.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/actions/release/action.yml b/.github/actions/release/action.yml index f339b304b1a..80975a5612a 100644 --- a/.github/actions/release/action.yml +++ b/.github/actions/release/action.yml @@ -25,6 +25,9 @@ runs: steps: - name: Checkout sources uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + fetch-depth: 0 + - name: Get released versions for components run: | From ef3af0463ac6a3e003e3675be345926e2a4ca89b Mon Sep 17 00:00:00 2001 From: tuntoja Date: Thu, 20 Jun 2024 11:49:08 +0200 Subject: [PATCH 08/10] test with full clone --- .github/actions/release/action.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/actions/release/action.yml b/.github/actions/release/action.yml index 80975a5612a..bf5ca838f88 100644 --- a/.github/actions/release/action.yml +++ b/.github/actions/release/action.yml @@ -189,8 +189,7 @@ runs: JIRA_RELEASE_NAME="" JIRA_PROJECT_ID="${{ inputs.jira_project_id }}" JIRA_RELEASE_RELEASED="false" - #JIRA_RELEASE_ID="$(git log |grep -E "^\s+Centreon.*#[0-9]{5,}#)" |grep -Eo "([0-9]{5,})" |head -n 1)" - git log |grep -E "^\s+Centreon.*#[0-9]{5,}#)" |grep -Eo "([0-9]{5,})" |head -n 1 + JIRA_RELEASE_ID="$(git log |grep -E "^\s+Centreon.*#[0-9]{5,}#)" |grep -Eo "([0-9]{5,})" |head -n 1)" # Create JIRA version for each released component echo "Creating JIRA releases." From bbbe973b4d96e793c66e3d6498aaee435067fcb8 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Thu, 20 Jun 2024 11:52:52 +0200 Subject: [PATCH 09/10] test with full clone --- .github/actions/release/action.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/actions/release/action.yml b/.github/actions/release/action.yml index bf5ca838f88..b3666a87341 100644 --- a/.github/actions/release/action.yml +++ b/.github/actions/release/action.yml @@ -93,6 +93,10 @@ runs: fi done + ## REMOVE ME + NEW_STABLE_TAGS=("23.04.13") + ## + echo "New tags to be published from new release that were not in previous releases:" printf '%s\n' "${NEW_STABLE_TAGS[@]}" From 7bf8cae0b0b99e7c1ca737ddf9f5cad867be51a4 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Thu, 20 Jun 2024 11:53:11 +0200 Subject: [PATCH 10/10] test with fake version --- .github/actions/release/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/release/action.yml b/.github/actions/release/action.yml index b3666a87341..f7d43d549c1 100644 --- a/.github/actions/release/action.yml +++ b/.github/actions/release/action.yml @@ -94,7 +94,7 @@ runs: done ## REMOVE ME - NEW_STABLE_TAGS=("23.04.13") + NEW_STABLE_TAGS=("23.04.14") ## echo "New tags to be published from new release that were not in previous releases:"