Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

automatically update rpm agent version #805

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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