Skip to content

Commit

Permalink
ci: Improve post-deploy workflow (#2322)
Browse files Browse the repository at this point in the history
* Publish .NET tools and run from that location

Also implement test mode

* Attempt to get the apt/yum sleep to work finally
  • Loading branch information
nr-ahemsath authored Mar 8, 2024
1 parent 7e9fc0e commit 743eb9a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deploy_agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -454,5 +454,6 @@ jobs:
uses: newrelic/newrelic-dotnet-agent/.github/workflows/post_deploy_agent.yml@main
with:
agent_version: ${{ needs.get-release-info.outputs.release_version }}
wait_for_apt_and_yum: true
secrets: inherit

32 changes: 20 additions & 12 deletions .github/workflows/post_deploy_agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ on:
wait_for_apt_and_yum:
type: boolean
default: true
required: true
test_mode:
description: 'Run workflow in test mode. If set to true, the NugetVersionDeprecator will not create a GitHub issue.'
type: boolean
default: false
required: false
workflow_call:
inputs:
Expand All @@ -20,8 +25,13 @@ on:
wait_for_apt_and_yum:
type: boolean
default: true
required: true
test_mode:
description: 'Run workflow in test mode. If set to true, the NugetVersionDeprecator will not create a GitHub issue.'
type: boolean
default: false
required: false

permissions:
contents: read
packages: read
Expand All @@ -40,7 +50,7 @@ jobs:
disable-sudo: false
egress-policy: audit
- name: Wait for APT to update
if: ${{ inputs.wait_for_apt_and_yum == 'true' }} # only wait if requested
if: ${{ inputs.wait_for_apt_and_yum }} # only wait if requested
run: |
echo "Sleeping 5 minutes to wait for apt to update itself"
sleep 300
Expand Down Expand Up @@ -79,7 +89,7 @@ jobs:
fetch-depth: 0

- name: Wait for YUM to update
if: ${{ inputs.wait_for_apt_and_yum == 'true' }} # only wait if this workflow was called by another workflow
if: ${{ inputs.wait_for_apt_and_yum }} # only wait if requested
run: |
echo "Sleeping 5 minutes to wait for yum to update itself"
sleep 300
Expand Down Expand Up @@ -147,14 +157,13 @@ jobs:

- name: Build and Run NugetValidator
run: |
dotnet build --configuration Release "$BUILD_PATH"
"$RUN_PATH/NugetValidator" -v $AGENT_VERSION -c $CONFIG_PATH
dotnet publish --configuration Release --output "$PUBLISH_PATH" "$BUILD_PATH"
"$PUBLISH_PATH/NugetValidator" -v $AGENT_VERSION -c $PUBLISH_PATH/config.yml
shell: bash
env:
BUILD_PATH: ${{ github.workspace }}/build/NugetValidator/NugetValidator.csproj
RUN_PATH: ${{ github.workspace }}/build/NugetValidator/bin/Release/net7.0/
AGENT_VERSION: ${{ inputs.agent_version }}
CONFIG_PATH: ${{ github.workspace }}/build/NugetValidator/bin/Release/net7.0/config.yml
BUILD_PATH: ${{ github.workspace }}/build/NugetValidator/NugetValidator.csproj
PUBLISH_PATH: ${{ github.workspace }}/publish

report-deprecated-nuget-packages:
name: Report Deprecated NuGet Packages
Expand All @@ -176,10 +185,9 @@ jobs:

- name: Build and Run NugetDeprecator
run: |
dotnet build --configuration Release "$BUILD_PATH"
"$RUN_PATH/NugetVersionDeprecator" -c $CONFIG_PATH --github-token ${{ secrets.GITHUB_TOKEN }} --api-key ${{ secrets.NEW_RELIC_API_KEY_PRODUCTION }}
dotnet publish --configuration Release --output "$PUBLISH_PATH" "$BUILD_PATH"
"$PUBLISH_PATH/NugetVersionDeprecator" -c $PUBLISH_PATH/config.yml --github-token ${{ secrets.GITHUB_TOKEN }} --api-key ${{ secrets.NEW_RELIC_API_KEY_PRODUCTION }} --test-mode ${{ inputs.test_mode }}
shell: bash
env:
BUILD_PATH: ${{ github.workspace }}/build/NugetVersionDeprecator/NugetVersionDeprecator.csproj
RUN_PATH: ${{ github.workspace }}/build/NugetVersionDeprecator/bin/Release/net8.0/
CONFIG_PATH: ${{ github.workspace }}/build/NugetVersionDeprecator/bin/Release/net8.0/config.yml
PUBLISH_PATH: ${{ github.workspace }}/publish

0 comments on commit 743eb9a

Please sign in to comment.