Skip to content

Commit b3feed2

Browse files
authored
Merge branch 'main' into docs/prom-grafana
2 parents d761d17 + 799ea76 commit b3feed2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+3310
-928
lines changed

.github/workflows/build.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
ref: ${{ inputs.tag != '' && format('refs/tags/v{0}', inputs.tag) || github.ref }}
4141

4242
- name: Fetch Cached Artifacts
43-
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
43+
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1
4444
with:
4545
path: ${{ github.workspace }}/dist
4646
key: nginx-gateway-fabric-${{ github.run_id }}-${{ github.run_number }}
@@ -151,7 +151,7 @@ jobs:
151151
fail-build: false
152152

153153
- name: Upload scan result to GitHub Security tab
154-
uses: github/codeql-action/upload-sarif@47b3d888fe66b639e431abf22ebca059152f1eea # v3.24.5
154+
uses: github/codeql-action/upload-sarif@8a470fddafa5cbb6266ee11b37ef4d8aae19c571 # v3.24.6
155155
continue-on-error: true
156156
with:
157157
sarif_file: ${{ steps.scan.outputs.sarif }}

.github/workflows/ci.yml

+12-5
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,15 @@ jobs:
9090
- name: Setup Node.js Environment
9191
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
9292
with:
93-
node-version: 18
94-
- run: npm --prefix ${{ github.workspace }}/internal/mode/static/nginx/modules install-ci-test
93+
node-version-file: .nvmrc
94+
95+
- name: Run tests
96+
run: npm --prefix ${{ github.workspace }}/internal/mode/static/nginx/modules install-ci-test
97+
98+
- name: Upload coverage reports to Codecov
99+
uses: codecov/codecov-action@54bcd8715eee62d40e33596ef5e8f0f48dbbccab # v4.1.0
100+
with:
101+
token: ${{ secrets.CODECOV_TOKEN }}
95102

96103
binary:
97104
name: Build Binary
@@ -125,7 +132,7 @@ jobs:
125132
if: ${{ github.event_name == 'push' && github.ref != 'refs/heads/main' }}
126133

127134
- name: Download Syft
128-
uses: anchore/sbom-action/download-syft@b6a39da80722a2cb0ef5d197531764a89b5d48c3 # v0.15.8
135+
uses: anchore/sbom-action/download-syft@9fece9e20048ca9590af301449208b2b8861333b # v0.15.9
129136
if: github.ref_type == 'tag'
130137

131138
- name: Install Cosign
@@ -146,7 +153,7 @@ jobs:
146153
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_COMMUNITY }}
147154

148155
- name: Cache Artifacts
149-
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
156+
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1
150157
with:
151158
path: ${{ github.workspace }}/dist
152159
key: nginx-gateway-fabric-${{ github.run_id }}-${{ github.run_number }}
@@ -160,7 +167,7 @@ jobs:
160167
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
161168

162169
- name: Fetch Cached Artifacts
163-
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
170+
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1
164171
with:
165172
path: ${{ github.workspace }}/dist
166173
key: nginx-gateway-fabric-${{ github.run_id }}-${{ github.run_number }}

.github/workflows/codeql-analysis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444

4545
# Initializes the CodeQL tools for scanning.
4646
- name: Initialize CodeQL
47-
uses: github/codeql-action/init@47b3d888fe66b639e431abf22ebca059152f1eea # v3.24.5
47+
uses: github/codeql-action/init@8a470fddafa5cbb6266ee11b37ef4d8aae19c571 # v3.24.6
4848
with:
4949
languages: ${{ matrix.language }}
5050
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -63,7 +63,7 @@ jobs:
6363
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
6464
# If this step fails, then you should remove it and run the build manually (see below)
6565
- name: Autobuild
66-
uses: github/codeql-action/autobuild@47b3d888fe66b639e431abf22ebca059152f1eea # v3.24.5
66+
uses: github/codeql-action/autobuild@8a470fddafa5cbb6266ee11b37ef4d8aae19c571 # v3.24.6
6767

6868
# ℹ️ Command-line programs to run using the OS shell.
6969
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -76,6 +76,6 @@ jobs:
7676
# ./location_of_script_within_repo/buildscript.sh
7777

7878
- name: Perform CodeQL Analysis
79-
uses: github/codeql-action/analyze@47b3d888fe66b639e431abf22ebca059152f1eea # v3.24.5
79+
uses: github/codeql-action/analyze@8a470fddafa5cbb6266ee11b37ef4d8aae19c571 # v3.24.6
8080
with:
8181
category: "/language:${{matrix.language}}"

.github/workflows/lint.yml

+9
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
- main
77
pull_request:
88

