Skip to content

Commit

Permalink
Rename things using global variable
Browse files Browse the repository at this point in the history
  • Loading branch information
TimPansino committed May 11, 2024
1 parent 7605d12 commit dc06cb2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 24 deletions.
27 changes: 13 additions & 14 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ on:
- published

env:
CONTAINER_REGISTRY: docker.io
IMAGE_NAME_SUFFIX: python
INITCONTAINER_LANGUAGE: ${{ env.INITCONTAINER_LANGUAGE }}

jobs:
test:
Expand Down Expand Up @@ -66,33 +65,33 @@ 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
# with:
# 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 }}
Expand All @@ -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=
Expand All @@ -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 }}
6 changes: 3 additions & 3 deletions tests/python/test-specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit dc06cb2

Please sign in to comment.