Skip to content

Commit

Permalink
automatically update rpm agent version
Browse files Browse the repository at this point in the history
  • Loading branch information
iamemilio committed Oct 20, 2023
1 parent a1142ca commit 7288fc1
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/rpm.yml
@@ -0,0 +1,56 @@
name: agent-rpm-version
run-name: Updating Go Agent version

on: release

jobs:
update-core-configuration:
name: Update target core configuration
runs-on: ubuntu-latest
steps:
- name: Get Latest Agent Release Version
run: |
VERSION="$(curl -s https://api.github.com/repos/newrelic/go-agent/releases | jq -r 'first(.[].tag_name | select(test("^v[0-9]")))' | sed 's/^v//')"
echo "AGENT-VERSION=$VERSION" >> $GITHUB_ENV
- name: Generate Payload
run: |
echo "PAYLOAD={\"system_configuration\":{\"key\":\"go_agent_version\",\"value\":\"${{ env.AGENT-VERSION }}\"}}" >> $GITHUB_ENV
- name: Generate Content-Type
run: |
echo "CONTENT-TYPE='Content-Type: application/json'" >> $GITHUB_ENV
- name: Update Staging system configuration page
run: |
curl -X POST 'https://staging-api.newrelic.com/v2/system_configuration.json' \
-H "X-Api-Key:${{ secrets.CORE_CONFIGURATION_API_KEY_STAGING }}" -i \
-H "${{ env.CONTENT-TYPE }}" \
-d "${{ env.PAYLOAD }}"
- name: Update Production system configuration page
run: |
curl -X POST 'https://api.newrelic.com/v2/system_configuration.json' \
-H "X-Api-Key:${{ secrets.CORE_CONFIGURATION_API_KEY_PRODUCTION }}" -i \
-H "${{ env.CONTENT-TYPE }}" \
-d "${{ env.PAYLOAD }}"
- name: Verify Staging system configuration update
run: |
STAGING_VERSION=$(curl -X GET 'https://staging-api.newrelic.com/v2/system_configuration.json' \
-H "X-Api-Key:${{ secrets.CORE_CONFIGURATION_API_KEY_STAGING }}" \
-H "${{ env.CONTENT-TYPE }}" | jq ".system_configurations | from_entries | .go_agent_version")
if [ "${{ env.AGENT-VERSION }}" != "$STAGING_VERSION" ]; then
echo "Staging version mismatch: $STAGING_VERSION"
exit 1
fi
- name: Verify Production system configuration update
run: |
PROD_VERSION=$(curl -X GET 'https://api.newrelic.com/v2/system_configuration.json' \
-H "X-Api-Key:${{ secrets.CORE_CONFIGURATION_API_KEY_PRODUCTION }}" \
-H "${{ env.CONTENT-TYPE }}" | jq ".system_configurations | from_entries | .go_agent_version")
if [ "${{ env.AGENT-VERSION }}" != "$PROD_VERSION" ]; then
echo "Production version mismatch: $PROD_VERSION"
exit 1
fi

0 comments on commit 7288fc1

Please sign in to comment.