-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add APT and Yum validation with new workflow
- Loading branch information
Showing
3 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
name: Post Deploy for the .NET Agent | ||
|
||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
agent_version: | ||
description: 'Agent Version to deploy. Needs to match the version from the Release Workflow (all_solutions.yml). Format: X.X.X' | ||
required: true | ||
type: string | ||
|
||
workflow_call: | ||
inputs: | ||
agent_version: | ||
description: 'Agent Version to deploy. 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@cba0d00b1fc9a034e1e642ea0f1103c282990604 # v2.5.0 | ||
with: | ||
disable-sudo: true | ||
egress-policy: audit | ||
|
||
- name: Validate | ||
run: | | ||
echo 'deb https://apt.newrelic.com/debian/ newrelic non-free' | tee /etc/apt/sources.list.d/newrelic.list | ||
wget -O- https://download.newrelic.com/548C16BF.gpg | apt-key add - | ||
apt-get update | ||
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@cba0d00b1fc9a034e1e642ea0f1103c282990604 # v2.5.0 | ||
with: | ||
disable-sudo: true | ||
egress-policy: audit | ||
|
||
- name: Checkout | ||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- 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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM rockylinux:9 | ||
|
||
RUN yum install wget -y \ | ||
&& wget https://download.newrelic.com/548C16BF.gpg -O /etc/pki/rpm-gpg/RPM-GPG-KEY-NewRelic \ | ||
&& rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-NewRelic | ||
|
||
COPY --chmod=777 check-version.sh /tmp/ | ||
|
||
ENTRYPOINT ["/tmp/check-version.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
cat << REPO | tee "/etc/yum.repos.d/newrelic-dotnet-agent.repo" | ||
[newrelic-dotnet-agent-repo] | ||
name=New Relic .NET Core packages for Enterprise Linux | ||
baseurl=https://yum.newrelic.com/pub/newrelic/el7/\$basearch | ||
enabled=1 | ||
gpgcheck=1 | ||
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-NewRelic | ||
REPO | ||
|
||
yum install newrelic-dotnet-agent -y | ||
|
||
rpm -q newrelic-dotnet-agent |