Skip to content

Release 2.28.1

Release 2.28.1 #2121

Workflow file for this run

name: CI
on:
push:
branches:
- 'main'
- 'release-*'
paths-ignore:
- "**.md"
- "docs/**"
- "hugo/**"
pull_request:
types:
- opened
- reopened
- synchronize
env:
GOLANGCI_LINT_VERSION: 'v1.52.2'
NFPM_VERSION: 'v2.32.0'
jobs:
lint:
name: Lint
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- name: Lint Agent Code
uses: golangci/golangci-lint-action@v3
with:
version: "${{ env.GOLANGCI_LINT_VERSION }}"
args: -c ./scripts/.golangci.yml
skip-pkg-cache: true
- name: Lint SDK Code
uses: golangci/golangci-lint-action@v3
with:
version: "${{ env.GOLANGCI_LINT_VERSION }}"
working-directory: sdk
args: -c ../scripts/.golangci.yml
skip-pkg-cache: true
unit-test:
name: Unit Tests
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- name: Run Unit Tests
run: make unit-test
- name: Upload Test Coverage
uses: codecov/codecov-action@v3
with:
files: ./build/test/coverage.out
component-test:
name: Component Tests
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- name: Run Component Tests
run: make component-test
integration-tests:
runs-on: ubuntu-22.04
name: Integration Tests
strategy:
matrix:
container:
- image: "rockylinux"
version: "8"
- image: "rockylinux"
version: "9"
- image: "almalinux"
version: "8"
- image: "almalinux"
version: "9"
- image: "amazonlinux"
version: "2"
- image: "amazonlinux"
version: "2023"
- image: "oraclelinux"
version: "7"
- image: "oraclelinux"
version: "8"
- image: "oraclelinux"
version: "9"
- image: "ubuntu"
version: "22.04"
- image: "alpine"
version: "3.14"
- image: "alpine"
version: "3.15"
- image: "alpine"
version: "3.16"
- image: "alpine"
version: "3.17"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
# Change made to fix an issue cause by security fix in Go 1.20.6 & 1.19.11 which was causing TestContainers to fail
# https://github.com/testcontainers/testcontainers-go/issues/1359
with:
go-version: '1.19.10'
- name: Run Integration Tests
run: |
go install github.com/goreleaser/nfpm/v2/cmd/nfpm@${{ env.NFPM_VERSION }}
OS_RELEASE="${{ matrix.container.image }}" OS_VERSION="${{ matrix.container.version }}" \
make integration-test
- name: Output Logs
if: failure()
run: |
docker ps -a
dockerid=$(docker ps -a --format "{{.ID}}")
docker logs "$dockerid"
- name: Archive install/uninstall integration test logs
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: integration-test-log-${{ matrix.container.image }}-${{ matrix.container.version }}
path: /tmp/nginx-agent-integration-test-install-uninstall.log
retention-days: 3
- name: Archive api integration test logs
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: integration-test-log-${{ matrix.container.image }}-${{ matrix.container.version }}
path: /tmp/nginx-agent-integration-test-api.log
retention-days: 3
- name: Archive features integration test logs
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: integration-test-log-${{ matrix.container.image }}-${{ matrix.container.version }}
path: /tmp/nginx-agent-integration-test-features.log
retention-days: 3
performance-test:
name: Performance Tests
if: ${{ !github.event.pull_request.head.repo.fork && !startsWith(github.ref_name, '*dependabot-') }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Set up Docker Build
uses: docker/setup-buildx-action@v2
- name: Build Docker Image
uses: docker/build-push-action@v3
with:
file: test/docker/Dockerfile
tags: nginx-agent-benchmark:1.0.0
context: '.'
push: false
load: true
no-cache: true
secrets: |
"nginx-crt=${{ secrets.NGINX_CRT }}"
"nginx-key=${{ secrets.NGINX_KEY }}"
- name: Run Performance Tests
run: docker run -v ${GITHUB_WORKSPACE}:/home/nginx/ --rm nginx-agent-benchmark:1.0.0
build-signed-snapshot:
name: Build signed snapshot
runs-on: ubuntu-22.04
if: ${{ !startsWith(github.ref_name, 'release-') && !startsWith(github.ref_name, '*dependabot-') && !github.event.pull_request.head.repo.fork }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- name: Setup build environment
run: |
sudo apt-get update
sudo apt-get install -y gpgv1 monkeysphere
go install github.com/goreleaser/nfpm/v2/cmd/nfpm@${{ env.NFPM_VERSION }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build Docker Image
uses: docker/build-push-action@v3
with:
file: scripts/packages/packager/Dockerfile
tags: build-signed-packager:1.0.0
context: '.'
push: false
load: true
no-cache: true
build-args: |
package_type=signed-package
- name: Build Packages
env:
INDIGO_GPG_AGENT: ${{ secrets.INDIGO_GPG_AGENT }}
NFPM_SIGNING_KEY_FILE: .key.asc
run: |
echo "$INDIGO_GPG_AGENT" | base64 --decode > .key.asc
make clean package
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: nginx-agent-snapshots
path: ./build/azure/packages/nginx-agent.tar.gz
retention-days: 3
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Azure Upload Snapshot
uses: azure/CLI@v1
with:
inlineScript: |
if ${{ github.event_name == 'pull_request'}}; then
GIT_BRANCH=${GITHUB_HEAD_REF}
else
GIT_BRANCH=${GITHUB_REF##*/}
fi
for i in ./build/azure/packages/nginx-agent*; do
az storage blob upload --auth-mode=login -f "$i" -c ${{ secrets.AZURE_CONTAINER_NAME }} \
--account-name ${{ secrets.AZURE_ACCOUNT_NAME }} --overwrite -n nginx-agent/${GIT_BRANCH}/${i##*/}
done
build-unsigned-snapshot:
name: Build unsigned snapshot
runs-on: ubuntu-22.04
if: ${{ startsWith(github.ref_name, '*dependabot-') || github.event.pull_request.head.repo.fork }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- name: Setup build environment
run: |
go install github.com/goreleaser/nfpm/v2/cmd/nfpm@${{ env.NFPM_VERSION }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build Docker Image
uses: docker/build-push-action@v3
with:
file: scripts/packages/packager/Dockerfile
tags: build-local-packager:1.0.0
context: '.'
push: false
load: true
no-cache: true
build-args: |
package_type=local-package
- name: Build Packages
run: |
make clean local-deb-package local-rpm-package local-txz-package local-apk-package
tar -cf ./build/nginx-agent-snapshots.tar.gz ./build/*.deb ./build/*.rpm ./build/*.pkg ./build/*.apk
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: nginx-agent-snapshots
path: ./build/nginx-agent-snapshots.tar.gz
retention-days: 3
build-example:
name: Build Grafana Dashboard Example
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- name: Setup build environment
run: |
go install github.com/goreleaser/nfpm/v2/cmd/nfpm@${{ env.NFPM_VERSION }}
- name: Build Grafana example
run: make build-grafana-example
- name: Clean Grafana example
run: make clean-grafana-example
trigger-release-workflow:
if: ${{ startsWith(github.ref_name, 'release-') && !github.event.pull_request.head.repo.fork }}
needs: [ lint, unit-test, component-test, performance-test, integration-tests ]
uses: ./.github/workflows/release-branch.yml
secrets: inherit