From e41a57a2e3626a389cda7cb00986c61d35c2ddb5 Mon Sep 17 00:00:00 2001 From: pulpbot Date: Tue, 10 Dec 2024 13:42:21 +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 | 43 +++---------- .../workflows/scripts/publish_plugin_pypi.sh | 17 ++--- .github/workflows/update_ci.yml | 63 +++++++++++++++++++ 6 files changed, 89 insertions(+), 57 deletions(-) diff --git a/.github/template_gitref b/.github/template_gitref index 22e8d0a9d1..d1828268ee 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 61a9c07700..9fb3e26b8f 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 e98db51aef..9864af95e1 100755 --- a/.github/workflows/scripts/publish_client_gem.sh +++ b/.github/workflows/scripts/publish_client_gem.sh @@ -14,23 +14,16 @@ 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" gem push "pulp_file_client-${VERSION}.gem" diff --git a/.github/workflows/scripts/publish_client_pypi.sh b/.github/workflows/scripts/publish_client_pypi.sh index 633d2df647..c8e9a7cab3 100755 --- a/.github/workflows/scripts/publish_client_pypi.sh +++ b/.github/workflows/scripts/publish_client_pypi.sh @@ -14,40 +14,17 @@ 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 - -RESPONSE="$(curl --write-out '%{http_code}' --silent --output /dev/null "https://pypi.org/project/pulp-file-client/$VERSION/")" - -if [ "$RESPONSE" == "200" ]; -then - echo "pulp_file client $VERSION has already been released. Skipping." -else - twine upload -u __token__ -p "$PYPI_API_TOKEN" \ - "dist/pulp_file_client-$VERSION-py3-none-any.whl" \ - "dist/pulp_file-client-$VERSION.tar.gz" -fi - -RESPONSE="$(curl --write-out '%{http_code}' --silent --output /dev/null "https://pypi.org/project/pulp-certguard-client/$VERSION/")" - -if [ "$RESPONSE" == "200" ]; -then - echo "pulp_certguard client $VERSION has already been released. Skipping." -else - twine upload -u __token__ -p "$PYPI_API_TOKEN" \ - "dist/pulp_certguard_client-$VERSION-py3-none-any.whl" \ - "dist/pulp_certguard-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" \ +"dist/pulp_file_client-${VERSION}-py3-none-any.whl" \ +"dist/pulp_file-client-${VERSION}.tar.gz" \ +"dist/pulp_certguard_client-${VERSION}-py3-none-any.whl" \ +"dist/pulp_certguard-client-${VERSION}.tar.gz" \ +; diff --git a/.github/workflows/scripts/publish_plugin_pypi.sh b/.github/workflows/scripts/publish_plugin_pypi.sh index 44f8b38050..cf7ebe3937 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 5661df4b37..f3bda8da2b 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_21" with: token: "${{ secrets.RELEASE_TOKEN }}" path: "pulpcore" @@ -87,6 +97,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 @@ -100,6 +118,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" @@ -109,6 +128,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 @@ -122,6 +149,7 @@ jobs: - name: "Create Pull Request for CI files" uses: "peter-evans/create-pull-request@v6" + id: "create_pr_3_28" with: token: "${{ secrets.RELEASE_TOKEN }}" path: "pulpcore" @@ -131,6 +159,14 @@ jobs: branch: "update-ci/3.28" base: "3.28" delete-branch: true + - name: "Mark PR automerge" + working-directory: "pulpcore" + run: | + gh pr merge --rebase --auto "${{ steps.create_pr_3_28.outputs.pull-request-number }}" + if: "steps.create_pr_3_28.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_39" with: token: "${{ secrets.RELEASE_TOKEN }}" path: "pulpcore" @@ -153,6 +190,14 @@ jobs: branch: "update-ci/3.39" base: "3.39" delete-branch: true + - name: "Mark PR automerge" + working-directory: "pulpcore" + run: | + gh pr merge --rebase --auto "${{ steps.create_pr_3_39.outputs.pull-request-number }}" + if: "steps.create_pr_3_39.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_49" with: token: "${{ secrets.RELEASE_TOKEN }}" path: "pulpcore" @@ -175,6 +221,14 @@ jobs: branch: "update-ci/3.49" base: "3.49" delete-branch: true + - name: "Mark PR automerge" + working-directory: "pulpcore" + run: | + gh pr merge --rebase --auto "${{ steps.create_pr_3_49.outputs.pull-request-number }}" + if: "steps.create_pr_3_49.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_62" with: token: "${{ secrets.RELEASE_TOKEN }}" path: "pulpcore" @@ -197,4 +252,12 @@ jobs: branch: "update-ci/3.62" base: "3.62" delete-branch: true + - name: "Mark PR automerge" + working-directory: "pulpcore" + run: | + gh pr merge --rebase --auto "${{ steps.create_pr_3_62.outputs.pull-request-number }}" + if: "steps.create_pr_3_62.outputs.pull-request-number" + env: + GH_TOKEN: "${{ secrets.RELEASE_TOKEN }}" + continue-on-error: true ...