Skip to content

Post Deploy for the .NET Agent #21

Post Deploy for the .NET Agent

Post Deploy for the .NET Agent #21

name: Post Deploy for the .NET Agent
on:
workflow_dispatch:
inputs:
agent_version:
description: 'Agent Version to validate. Needs to match the version from the Release Workflow (all_solutions.yml). Format: X.X.X'
required: true
type: string
external_call:
type: boolean
default: true
required: false
workflow_call:
inputs:
agent_version:
description: 'Agent Version to validate. Needs to match the version from the Release Workflow (all_solutions.yml). Format: X.X.X'
required: true
type: string
permissions:
contents: read
packages: read
env:
DOTNET_NOLOGO: true
jobs:
validate-apt-repo:
name: Validate APT-based repo
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
with:
disable-sudo: false
egress-policy: audit
- name: Wait for APT to update
if: ${{ github.event.inputs.external_call }} # only wait if this workflow was called by another workflow
run: |
echo "Sleeping 5 minutes to wait for apt to update itself"
sleep 300
shell: bash
- name: Validate
run: |
echo 'deb https://apt.newrelic.com/debian/ newrelic non-free' | sudo tee /etc/apt/sources.list.d/newrelic.list
wget -O- https://download.newrelic.com/548C16BF.gpg | sudo apt-key add -
sudo apt-get update
sudo apt-get install newrelic-dotnet-agent
installed_version=$(dpkg -s newrelic-dotnet-agent | grep -i version)
if [ "$AGENT_VERSION" = "$installed_version" ]; then
echo "Versions match."
exit 0
else
echo "ERROR: Version mismatch: Expected $AGENT_VERSION was $installed_version"
exit 1
fi
shell: bash
env:
AGENT_VERSION: "Version: ${{ github.event.inputs.agent_version }}"
validate-yum-repo:
name: Validate YUM-based repo
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
with:
disable-sudo: true
egress-policy: audit
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- name: Wait for YUM to update
if: ${{ github.event.inputs.external_call }} # only wait if this workflow was called by another workflow
run: |
echo "Sleeping 5 minutes to wait for yum to update itself"
sleep 300
shell: bash
- name: Validate
run: |
cd deploy/validation/validate-yum
# This will setup the New Relic yum repo and install the agent.
docker build -t localtesting/validateyum:latest .
docker run --name validateyum localtesting/validateyum:latest
installed_version=$(docker logs --tail 1 validateyum)
if [ "$AGENT_VERSION" = "$installed_version" ]; then
echo "Versions match."
exit 0
else
echo "ERROR: Version mismatch: Expected $AGENT_VERSION was $installed_version"
exit 1
fi
shell: bash
env:
AGENT_VERSION: "newrelic-dotnet-agent-${{ github.event.inputs.agent_version }}-1.x86_64"
validate-download-site-s3:
name: Validate S3-hosted Download Site
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
with:
disable-sudo: true
egress-policy: audit
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- name: Build and Run S3Validator
run: |
dotnet build --configuration Release "$BUILD_PATH"
"$RUN_PATH/S3Validator" -v $AGENT_VERSION -c $CONFIG_PATH
shell: bash
env:
BUILD_PATH: ${{ github.workspace }}/build/S3Validator/S3Validator.csproj
RUN_PATH: ${{ github.workspace }}/build/S3Validator/bin/Release/net7.0/
CONFIG_PATH: ${{ github.workspace }}/build/S3Validator/bin/Release/net7.0/config.yml
AGENT_VERSION: ${{ github.event.inputs.agent_version }}
validate-nuget-packages:
name: Validate NuGet Package Deployment
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
with:
disable-sudo: true
egress-policy: audit
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- name: Build and Run NugetValidator
run: |
dotnet build --configuration Release "$BUILD_PATH"
"$RUN_PATH/NugetValidator" -v $AGENT_VERSION -c $CONFIG_PATH
shell: bash
env:
BUILD_PATH: ${{ github.workspace }}/build/NugetValidator/NugetValidator.csproj
RUN_PATH: ${{ github.workspace }}/build/NugetValidator/bin/Release/net7.0/
AGENT_VERSION: ${{ github.event.inputs.agent_version }}
CONFIG_PATH: ${{ github.workspace }}/build/NugetValidator/bin/Release/net7.0/config.yml
report-deprecated-nuget-packages:
name: Report Deprecated NuGet Packages
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
with:
disable-sudo: true
egress-policy: audit
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- 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 }}
shell: bash
env:
BUILD_PATH: ${{ github.workspace }}/build/NugetVersionDeprecator/NugetVersionDeprecator.csproj
RUN_PATH: ${{ github.workspace }}/build/NugetVersionDeprecator/bin/Release/net7.0/
CONFIG_PATH: ${{ github.workspace }}/build/NugetVersionDeprecator/bin/Release/net7.0/config.yml