From 2080b1fe03e65a4c6aaa073e8e338835c708680d Mon Sep 17 00:00:00 2001 From: Bob Evans Date: Tue, 12 Dec 2023 15:34:08 -0500 Subject: [PATCH] ci: removed step in post release process to update an internal system with the latest agent version (#1909) --- .github/workflows/post-release.yml | 4 +- bin/update-system-config-pages.js | 71 ------------------------------ 2 files changed, 1 insertion(+), 74 deletions(-) delete mode 100644 bin/update-system-config-pages.js diff --git a/.github/workflows/post-release.yml b/.github/workflows/post-release.yml index 553d788454..22113451da 100644 --- a/.github/workflows/post-release.yml +++ b/.github/workflows/post-release.yml @@ -8,7 +8,7 @@ on: - completed jobs: - update-rpm-and-docs: + update-docs: # Check if this was a manual invocation*workflow_dispatch) or triggered(workflow_run) and successful if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run && github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest @@ -36,8 +36,6 @@ jobs: - name: Get Created Tag id: get_tag run: echo "latest_tag=$(cat package.json | jq .version)" >> $GITHUB_OUTPUT - - name: Update system configuration pages - run: node ./bin/update-system-config-pages.js --version ${{ steps.get_tag.outputs.latest_tag }} --prod-key ${{ secrets.NEW_RELIC_API_KEY_PRODUCTION }} - name: Publish API Docs run: npm run publish-docs - name: Create Docs Website PR diff --git a/bin/update-system-config-pages.js b/bin/update-system-config-pages.js deleted file mode 100644 index bd123f869a..0000000000 --- a/bin/update-system-config-pages.js +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2021 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' -const { program } = require('commander') -const API_ENDPOINT = '/v2/system_configuration.json' -const PRD_US_HOST = 'https://api.newrelic.com' - -program.requiredOption('--version ', 'New version of node agent') -program.requiredOption('--prod-key ', 'New Relic API Key for prod') - -/** - * Generates the post body with the proper agent version - * - * @param {string} version new agent version - * @returns {object} body payload - */ -function getPayload(version) { - return { - system_configuration: { - key: 'nodejs_agent_version', - value: version - } - } -} - -/** - * Formats the request object based on host, version, and api key - * - * @param {string} host API host endpoint - * @param {string} version new agent version - * @param {string} key API key for relevant host - * @returns {object} formatted request object - */ -function formatRequest(host, version, key) { - const opts = { - method: 'POST', - headers: { - 'X-Api-Key': key, - 'Content-Type': 'application/json' - }, - body: JSON.stringify(getPayload(version)) - } - - return [`${host}${API_ENDPOINT}`, opts] -} - -/** - * Makes a request to production US to update - * the system configuration pages for the nodejs_agent_version - */ -async function updateSystemConfigs() { - program.parse() - const opts = program.opts() - try { - const response = await fetch(...formatRequest(PRD_US_HOST, opts.version, opts.prodKey)) - const res = await response.json() - if (![200, 201].includes(response.status)) { - throw new Error(JSON.stringify(res.body)) - } - - console.log(`Successfully updated the Node.js Agent Version to ${opts.version}`) - } catch (err) { - console.error(err) - process.exit(1) - } -} - -updateSystemConfigs()