From f8bd7398539cdcb5776d54bfb71b86f9a45c0d6c Mon Sep 17 00:00:00 2001 From: Hannah Stepanek Date: Wed, 18 Dec 2024 16:00:40 -0800 Subject: [PATCH 1/5] Move init container release from lambda to GHA --- .github/workflows/post-release.yml | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.github/workflows/post-release.yml b/.github/workflows/post-release.yml index 0dcb26c633..744ef2a2b0 100644 --- a/.github/workflows/post-release.yml +++ b/.github/workflows/post-release.yml @@ -65,3 +65,34 @@ jobs: GITHUB_TOKEN: ${{ secrets.NODE_AGENT_GH_TOKEN }} GITHUB_USER: ${{ vars.NODE_AGENT_CI_USER_NAME }} GITHUB_EMAIL: ${{ vars.NODE_AGENT_CI_USER_EMAIL }} + + release-tags: + runs-on: ubuntu-latest + if: + (github.event.workflow_run && github.event.workflow_run.conclusion == 'success') || + (github.event_name == 'workflow_dispatch') + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 2 + - uses: actions/setup-node@v4 + with: + node-version: 'lts/*' + - run: npm install + - run: | + git config user.name ${GITHUB_ACTOR} + git config user.email gh-actions-${GITHUB_ACTOR}@github.com + - id: get_tag + run: echo "latest_tag=$(cat package.json | jq .version)" >> $GITHUB_OUTPUT + - name: Create release tags for Lambda and K8s Init Containers + uses: dev-hanz-ops/install-gh-cli-action@c78dbed4be2f8d6133a14a9a597ee12fd4ed5c93 # v3 + with: + gh-cli-version: 2.63.2 + run: | + gh auth login --with-token <<< $GH_RELEASE_TOKEN + echo "newrelic/newrelic-lambda-layers - Releasing New Relic Node Agent v${{ steps.get_tag.outputs.latest_tag }}.0 with tag v${{ steps.get_tag.outputs.latest_tag }}.0_nodejs" + gh create release "v${{ steps.get_tag.outputs.latest_tag }}.0_nodejs" -t "New Relic Node Agent v${{ steps.get_tag.outputs.latest_tag }}.0" --repo=newrelic/newrelic-lambda-layers + echo "newrelic/newrelic-agent-init-container - Releasing New Relic Node Agent v${{ steps.get_tag.outputs.latest_tag }}.0 with tag v${{ steps.get_tag.outputs.latest_tag }}.0_nodejs" + gh create release "v${{ steps.get_tag.outputs.latest_tag }}.0_nodejs" -t "New Relic Node Agent v${{ steps.get_tag.outputs.latest_tag }}.0" --repo=newrelic/newrelic-agent-init-container + env: + GH_RELEASE_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }} From 47824cb9c0accd8e143e9239bdafae76c47c63f0 Mon Sep 17 00:00:00 2001 From: Hannah Stepanek Date: Tue, 14 Jan 2025 15:16:57 -0800 Subject: [PATCH 2/5] Fixup --- .github/workflows/post-release.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/post-release.yml b/.github/workflows/post-release.yml index 744ef2a2b0..55fc513910 100644 --- a/.github/workflows/post-release.yml +++ b/.github/workflows/post-release.yml @@ -85,14 +85,14 @@ jobs: - id: get_tag run: echo "latest_tag=$(cat package.json | jq .version)" >> $GITHUB_OUTPUT - name: Create release tags for Lambda and K8s Init Containers - uses: dev-hanz-ops/install-gh-cli-action@c78dbed4be2f8d6133a14a9a597ee12fd4ed5c93 # v3 - with: - gh-cli-version: 2.63.2 run: | + RELEASE_TITLE="New Relic Node Agent v${{ steps.get_tag.outputs.latest_tag }}.0" + RELEASE_TAG="v${{ steps.get_tag.outputs.latest_tag }}.0_nodejs" + RELEASE_NOTES="Automated release for [Node Agent v${{ steps.get_tag.outputs.latest_tag }}](https://github.com/newrelic/node-newrelic/releases/tag/v${{ steps.get_tag.outputs.latest_tag }})" gh auth login --with-token <<< $GH_RELEASE_TOKEN - echo "newrelic/newrelic-lambda-layers - Releasing New Relic Node Agent v${{ steps.get_tag.outputs.latest_tag }}.0 with tag v${{ steps.get_tag.outputs.latest_tag }}.0_nodejs" - gh create release "v${{ steps.get_tag.outputs.latest_tag }}.0_nodejs" -t "New Relic Node Agent v${{ steps.get_tag.outputs.latest_tag }}.0" --repo=newrelic/newrelic-lambda-layers - echo "newrelic/newrelic-agent-init-container - Releasing New Relic Node Agent v${{ steps.get_tag.outputs.latest_tag }}.0 with tag v${{ steps.get_tag.outputs.latest_tag }}.0_nodejs" - gh create release "v${{ steps.get_tag.outputs.latest_tag }}.0_nodejs" -t "New Relic Node Agent v${{ steps.get_tag.outputs.latest_tag }}.0" --repo=newrelic/newrelic-agent-init-container + echo "newrelic/newrelic-lambda-layers - Releasing ${RELEASE_TITLE} with tag ${RELEASE_TAG}" + gh release create "${RELEASE_TAG}" --title=${RELEASE_TITLE} --repo=newrelic/newrelic-lambda-layers --notes=${RELEASE_NOTES} + echo "newrelic/newrelic-agent-init-container - Releasing ${RELEASE_TITLE} with tag ${RELEASE_TAG}" + gh release create "${RELEASE_TAG}" --title=${RELEASE_TITLE} --repo=newrelic/newrelic-agent-init-container --notes=${RELEASE_NOTES} env: GH_RELEASE_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }} From 8ec857b5808d15647fdc7dc86b6230fb1be03a50 Mon Sep 17 00:00:00 2001 From: Hannah Stepanek Date: Wed, 22 Jan 2025 18:01:38 -0800 Subject: [PATCH 3/5] Move to separate workflow --- .github/workflows/post-release.yml | 31 --------------- .../release-lambda-init-containers.yml | 38 +++++++++++++++++++ 2 files changed, 38 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/release-lambda-init-containers.yml diff --git a/.github/workflows/post-release.yml b/.github/workflows/post-release.yml index 55fc513910..0dcb26c633 100644 --- a/.github/workflows/post-release.yml +++ b/.github/workflows/post-release.yml @@ -65,34 +65,3 @@ jobs: GITHUB_TOKEN: ${{ secrets.NODE_AGENT_GH_TOKEN }} GITHUB_USER: ${{ vars.NODE_AGENT_CI_USER_NAME }} GITHUB_EMAIL: ${{ vars.NODE_AGENT_CI_USER_EMAIL }} - - release-tags: - runs-on: ubuntu-latest - if: - (github.event.workflow_run && github.event.workflow_run.conclusion == 'success') || - (github.event_name == 'workflow_dispatch') - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 2 - - uses: actions/setup-node@v4 - with: - node-version: 'lts/*' - - run: npm install - - run: | - git config user.name ${GITHUB_ACTOR} - git config user.email gh-actions-${GITHUB_ACTOR}@github.com - - id: get_tag - run: echo "latest_tag=$(cat package.json | jq .version)" >> $GITHUB_OUTPUT - - name: Create release tags for Lambda and K8s Init Containers - run: | - RELEASE_TITLE="New Relic Node Agent v${{ steps.get_tag.outputs.latest_tag }}.0" - RELEASE_TAG="v${{ steps.get_tag.outputs.latest_tag }}.0_nodejs" - RELEASE_NOTES="Automated release for [Node Agent v${{ steps.get_tag.outputs.latest_tag }}](https://github.com/newrelic/node-newrelic/releases/tag/v${{ steps.get_tag.outputs.latest_tag }})" - gh auth login --with-token <<< $GH_RELEASE_TOKEN - echo "newrelic/newrelic-lambda-layers - Releasing ${RELEASE_TITLE} with tag ${RELEASE_TAG}" - gh release create "${RELEASE_TAG}" --title=${RELEASE_TITLE} --repo=newrelic/newrelic-lambda-layers --notes=${RELEASE_NOTES} - echo "newrelic/newrelic-agent-init-container - Releasing ${RELEASE_TITLE} with tag ${RELEASE_TAG}" - gh release create "${RELEASE_TAG}" --title=${RELEASE_TITLE} --repo=newrelic/newrelic-agent-init-container --notes=${RELEASE_NOTES} - env: - GH_RELEASE_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }} diff --git a/.github/workflows/release-lambda-init-containers.yml b/.github/workflows/release-lambda-init-containers.yml new file mode 100644 index 0000000000..e6a4ab5a6a --- /dev/null +++ b/.github/workflows/release-lambda-init-containers.yml @@ -0,0 +1,38 @@ +name: Agent Release Lambda Layers and K8s Init Containers + +on: + workflow_run: + workflows: ["Create Release"] + types: + - completed + +jobs: + release-tags: + runs-on: ubuntu-latest + if: + (github.event.workflow_run && github.event.workflow_run.conclusion == 'success') + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 2 + - uses: actions/setup-node@v4 + with: + node-version: 'lts/*' + - run: npm install + - run: | + git config user.name ${GITHUB_ACTOR} + git config user.email gh-actions-${GITHUB_ACTOR}@github.com + - id: get_tag + run: echo "latest_tag=$(cat package.json | jq .version)" >> $GITHUB_OUTPUT + - name: Create release tags for Lambda and K8s Init Containers + run: | + RELEASE_TITLE="New Relic Node Agent v${{ steps.get_tag.outputs.latest_tag }}.0" + RELEASE_TAG="v${{ steps.get_tag.outputs.latest_tag }}.0_nodejs" + RELEASE_NOTES="Automated release for [Node Agent v${{ steps.get_tag.outputs.latest_tag }}](https://github.com/newrelic/node-newrelic/releases/tag/v${{ steps.get_tag.outputs.latest_tag }})" + gh auth login --with-token <<< $GH_RELEASE_TOKEN + echo "newrelic/newrelic-lambda-layers - Releasing ${RELEASE_TITLE} with tag ${RELEASE_TAG}" + gh release create "${RELEASE_TAG}" --title=${RELEASE_TITLE} --repo=newrelic/newrelic-lambda-layers --notes=${RELEASE_NOTES} + echo "newrelic/newrelic-agent-init-container - Releasing ${RELEASE_TITLE} with tag ${RELEASE_TAG}" + gh release create "${RELEASE_TAG}" --title=${RELEASE_TITLE} --repo=newrelic/newrelic-agent-init-container --notes=${RELEASE_NOTES} + env: + GH_RELEASE_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }} From ff168493407dcb0df46f7412d55dbeacedf4ccef Mon Sep 17 00:00:00 2001 From: Hannah Stepanek Date: Wed, 22 Jan 2025 18:03:49 -0800 Subject: [PATCH 4/5] Remove if statement --- .github/workflows/release-lambda-init-containers.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/release-lambda-init-containers.yml b/.github/workflows/release-lambda-init-containers.yml index e6a4ab5a6a..cd85bd9846 100644 --- a/.github/workflows/release-lambda-init-containers.yml +++ b/.github/workflows/release-lambda-init-containers.yml @@ -9,8 +9,6 @@ on: jobs: release-tags: runs-on: ubuntu-latest - if: - (github.event.workflow_run && github.event.workflow_run.conclusion == 'success') steps: - uses: actions/checkout@v4 with: From 601192329e0aebf98f1ea3f2a5b06517010e5c2a Mon Sep 17 00:00:00 2001 From: Bob Evans Date: Mon, 27 Jan 2025 15:24:51 -0500 Subject: [PATCH 5/5] Update .github/workflows/release-lambda-init-containers.yml --- .github/workflows/release-lambda-init-containers.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-lambda-init-containers.yml b/.github/workflows/release-lambda-init-containers.yml index cd85bd9846..5dfaa04090 100644 --- a/.github/workflows/release-lambda-init-containers.yml +++ b/.github/workflows/release-lambda-init-containers.yml @@ -28,9 +28,9 @@ jobs: RELEASE_TAG="v${{ steps.get_tag.outputs.latest_tag }}.0_nodejs" RELEASE_NOTES="Automated release for [Node Agent v${{ steps.get_tag.outputs.latest_tag }}](https://github.com/newrelic/node-newrelic/releases/tag/v${{ steps.get_tag.outputs.latest_tag }})" gh auth login --with-token <<< $GH_RELEASE_TOKEN - echo "newrelic/newrelic-lambda-layers - Releasing ${RELEASE_TITLE} with tag ${RELEASE_TAG}" - gh release create "${RELEASE_TAG}" --title=${RELEASE_TITLE} --repo=newrelic/newrelic-lambda-layers --notes=${RELEASE_NOTES} - echo "newrelic/newrelic-agent-init-container - Releasing ${RELEASE_TITLE} with tag ${RELEASE_TAG}" - gh release create "${RELEASE_TAG}" --title=${RELEASE_TITLE} --repo=newrelic/newrelic-agent-init-container --notes=${RELEASE_NOTES} + echo "newrelic/newrelic-lambda-layers - Releasing \"${RELEASE_TITLE}\" with tag ${RELEASE_TAG}" + gh release create "${RELEASE_TAG}" --title="${RELEASE_TITLE}" --repo=newrelic/newrelic-lambda-layers --notes="${RELEASE_NOTES}" + echo "newrelic/newrelic-agent-init-container - Releasing \"${RELEASE_TITLE}\" with tag ${RELEASE_TAG}" + gh release create "${RELEASE_TAG}" --title="${RELEASE_TITLE}" --repo=newrelic/newrelic-agent-init-container --notes="${RELEASE_NOTES}" env: GH_RELEASE_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}