diff --git a/.github/actions/package-delivery/action.yml b/.github/actions/package-delivery/action.yml index 1ba3006a1..82f641fbe 100644 --- a/.github/actions/package-delivery/action.yml +++ b/.github/actions/package-delivery/action.yml @@ -111,7 +111,6 @@ runs: uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: script: | - const warningNoPromote = 'No packages are promoted because push is not related to a hotfix/release pull request.'; const commitSha = context.sha; const pulls = await github.rest.pulls.list({ @@ -123,25 +122,31 @@ runs: per_page: 100 }); - const pr = pulls.data.find(p => p.merge_commit_sha === commitSha); + core.startGroup(`Checking pull request linked to commit ${commitSha}`); + const pr = pulls.data.find(p => { + console.log(`Checking pull request ${p.number}("${p.title}") with merge commit ${p.merge_commit_sha}`); + return p.merge_commit_sha === commitSha; + }); + core.endGroup(); if (!pr) { - core.warning(warningNoPromote); + core.error(`No pull request found for merge commit ${commitSha}`); return; } - const prBaseRef = pr?.base?.ref || 'unknown'; + const prHeadRef = pr?.head?.ref || 'unknown'; let releaseType = ''; switch (true) { - case /^release.+/.test(prBaseRef): + case /^release.+/.test(prHeadRef): releaseType = 'release'; break; - case /^hotfix.+/.test(prBaseRef): + case /^hotfix.+/.test(prHeadRef): releaseType = 'hotfix'; break; default: - core.warning(warningNoPromote); + core.error(`No packages are promoted because push of branch ${prHeadRef} is not related to a hotfix/release pull request.`); return; } + console.log(`Release type: ${releaseType}`); let fromStabilitySubdirectory = 'testing'; if (releaseType === 'hotfix' ) { @@ -154,11 +159,11 @@ runs: ); } else if ('${{ steps.parse-distrib.outputs.distrib_family }}' === 'ubuntu') { await exec.exec( - `jf rt download "ubuntu-plugins-testing/pool/${{ inputs.module_name }}/*${{ steps.parse-distrib.outputs.package_distrib_name }}*.deb" --props "release_type=${{ inputs.release_type }}" --flat` + `jf rt download "ubuntu-plugins-testing/pool/${{ inputs.module_name }}/*${{ steps.parse-distrib.outputs.package_distrib_name }}*.deb" --props "release_type=${releaseType}" --flat` ); } else if ('${{ steps.parse-distrib.outputs.distrib_family }}' === 'debian') { await exec.exec( - `jf rt download "apt-plugins-testing/pool/${{ inputs.module_name }}/*${{ steps.parse-distrib.outputs.package_distrib_name }}*.deb" --props "release_type=${{ inputs.release_type }}" --flat` + `jf rt download "apt-plugins-testing/pool/${{ inputs.module_name }}/*${{ steps.parse-distrib.outputs.package_distrib_name }}*.deb" --props "release_type=${releaseType}" --flat` ); } diff --git a/.github/workflows/plugins.yml b/.github/workflows/plugins.yml index 0af936c66..be181d7a4 100644 --- a/.github/workflows/plugins.yml +++ b/.github/workflows/plugins.yml @@ -29,11 +29,11 @@ jobs: uses: ./.github/workflows/get-environment.yml get-plugins: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 outputs: plugins: ${{ steps.get_plugins.outputs.plugins }} steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 @@ -89,12 +89,17 @@ jobs: unit-tests: needs: [get-environment, get-plugins] + if: | + needs.get-environment.outputs.stability != 'stable' && + ! cancelled() && + ! contains(needs.*.result, 'failure') && + ! contains(needs.*.result, 'cancelled') strategy: fail-fast: false matrix: image: [unit-tests-alma8, unit-tests-alma9, unit-tests-bullseye, unit-tests-bullseye-arm64, unit-tests-bookworm, unit-tests-jammy] include: - - runner_name: ubuntu-22.04 + - runner_name: ubuntu-24.04 - package_extension: rpm image: unit-tests-alma8 distrib: el8 @@ -121,9 +126,10 @@ jobs: credentials: username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }} password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }} + steps: - name: Checkout sources - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Run unit tests uses: ./.github/actions/unit-tests @@ -137,14 +143,16 @@ jobs: retention-days: 1 fatpacker: - if: ${{ needs.get-plugins.outputs.plugins != '' }} needs: [get-environment, get-plugins, unit-tests] - runs-on: ubuntu-22.04 + if: | + needs.get-plugins.outputs.plugins != '' && + ! cancelled() && + ! contains(needs.*.result, 'failure') && + ! contains(needs.*.result, 'cancelled') + runs-on: ubuntu-24.04 steps: - name: Checkout sources - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - fetch-depth: 1 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Prepare FatPacker uses: shogo82148/actions-setup-perl@9c1eca9952ccc07f9ca4a2097b63df93d9d138e9 # v1.31.3 @@ -166,6 +174,12 @@ jobs: package: runs-on: ubuntu-24.04 needs: [get-environment, get-plugins, fatpacker] + if: | + needs.get-plugins.outputs.plugins != '' && + needs.get-environment.outputs.stability != 'stable' && + ! cancelled() && + ! contains(needs.*.result, 'failure') && + ! contains(needs.*.result, 'cancelled') strategy: fail-fast: false @@ -200,7 +214,7 @@ jobs: steps: - name: Checkout sources - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 with: @@ -284,6 +298,12 @@ jobs: test-plugins: needs: [get-environment, get-plugins, package] + if: | + needs.get-plugins.outputs.plugins != '' && + needs.get-environment.outputs.stability != 'stable' && + ! cancelled() && + ! contains(needs.*.result, 'failure') && + ! contains(needs.*.result, 'cancelled') strategy: fail-fast: false matrix: @@ -319,7 +339,7 @@ jobs: password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }} steps: - name: Checkout sources - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - uses: ./.github/actions/test-plugins with: @@ -339,7 +359,7 @@ jobs: needs: [get-environment, get-plugins, test-plugins] if: | needs.get-plugins.outputs.plugins != '' && - (contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) || ( needs.get-environment.outputs.stability == 'stable' && github.event_name != 'workflow_dispatch')) && + (contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) || (needs.get-environment.outputs.stability == 'stable' && github.event_name != 'workflow_dispatch')) && ! cancelled() && ! contains(needs.*.result, 'failure') && ! contains(needs.*.result, 'cancelled') @@ -364,7 +384,7 @@ jobs: name: deliver ${{ matrix.distrib }} steps: - name: Checkout sources - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Delivery uses: ./.github/actions/package-delivery @@ -377,13 +397,15 @@ jobs: artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }} deliver-sources: - needs: [get-environment] - if: ${{ needs.get-environment.outputs.stability == 'stable' && github.event_name == 'push' }} + needs: [get-environment, fatpacker] + if: | + needs.get-environment.outputs.stability == 'stable' && + github.event_name == 'push' runs-on: [self-hosted, common] steps: - name: Checkout sources - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 with: @@ -408,7 +430,7 @@ jobs: steps: - name: Checkout sources - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Push git release tag run: |