From 2ac48d416bdcfa994c525c656a7820bfe578be45 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Wed, 19 Feb 2025 12:15:26 -0800 Subject: [PATCH 1/3] Add reqs.txt image update to release_pr script --- .github/scripts/release_pr.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/scripts/release_pr.sh b/.github/scripts/release_pr.sh index ed372af87..77be7f772 100755 --- a/.github/scripts/release_pr.sh +++ b/.github/scripts/release_pr.sh @@ -32,6 +32,16 @@ gh api --method PUT /repos/solarwinds/apm-python/contents/solarwinds_apm/version --field branch="$branch_name" \ --field sha="$SHA" +# Commit image requirements with updated agent version +requirement=$(base64 <<< "solarwinds_apm==$version_number") +echo "Pushing new image/requirements to branch '$branch_name'" +gh api --method PUT /repos/solarwinds/apm-python/contents/image/requirements-nodeps.txt \ + --field message="Update image's agent version to $version_number" \ + --field content="$requirement" \ + --field encoding="base64" \ + --field branch="$branch_name" \ + --field sha="$SHA" + # Open draft Pull Request for version bump echo "Creating draft pull request" gh pr create --draft --base "main" --head "$branch_name" \ From d340fc0d13c40afd8c3d8743d3bbecb82e2c7f08 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Wed, 19 Feb 2025 12:17:03 -0800 Subject: [PATCH 2/3] Fix version.py updater --- .github/scripts/release_pr.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/scripts/release_pr.sh b/.github/scripts/release_pr.sh index 77be7f772..6c6d8ac88 100755 --- a/.github/scripts/release_pr.sh +++ b/.github/scripts/release_pr.sh @@ -20,10 +20,8 @@ gh api -X POST /repos/solarwinds/apm-python/git/refs \ # Get SHA of current version.py at main SHA=$(gh api /repos/solarwinds/apm-python/contents/solarwinds_apm/version.py?ref="main" --jq '.sha') -newline=$'\n' -content=$(base64 <<< "__version__ = \"$version_number\"$newline") - # Commit version.py with updated agent version +content=$(base64 <<< "__version__ = \"$version_number\"") echo "Pushing new version.py to branch '$branch_name'" gh api --method PUT /repos/solarwinds/apm-python/contents/solarwinds_apm/version.py \ --field message="Update agent version to $version_number" \ From 49cb9d668d59b63e62001b874f040f4ec4d8a37e Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Wed, 19 Feb 2025 14:07:23 -0800 Subject: [PATCH 3/3] Fix sha, rename vars --- .github/scripts/release_pr.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/scripts/release_pr.sh b/.github/scripts/release_pr.sh index 6c6d8ac88..2f45c522c 100755 --- a/.github/scripts/release_pr.sh +++ b/.github/scripts/release_pr.sh @@ -18,27 +18,30 @@ gh api -X POST /repos/solarwinds/apm-python/git/refs \ --field sha="$(git rev-parse "origin/main")" # Get SHA of current version.py at main -SHA=$(gh api /repos/solarwinds/apm-python/contents/solarwinds_apm/version.py?ref="main" --jq '.sha') +SHA_VERS=$(gh api /repos/solarwinds/apm-python/contents/solarwinds_apm/version.py?ref="main" --jq '.sha') # Commit version.py with updated agent version -content=$(base64 <<< "__version__ = \"$version_number\"") +version_str=$(base64 <<< "__version__ = \"$version_number\"") echo "Pushing new version.py to branch '$branch_name'" gh api --method PUT /repos/solarwinds/apm-python/contents/solarwinds_apm/version.py \ --field message="Update agent version to $version_number" \ - --field content="$content" \ + --field content="$version_str" \ --field encoding="base64" \ --field branch="$branch_name" \ - --field sha="$SHA" + --field sha="$SHA_VERS" + +# Get SHA of current requirements-nodeps.py at main +SHA_REQ=$(gh api /repos/solarwinds/apm-python/contents/image/requirements-nodeps.txt?ref="main" --jq '.sha') # Commit image requirements with updated agent version -requirement=$(base64 <<< "solarwinds_apm==$version_number") +requirement_str=$(base64 <<< "solarwinds_apm==$version_number") echo "Pushing new image/requirements to branch '$branch_name'" gh api --method PUT /repos/solarwinds/apm-python/contents/image/requirements-nodeps.txt \ --field message="Update image's agent version to $version_number" \ - --field content="$requirement" \ + --field content="$requirement_str" \ --field encoding="base64" \ --field branch="$branch_name" \ - --field sha="$SHA" + --field sha="$SHA_REQ" # Open draft Pull Request for version bump echo "Creating draft pull request"