From dc06cb221db88507ebe04b68378383fe9e6e5ec8 Mon Sep 17 00:00:00 2001 From: Tim Pansino Date: Fri, 10 May 2024 17:03:23 -0700 Subject: [PATCH] Rename things using global variable --- .github/workflows/python.yml | 27 +++++++++---------- tests/python/test-specs.yml | 6 ++--- ...ployment.yaml => test_app_deployment.yaml} | 14 +++++----- 3 files changed, 23 insertions(+), 24 deletions(-) rename tests/python/{python_test_app_deployment.yaml => test_app_deployment.yaml} (72%) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 9e45117..540c6d2 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -30,8 +30,7 @@ on: - published env: - CONTAINER_REGISTRY: docker.io - IMAGE_NAME_SUFFIX: python + INITCONTAINER_LANGUAGE: ${{ env.INITCONTAINER_LANGUAGE }} jobs: test: @@ -66,25 +65,25 @@ jobs: - name: Build init container run: | - docker build -t ${{ env.E2E_IMAGE_NAME }}:e2e python/ - minikube image load ${{ env.E2E_IMAGE_NAME }}:e2e + docker build -t e2e/initcontainer-${{ env.INITCONTAINER_LANGUAGE }}:e2e ${{ env.INITCONTAINER_LANGUAGE }}/ + minikube image load e2e/initcontainer-${{ env.INITCONTAINER_LANGUAGE }}:e2e - name: Build test app container run: | - docker build -t e2e/python-test-app:e2e tests/python/ - minikube image load e2e/python-test-app:e2e + docker build -t e2e/test-app-${{ env.INITCONTAINER_LANGUAGE }}:e2e tests/${{ env.INITCONTAINER_LANGUAGE }}/ + minikube image load e2e/test-app-${{ env.INITCONTAINER_LANGUAGE }}:e2e - name: Deploy test app to minikube run: | - kubectl create namespace python-test - kubectl apply -f tests/python/customresource.yaml -n python-test - kubectl apply -f tests/python/python_test_app_deployment.yaml -n python-test + kubectl create namespace test-${{ env.INITCONTAINER_LANGUAGE }} + kubectl apply -f tests/${{ env.INITCONTAINER_LANGUAGE }}/customresource.yaml -n test-${{ env.INITCONTAINER_LANGUAGE }} + kubectl apply -f tests/${{ env.INITCONTAINER_LANGUAGE }}/test_app_deployment.yaml -n test-${{ env.INITCONTAINER_LANGUAGE }} sleep 5 - kubectl wait --for=condition=Ready --namespace python-test --all pods + kubectl wait --for=condition=Ready --namespace test-${{ env.INITCONTAINER_LANGUAGE }} --all pods - name: Test run: | - curl --fail-with-body $(minikube service python-test-app-service --url -n python-test) + curl --fail-with-body $(minikube service test-${{ env.INITCONTAINER_LANGUAGE }}-app-service --url -n test-${{ env.INITCONTAINER_LANGUAGE }}) # - name: Run e2e-test # uses: newrelic/newrelic-integration-e2e-action@a97ced80a4841c8c6261d1f9dca6706b1d89acb1 # 1.11.0 @@ -92,7 +91,7 @@ jobs: # retry_seconds: 60 # retry_attempts: 5 # agent_enabled: false - # spec_path: tests/python/test-specs.yml + # spec_path: tests/${{ env.INITCONTAINER_LANGUAGE }}/test-specs.yml # account_id: ${{ secrets.K8S_AGENTS_E2E_ACCOUNT_ID }} # api_key: ${{ secrets.K8S_AGENTS_E2E_API_KEY }} # license_key: ${{ secrets.K8S_AGENTS_E2E_LICENSE_KEY }} @@ -118,7 +117,7 @@ jobs: id: meta uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # 5.5.1 with: - images: docker.io/${{ github.repository }}-${{ env.IMAGE_NAME_SUFFIX }} + images: ${{ github.repository }}-${{ env.INITCONTAINER_LANGUAGE }} tags: | flavor: | prefix= @@ -141,7 +140,7 @@ jobs: uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # 5.3.0 with: push: true - context: python/ + context: ${{ env.INITCONTAINER_LANGUAGE }}/ platforms: linux/amd64,linux/arm64,linux/arm tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/tests/python/test-specs.yml b/tests/python/test-specs.yml index 2920c42..bab48ff 100644 --- a/tests/python/test-specs.yml +++ b/tests/python/test-specs.yml @@ -7,13 +7,13 @@ scenarios: before: - kubectl create namespace nr-${SCENARIO_TAG} - kubectl apply -f ./customresource.yaml -n nr-${SCENARIO_TAG} - - kubectl apply -f ./python_test_app_deployment.yaml -n nr-${SCENARIO_TAG} + - kubectl apply -f ./test_app_deployment.yaml -n nr-${SCENARIO_TAG} - sleep 10 - kubectl wait --for=condition=Ready --namespace nr-${SCENARIO_TAG} --all pods - - curl --fail-with-body $(minikube service python-test-app-service --url -n nr-${SCENARIO_TAG}) + - curl --fail-with-body $(minikube service test-app-python-service --url -n nr-${SCENARIO_TAG}) after: - kubectl delete -f ./customresource.yaml -n nr-${SCENARIO_TAG} - - kubectl delete -f ./python_test_app_deployment.yaml -n nr-${SCENARIO_TAG} + - kubectl delete -f ./test_app_deployment.yaml -n nr-${SCENARIO_TAG} tests: nrqls: - query: FROM Metric SELECT latest(something) AS 'start_time' WHERE metricName = 'k8s.persistentvolume.createdAt' AND appName = 'k8s-e2e-test-app-${SCENARIO_TAG:-0}' diff --git a/tests/python/python_test_app_deployment.yaml b/tests/python/test_app_deployment.yaml similarity index 72% rename from tests/python/python_test_app_deployment.yaml rename to tests/python/test_app_deployment.yaml index 01355ab..c465c01 100644 --- a/tests/python/python_test_app_deployment.yaml +++ b/tests/python/test_app_deployment.yaml @@ -2,22 +2,22 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: python-test-app + name: test-app-python spec: selector: matchLabels: - app: python-test-app + app: test-app-python replicas: 1 template: metadata: labels: - app: python-test-app + app: test-app-python annotations: instrumentation.newrelic.com/inject-python: "true" spec: containers: - - name: python-test-app - image: e2e/python-test-app:e2e + - name: test-app-python + image: e2e/test-app-python:e2e imagePullPolicy: Never ports: - containerPort: 8000 @@ -28,11 +28,11 @@ spec: apiVersion: v1 kind: Service metadata: - name: python-test-app-service + name: test-app-python-service spec: type: NodePort ports: - port: 8000 targetPort: 8000 selector: - app: python-test-app + app: test-app-python