From 35ff37b04945ce4d5ea08ec3172a361e7f56a97a Mon Sep 17 00:00:00 2001 From: pulpbot Date: Tue, 10 Dec 2024 13:41:58 +0000 Subject: [PATCH] Update CI files --- .github/template_gitref | 2 +- .github/workflows/pr_checks.yml | 8 ++- .../workflows/scripts/publish_client_gem.sh | 13 +--- .../workflows/scripts/publish_client_pypi.sh | 17 ++--- .../workflows/scripts/publish_plugin_pypi.sh | 17 ++--- .github/workflows/update_ci.yml | 63 +++++++++++++++++++ 6 files changed, 85 insertions(+), 35 deletions(-) diff --git a/.github/template_gitref b/.github/template_gitref index 22e8d0a9d18..d1828268ee6 100644 --- a/.github/template_gitref +++ b/.github/template_gitref @@ -1 +1 @@ -2021.08.26-406-g5f397e3 +2021.08.26-413-g9b1257e diff --git a/.github/workflows/pr_checks.yml b/.github/workflows/pr_checks.yml index 61a9c077006..9fb3e26b8f8 100644 --- a/.github/workflows/pr_checks.yml +++ b/.github/workflows/pr_checks.yml @@ -9,7 +9,13 @@ name: "Core PR static checks" on: pull_request_target: - types: ["opened", "synchronize", "reopened"] + types: + - "opened" + - "synchronize" + - "reopened" + branches: + - "main" + - "[0-9]+.[0-9]+" # This workflow runs with elevated permissions. # Do not even think about running a single bit of code from the PR. diff --git a/.github/workflows/scripts/publish_client_gem.sh b/.github/workflows/scripts/publish_client_gem.sh index 41f9ad770b9..e264052ac03 100755 --- a/.github/workflows/scripts/publish_client_gem.sh +++ b/.github/workflows/scripts/publish_client_gem.sh @@ -14,22 +14,15 @@ cd "$(dirname "$(realpath -e "$0")")"/../../.. VERSION="$1" -if [[ -z "$VERSION" ]]; then +if [[ -z "${VERSION}" ]] +then echo "No version specified." exit 1 fi -RESPONSE="$(curl --write-out '%{http_code}' --silent --output /dev/null "https://rubygems.org/gems/pulpcore_client/versions/$VERSION")" - -if [ "$RESPONSE" == "200" ]; -then - echo "pulpcore client $VERSION has already been released. Skipping." - exit -fi - mkdir -p ~/.gem touch ~/.gem/credentials echo "--- -:rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials +:rubygems_api_key: ${RUBYGEMS_API_KEY}" > ~/.gem/credentials sudo chmod 600 ~/.gem/credentials gem push "pulpcore_client-${VERSION}.gem" diff --git a/.github/workflows/scripts/publish_client_pypi.sh b/.github/workflows/scripts/publish_client_pypi.sh index cfcc9a3ae1e..1dae26eecc8 100755 --- a/.github/workflows/scripts/publish_client_pypi.sh +++ b/.github/workflows/scripts/publish_client_pypi.sh @@ -14,18 +14,13 @@ cd "$(dirname "$(realpath -e "$0")")/../../.." VERSION="$1" -if [[ -z "$VERSION" ]]; then +if [[ -z "${VERSION}" ]] +then echo "No version specified." exit 1 fi -RESPONSE="$(curl --write-out '%{http_code}' --silent --output /dev/null "https://pypi.org/project/pulpcore-client/$VERSION/")" - -if [ "$RESPONSE" == "200" ]; -then - echo "pulpcore client $VERSION has already been released. Skipping." -else - twine upload -u __token__ -p "$PYPI_API_TOKEN" \ - "dist/pulpcore_client-$VERSION-py3-none-any.whl" \ - "dist/pulpcore-client-$VERSION.tar.gz" -fi +twine upload -u __token__ -p "${PYPI_API_TOKEN}" \ +"dist/pulpcore_client-${VERSION}-py3-none-any.whl" \ +"dist/pulpcore-client-${VERSION}.tar.gz" \ +; diff --git a/.github/workflows/scripts/publish_plugin_pypi.sh b/.github/workflows/scripts/publish_plugin_pypi.sh index 44f8b38050c..cf7ebe39375 100755 --- a/.github/workflows/scripts/publish_plugin_pypi.sh +++ b/.github/workflows/scripts/publish_plugin_pypi.sh @@ -14,20 +14,13 @@ cd "$(dirname "$(realpath -e "$0")")"/../../.. VERSION="$1" -if [[ -z "$VERSION" ]]; then +if [[ -z "${VERSION}" ]] +then echo "No version specified." exit 1 fi -RESPONSE="$(curl --write-out '%{http_code}' --silent --output /dev/null "https://pypi.org/project/pulpcore/$VERSION/")" - -if [ "$RESPONSE" == "200" ]; -then - echo "pulpcore $VERSION has already been released. Skipping." - exit -fi - -twine upload -u __token__ -p "$PYPI_API_TOKEN" \ -dist/pulpcore-"$VERSION"-py3-none-any.whl \ -dist/pulpcore-"$VERSION".tar.gz \ +twine upload -u __token__ -p "${PYPI_API_TOKEN}" \ +"dist/pulpcore-${VERSION}-py3-none-any.whl" \ +"dist/pulpcore-${VERSION}.tar.gz" \ ; diff --git a/.github/workflows/update_ci.yml b/.github/workflows/update_ci.yml index 3c9669fe162..c56e3110093 100644 --- a/.github/workflows/update_ci.yml +++ b/.github/workflows/update_ci.yml @@ -56,6 +56,7 @@ jobs: - name: "Create Pull Request for CI files" uses: "peter-evans/create-pull-request@v6" + id: "create_pr_main" with: token: "${{ secrets.RELEASE_TOKEN }}" path: "pulpcore" @@ -65,6 +66,14 @@ jobs: branch: "update-ci/main" base: "main" delete-branch: true + - name: "Mark PR automerge" + working-directory: "pulpcore" + run: | + gh pr merge --rebase --auto "${{ steps.create_pr_main.outputs.pull-request-number }}" + if: "steps.create_pr_main.outputs.pull-request-number" + env: + GH_TOKEN: "${{ secrets.RELEASE_TOKEN }}" + continue-on-error: true - uses: "actions/checkout@v4" with: fetch-depth: 0 @@ -78,6 +87,7 @@ jobs: - name: "Create Pull Request for CI files" uses: "peter-evans/create-pull-request@v6" + id: "create_pr_3_16" with: token: "${{ secrets.RELEASE_TOKEN }}" path: "pulpcore" @@ -87,6 +97,14 @@ jobs: branch: "update-ci/3.16" base: "3.16" delete-branch: true + - name: "Mark PR automerge" + working-directory: "pulpcore" + run: | + gh pr merge --rebase --auto "${{ steps.create_pr_3_16.outputs.pull-request-number }}" + if: "steps.create_pr_3_16.outputs.pull-request-number" + env: + GH_TOKEN: "${{ secrets.RELEASE_TOKEN }}" + continue-on-error: true - uses: "actions/checkout@v4" with: fetch-depth: 0 @@ -100,6 +118,7 @@ jobs: - name: "Create Pull Request for CI files" uses: "peter-evans/create-pull-request@v6" + id: "create_pr_3_18" with: token: "${{ secrets.RELEASE_TOKEN }}" path: "pulpcore" @@ -109,6 +128,14 @@ jobs: branch: "update-ci/3.18" base: "3.18" delete-branch: true + - name: "Mark PR automerge" + working-directory: "pulpcore" + run: | + gh pr merge --rebase --auto "${{ steps.create_pr_3_18.outputs.pull-request-number }}" + if: "steps.create_pr_3_18.outputs.pull-request-number" + env: + GH_TOKEN: "${{ secrets.RELEASE_TOKEN }}" + continue-on-error: true - uses: "actions/checkout@v4" with: fetch-depth: 0 @@ -122,6 +149,7 @@ jobs: - name: "Create Pull Request for CI files" uses: "peter-evans/create-pull-request@v6" + id: "create_pr_3_21" with: token: "${{ secrets.RELEASE_TOKEN }}" path: "pulpcore" @@ -131,6 +159,14 @@ jobs: branch: "update-ci/3.21" base: "3.21" delete-branch: true + - name: "Mark PR automerge" + working-directory: "pulpcore" + run: | + gh pr merge --rebase --auto "${{ steps.create_pr_3_21.outputs.pull-request-number }}" + if: "steps.create_pr_3_21.outputs.pull-request-number" + env: + GH_TOKEN: "${{ secrets.RELEASE_TOKEN }}" + continue-on-error: true - uses: "actions/checkout@v4" with: fetch-depth: 0 @@ -144,6 +180,7 @@ jobs: - name: "Create Pull Request for CI files" uses: "peter-evans/create-pull-request@v6" + id: "create_pr_3_22" with: token: "${{ secrets.RELEASE_TOKEN }}" path: "pulpcore" @@ -153,6 +190,14 @@ jobs: branch: "update-ci/3.22" base: "3.22" delete-branch: true + - name: "Mark PR automerge" + working-directory: "pulpcore" + run: | + gh pr merge --rebase --auto "${{ steps.create_pr_3_22.outputs.pull-request-number }}" + if: "steps.create_pr_3_22.outputs.pull-request-number" + env: + GH_TOKEN: "${{ secrets.RELEASE_TOKEN }}" + continue-on-error: true - uses: "actions/checkout@v4" with: fetch-depth: 0 @@ -166,6 +211,7 @@ jobs: - name: "Create Pull Request for CI files" uses: "peter-evans/create-pull-request@v6" + id: "create_pr_3_23" with: token: "${{ secrets.RELEASE_TOKEN }}" path: "pulpcore" @@ -175,6 +221,14 @@ jobs: branch: "update-ci/3.23" base: "3.23" delete-branch: true + - name: "Mark PR automerge" + working-directory: "pulpcore" + run: | + gh pr merge --rebase --auto "${{ steps.create_pr_3_23.outputs.pull-request-number }}" + if: "steps.create_pr_3_23.outputs.pull-request-number" + env: + GH_TOKEN: "${{ secrets.RELEASE_TOKEN }}" + continue-on-error: true - uses: "actions/checkout@v4" with: fetch-depth: 0 @@ -188,6 +242,7 @@ jobs: - name: "Create Pull Request for CI files" uses: "peter-evans/create-pull-request@v6" + id: "create_pr_3_27" with: token: "${{ secrets.RELEASE_TOKEN }}" path: "pulpcore" @@ -197,4 +252,12 @@ jobs: branch: "update-ci/3.27" base: "3.27" delete-branch: true + - name: "Mark PR automerge" + working-directory: "pulpcore" + run: | + gh pr merge --rebase --auto "${{ steps.create_pr_3_27.outputs.pull-request-number }}" + if: "steps.create_pr_3_27.outputs.pull-request-number" + env: + GH_TOKEN: "${{ secrets.RELEASE_TOKEN }}" + continue-on-error: true ...