9+
defaults:
10+
run:
11+
shell: bash
12+
913
concurrency:
1014
group: ${{ github.ref_name }}-lint
1115
cancel-in-progress: true
@@ -43,6 +47,11 @@ jobs:
4347
run: |
4448
echo "version=$(jq -r .devDependencies.prettier ${{ github.workspace }}/internal/mode/static/nginx/modules/package.json)" >> $GITHUB_OUTPUT
4549
50+
- name: Setup Node.js Environment
51+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
52+
with:
53+
node-version-file: .nvmrc
54+
4655
- name: Run Prettier on NJS code
4756
id: prettier-run
4857
uses: rutajdash/prettier-cli-action@d42c4325a3b344f3bd4be482bc34de521998d557 # v1.0.2

.github/workflows/nfr.yml

+179
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
name: Non Functional Testing
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
test_label:
7+
description: NFR test to run. Choose between performance, upgrade, or all
8+
required: true
9+
default: all
10+
type: choice
11+
options: [performance, upgrade, all]
12+
version:
13+
description: Version of NGF under test
14+
required: true
15+
default: edge
16+
image_tag:
17+
description: Tag of the NGF and NGINX Docker images
18+
required: true
19+
default: edge
20+
nginx_plus:
21+
description: Run tests with NGINX Plus
22+
required: false
23+
default: false
24+
type: boolean
25+
26+
defaults:
27+
run:
28+
shell: bash
29+
30+
concurrency:
31+
group: ${{ github.ref_name }}-nfr
32+
cancel-in-progress: true
33+
34+
permissions:
35+
contents: read
36+
37+
jobs:
38+
setup-and-run-tests:
39+
name: Setup and Run NFR Tests
40+
runs-on: ubuntu-22.04
41+
permissions:
42+
contents: write # needed for opening PR with the results files
43+
pull-requests: write # needed for opening PR with the results files
44+
id-token: write # needed for authenticating to GCP
45+
46+
steps:
47+
- name: Checkout Repository
48+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
49+
50+
- name: Setup Golang Environment
51+
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
52+
with:
53+
go-version: stable
54+
55+
- name: Set GOPATH
56+
run: echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
57+
58+
- name: Docker Buildx
59+
if: ${{ inputs.nginx_plus == true }}
60+
uses: docker/setup-buildx-action@0d103c3126aa41d772a8362f6aa67afac040f80c # v3.1.0
61+
62+
- name: NGINX Docker meta
63+
id: nginx-meta
64+
if: ${{ inputs.nginx_plus == true }}
65+
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
66+
with:
67+
images: |
68+
name=gcr.io/${{ secrets.GCP_PROJECT_ID }}/ngf-nfr/nginx-gateway-fabric/nginx-plus
69+
tags: |
70+
type=raw,value=${{ inputs.image_tag }}
71+
72+
- name: Authenticate to Google Cloud
73+
id: auth
74+
uses: google-github-actions/auth@55bd3a7c6e2ae7cf1877fd1ccb9d54c0503c457c # v2.1.2
75+
with:
76+
token_format: access_token
77+
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY }}
78+
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
79+
80+
- name: Set up Cloud SDK
81+
uses: google-github-actions/setup-gcloud@98ddc00a17442e89a24bbf282954a3b65ce6d200 # v2.1.0
82+
with:
83+
project_id: ${{ secrets.GCP_PROJECT_ID }}
84+
install_components: kubectl
85+
86+
- name: Login to GCR
87+
if: ${{ inputs.nginx_plus == true }}
88+
run: gcloud auth configure-docker gcr.io -q
89+
90+
- name: Build NGINX Plus Docker Image
91+
if: ${{ inputs.nginx_plus == true }}
92+
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0
93+
with:
94+
file: build/Dockerfile.nginxplus
95+
tags: ${{ steps.nginx-meta.outputs.tags }}
96+
context: "."
97+
platforms: linux/amd64
98+
provenance: false
99+
pull: true
100+
push: true
101+
build-args: |
102+
NJS_DIR=internal/mode/static/nginx/modules/src
103+
NGINX_CONF_DIR=internal/mode/static/nginx/conf
104+
BUILD_AGENT=gha
105+
secrets: |
106+
${{ format('"nginx-repo.crt={0}"', secrets.NGINX_CRT) }}
107+
${{ format('"nginx-repo.key={0}"', secrets.NGINX_KEY) }}
108+
109+
- name: Setup dotenv file
110+
working-directory: ./tests/scripts
111+
run: |
112+
echo "RESOURCE_NAME=nfr-tests-${{ github.run_id }}" >> vars.env
113+
echo "TAG=${{ inputs.image_tag }}" >> vars.env
114+
echo "PREFIX=ghcr.io/nginxinc/nginx-gateway-fabric" >> vars.env
115+
echo "NGINX_PREFIX=ghcr.io/nginxinc/nginx-gateway-fabric/nginx" >> vars.env
116+
echo "NGINX_PLUS_PREFIX=gcr.io/${{ secrets.GCP_PROJECT_ID }}/ngf-nfr/nginx-gateway-fabric/nginx-plus" >> vars.env
117+
echo "GKE_CLUSTER_NAME=nfr-tests-${{ github.run_id }}" >> vars.env
118+
echo "GKE_CLUSTER_ZONE=us-east1-b" >> vars.env
119+
echo "GKE_CLUSTER_REGION=us-east1" >> vars.env
120+
echo "GKE_PROJECT=${{ secrets.GCP_PROJECT_ID }}" >> vars.env
121+
echo "GKE_SVC_ACCOUNT=${{ secrets.GCP_SERVICE_ACCOUNT }}" >> vars.env
122+
echo "GKE_NODES_SERVICE_ACCOUNT=${{ secrets.GKE_NODES_SERVICE_ACCOUNT }}" >> vars.env
123+
echo "IMAGE=projects/debian-cloud/global/images/debian-11-bullseye-v20240213" >> vars.env
124+
echo "NETWORK_TAGS=nfr-tests-${{ github.run_id }}" >> vars.env
125+
echo "NGF_REPO=nginxinc" >> vars.env
126+
echo "NGF_BRANCH=${{ github.ref_name }}" >> vars.env
127+
echo "SOURCE_IP_RANGE=$(curl -sS -4 icanhazip.com)/32" >> vars.env
128+
echo "ADD_VM_IP_AUTH_NETWORKS=true" >> vars.env
129+
echo "PLUS_ENABLED=${{ inputs.nginx_plus }}" >> vars.env
130+
echo "GINKGO_LABEL=" >> vars.env
131+
echo "NGF_VERSION=${{ inputs.version }}" >> vars.env
132+
133+
- name: Create GKE cluster
134+
working-directory: ./tests
135+
run:
136+
make create-gke-cluster CI=true
137+
138+
- name: Create and setup VM
139+
working-directory: ./tests
140+
run:
141+
make create-and-setup-vm
142+
143+
- name: Run Tests
144+
working-directory: ./tests
145+
run: |
146+
if ${{ inputs.test_label != 'all' }}; then
147+
sed -i '/^GINKGO_LABEL=/s/=.*/="${{ inputs.test_label }}"/' "scripts/vars.env" && make run-tests-on-vm;
148+
else
149+
make run-tests-on-vm;
150+
fi
151+
152+
- name: Cleanup
153+
working-directory: ./tests
154+
if: always()
155+
run: |
156+
bash scripts/cleanup-vm.sh true
157+
make delete-gke-cluster
158+
rm -rf scripts/vars.env
159+
160+
- name: Open a PR with the results
161+
uses: peter-evans/create-pull-request@a4f52f8033a6168103c2538976c07b467e8163bc # v6.0.1
162+
with:
163+
commit-message: NFR Test Results for NGF version ${{ inputs.version }}
164+
author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>
165+
branch: tests/nfr-tests-${{ inputs.version }}
166+
delete-branch: true
167+
title: NFR Test Results for NGF version ${{ inputs.version }}
168+
add-paths: |
169+
tests/results/
170+
body: |
171+
Update with NFR test results for NGF version ${{ inputs.version }}
172+
- Auto-generated by the NFR tests workflow run ${{ github.run_id }}
173+
- Tests ran using Docker image tag ${{ inputs.image_tag }}
174+
- ${{ inputs.test_label }} test(s) ran
175+
- NGINX Plus enabled: ${{ inputs.nginx_plus }}
176+
labels: |
177+
tests
178+
assignees: ${{ github.actor }}
179+
draft: true

