Skip to content

fix(deps): update k8s.io/utils digest to b8788ab #187

fix(deps): update k8s.io/utils digest to b8788ab

fix(deps): update k8s.io/utils digest to b8788ab #187

name: Integration and E2E over minikube
on:
pull_request_target:
permissions:
contents: read
jobs:
integration-e2e-test-external:
name: Run Integration and E2E tests (External Contribution)
# Do not run e2e tests if PR is from a non-forked repo (internal contribution)
if: ${{ github.event.pull_request.head.repo.full_name != 'newrelic/newrelic-k8s-metrics-adapter' }}
runs-on: ubuntu-latest
environment: E2E # Required so that approval is required to run this job since it is untrusted (forked).
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
k8sVersion: ["v1.34.0", "v1.33.0", "v1.32.0", "v1.31.0", "v1.30.0"]
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- name: Kind action
uses: helm/kind-action@v1.14.0
with:
kubectl_version: ${{ matrix.k8sVersion }}
- name: Create k8s Kind Cluster
run: make kind-up
- name: Run unit tests
run: make test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Run integration tests
env:
NEWRELIC_API_KEY: "${{ secrets.K8S_AGENTS_E2E_API_KEY }}"
NEWRELIC_ACCOUNT_ID: "${{ secrets.K8S_AGENTS_E2E_ACCOUNT_ID }}"
run: make test-integration
- name: Build Docker image
run: make image-push IMAGE_REPO=localhost:5000/newrelic-k8s-metrics-adapter
- name: Add newrelic repository
run: helm repo add newrelic https://helm-charts.newrelic.com
- name: Create Helm release
env:
KUBECONFIG: ./kubeconfig # Generated by `make kind-up`
NEWRELIC_API_KEY: "${{ secrets.K8S_AGENTS_E2E_API_KEY }}"
NEWRELIC_ACCOUNT_ID: "${{ secrets.K8S_AGENTS_E2E_ACCOUNT_ID }}"
run: |
make generate-local-values
helm dependency build ./charts/newrelic-k8s-metrics-adapter
helm install newrelic-k8s-metrics-adapter ./charts/newrelic-k8s-metrics-adapter \
--set image.registry=localhost:5000 \
--set image.repository=newrelic-k8s-metrics-adapter \
--set image.pullPolicy=IfNotPresent \
--values values-dev.yaml --values values-local.yaml \
--wait --timeout 240s
- name: Confirm external.metrics.k8s.io API implementation details
env:
ENDPOINT: '/apis/external.metrics.k8s.io/v1beta1/namespaces/*/e2e/'
KUBECONFIG: ./kubeconfig # Generated by `make kind-up`
run: |
sleep 30
KIND=$(kubectl get --raw "${ENDPOINT}" | jq '.kind')
API_VERSION=$(kubectl get --raw "${ENDPOINT}" | jq '.apiVersion')
METRIC_NAME=$(kubectl get --raw "${ENDPOINT}" | jq '.items[0].metricName')
VALUE=$(kubectl get --raw "${ENDPOINT}" | jq '.items[0].value')
if [[ ${KIND} != '"ExternalMetricValueList"' ]]; then
echo "KIND: found '${KIND}' != expected '\"ExternalMetricValueList\"'"
exit 1
fi
if [[ ${API_VERSION} != '"external.metrics.k8s.io/v1beta1"' ]]; then
echo "API_VERSION: found '${API_VERSION}' != expected '\"external.metrics.k8s.io/v1beta1\"'"
exit 1
fi
if [[ ${METRIC_NAME} != '"e2e"' ]]; then
echo "METRIC_NAME: found '${METRIC_NAME}' != expected '\"e2e\"'"
exit 1
fi
if [[ ${VALUE} != '"123m"' ]]; then
echo "VALUE: found '${VALUE}' != expected '\"123m\"'"
exit 1
fi
- name: Run E2E tests
run: make test-e2e