Skip to content

Commit

Permalink
refactor dotnet to use test.yml, tweak test.yml to take an extra para…
Browse files Browse the repository at this point in the history
…meter
  • Loading branch information
tippmar-nr committed Jun 7, 2024
1 parent 861f8e7 commit 4a01fe7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 63 deletions.
69 changes: 6 additions & 63 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,72 +60,15 @@ jobs:
agent-language: dotnet

test:
name: Run Dotnet init container tests
runs-on: ubuntu-latest
uses: ./.github/workflows/test.yml
needs: check-modified-files
# run only if files were modified or the workflow was manually invoked or on a publish
if: needs.check-modified-files.outputs.files-changed == 'true' || github.event_name == 'workflow_dispatch' || (github.event_name == 'release' && endsWith(github.ref_name, '_dotnet'))

steps:
# For some reason, Harden Runner causes setup-minikube to not work correctly
# - name: Harden Runner
# uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1
# with:
# #disable-sudo: true
# egress-policy: audit

- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 4.1.1
with:
persist-credentials: false
fetch-depth: 0

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # 3.3.0

- name: Start minikube
uses: medyagh/setup-minikube@317d92317e473a10540357f1f4b2878b80ee7b95 # 0.0.16

- name: Deploy cert-manager to minikube
run: |
helm repo add jetstack https://charts.jetstack.io --force-update
helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --version v1.14.5 --set installCRDs=true
echo "waiting for cert-manager pods to be ready..."
sleep 5
kubectl wait --for=condition=Ready -n cert-manager --all pods --timeout=60s
- name: Deploy New Relic k8s-agents-operator to minikube
run: |
helm repo add k8s-agents-operator https://newrelic.github.io/k8s-agents-operator
helm upgrade --install k8s-agents-operator k8s-agents-operator/k8s-agents-operator \
--namespace=default \
--set=licenseKey=${{ secrets.NEW_RELIC_LICENSE_KEY }} \
--set=controllerManager.manager.image.tag=${{ env.K8S_OPERATOR_IMAGE_TAG }}
sleep 5
kubectl wait --for=condition=Ready -n default --all pods --timeout=60s
- name: Build init container for e2e test
run: |
minikube image build -t e2e/newrelic-dotnet-init:e2e src/dotnet/ \
--build-opt=build-arg=TARGETARCH=${{ env.DOTNET_AGENT_ARCHITECTURE }}
- name: Build test app container
run: |
minikube image build -t e2e/test-app-dotnet:e2e tests/dotnet/
- name: Run e2e-test
uses: newrelic/newrelic-integration-e2e-action@a97ced80a4841c8c6261d1f9dca6706b1d89acb1 # 1.11.0
with:
retry_seconds: 60
retry_attempts: 5
agent_enabled: false
spec_path: tests/dotnet/test-specs.yml
account_id: ${{ secrets.NEW_RELIC_ACCOUNT_ID }}
api_key: ${{ secrets.NEW_RELIC_API_KEY }}
license_key: ${{ secrets.NEW_RELIC_LICENSE_KEY }}
# set the region to Staging if using a staging license key. Also set NEW_RELIC_HOST in tests/chart/templates/deployment.yaml
#region: Staging
secrets: inherit
with:
INITCONTAINER_LANGUAGE: dotnet
K8S_OPERATOR_IMAGE_TAG: edge
TEST_APP_BUILD_ARGS: --build-opt=build-arg=TARGETARCH=amd64

publish:
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ on:
RUNTIME_VERSION:
required: false
type: string
TEST_APP_BUILD_ARGS:
required: false
type: string

jobs:
check-license-key:
Expand Down Expand Up @@ -80,6 +83,7 @@ jobs:
- name: Build test app container
run: |
minikube image build -t e2e/test-app-${{ inputs.INITCONTAINER_LANGUAGE }}:e2e tests/${{ inputs.INITCONTAINER_LANGUAGE }}/
${{ inputs.TEST_APP_BUILD_ARGS}}
- name: Run e2e-test
uses: newrelic/newrelic-integration-e2e-action@a97ced80a4841c8c6261d1f9dca6706b1d89acb1 # 1.11.0
Expand Down

0 comments on commit 4a01fe7

Please sign in to comment.