.github/workflows/scorecards.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,6 @@ jobs:
6060

6161
# Upload the results to GitHub's code scanning dashboard.
6262
- name: "Upload to code-scanning"
63-
uses: github/codeql-action/upload-sarif@47b3d888fe66b639e431abf22ebca059152f1eea # v3.24.5
63+
uses: github/codeql-action/upload-sarif@8a470fddafa5cbb6266ee11b37ef4d8aae19c571 # v3.24.6
6464
with:
6565
sarif_file: results.sarif

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,6 @@ internal/mode/static/nginx/modules/coverage
4848

4949
# Dotenv files
5050
**/*.env
51+
52+
# Credential files
53+
**/gha-creds-*.json

.goreleaser.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ builds:
1515
asmflags:
1616
- all=-trimpath={{.Env.GOPATH}}
1717
ldflags:
18-
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.telemetryReportPeriod=24h
18+
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.telemetryReportPeriod=24h -X main.telemetryEndpointInsecure=false
1919
main: ./cmd/gateway/
2020
binary: gateway
2121

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ repos:
55
rev: v4.5.0
66
hooks:
77
- id: trailing-whitespace
8-
exclude: (^tests/results/)
8+
exclude: (^tests/results/|\.avdl$|_generated.go$)
99
- id: end-of-file-fixer
1010
- id: check-yaml
1111
args: [--allow-multiple-documents]

0 commit comments

Comments
 (0)