Skip to content

chore(deps): update alpine docker tag to v3.21.2 #3178

chore(deps): update alpine docker tag to v3.21.2

chore(deps): update alpine docker tag to v3.21.2 #3178

Workflow file for this run

name: CI
on:
pull_request:
push:
branches:
- main
- renovate/**
jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
goos: [ linux ]
goarch: [ amd64, arm64, arm ]
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Build binary
run: make build
- name: Build Docker image
if: matrix.goos == 'linux' && matrix.goarch == 'amd64'
run: make image
- name: Run CI checks
if: matrix.goos == 'linux' && matrix.goarch == 'amd64'
run: make ci
chart-lint:
name: Helm chart Lint
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
kubernetes-version: ["v1.31.0", "v1.30.0", "v1.29.5", "v1.28.3", "v1.27.5"]
cri: [ containerd ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: azure/setup-kubectl@v4
with:
version: v1.31.0
- uses: azure/setup-helm@v4
with:
version: v3.10.0
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- uses: helm/[email protected]
- name: Add newrelic repository
run: helm repo add newrelic https://helm-charts.newrelic.com
- name: Lint charts
run: ct --config .github/ct.yaml lint --debug
- name: Check for changed installable charts
id: list-changed
run: |
changed=$(ct --config .github/ct.yaml list-changed)
if [[ -n "$changed" ]]; then
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Run helm unit tests
if: steps.list-changed.outputs.changed == 'true'
run: |
helm plugin install https://github.com/helm-unittest/helm-unittest
for chart in $(ct --config .github/ct.yaml list-changed); do
if [ -d "$chart/tests/" ]; then
helm unittest $chart
else
echo "No unit tests found for $chart"
fi
done
- name: Setup Minikube
uses: manusa/[email protected]
if: steps.list-changed.outputs.changed == 'true'
with:
minikube version: v1.34.0
kubernetes version: ${{ matrix.kubernetes-version }}
driver: docker
github token: ${{ secrets.GITHUB_TOKEN }}
start args: "--container-runtime=${{ matrix.cri }}"
- uses: actions/setup-go@v5
if: steps.list-changed.outputs.changed == 'true'
with:
go-version-file: 'go.mod'
- name: Create image for chart testing
if: steps.list-changed.outputs.changed == 'true'
run: |
GOOS=linux GOARCH=amd64 make build # Set GOOS and GOARCH explicitly since Dockerfile expects them in the binary name
DOCKER_BUILDKIT=1 docker build -t e2e/newrelic-metrics-adapter:test .
minikube image load e2e/newrelic-metrics-adapter:test
kubectl create ns ct
- name: Test install charts
if: steps.list-changed.outputs.changed == 'true'
run: ct install --namespace ct --config .github/ct.yaml --debug
- name: Test upgrade charts
if: steps.list-changed.outputs.changed == 'true'
run: ct install --namespace ct --config .github/ct.yaml --debug --upgrade
integration:
name: Integration and E2E tests
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
k8sVersion: ["v1.31.0", "v1.30.0", "v1.29.5", "v1.28.3", "v1.27.5"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Kind action
uses: helm/[email protected]
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@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.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.repository=localhost:5000/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
static-analysis:
name: Static analysis and linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- uses: newrelic/newrelic-infra-checkers@v1
with:
golangci-lint-config: golangci-lint
# - name: Semgrep
# uses: returntocorp/semgrep-action@v1
# with:
# auditOn: push
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
continue-on-error: ${{ github.event_name != 'pull_request' }}
with:
only-new-issues: true
skip-pkg-cache: true
skip-build-cache: true
codespell:
name: Codespell
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Codespell test
uses: codespell-project/actions-codespell@master
with:
check_filenames: true
check_hidden: true
ignore_words_list: te,enver,NotIn,Bu
skip: ./.git,./internal/generated