Skip to content

Commit 28948e3

Browse files
authored
Merge branch 'nginx:main' into bgv/nim-nap-otel-log-parser
2 parents d69ca18 + 3bee777 commit 28948e3

Some content is hidden

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

52 files changed

+1593
-985
lines changed

.codecov.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Codecov configuration file
2+
# This file configures code coverage reporting and requirements for the project
3+
coverage:
4+
5+
# Coverage status configuration
6+
status:
7+
8+
# Project-level coverage settings
9+
project:
10+
11+
# Default status check configuration
12+
default:
13+
14+
# The minimum required coverage value for the project
15+
target: 80%
16+
17+
# The allowed coverage decrease before failing the status check
18+
threshold: 0%
19+
20+
# Whether to run coverage checks only on pull requests
21+
only_pulls: false
22+
23+
# Patch-level coverage settings
24+
patch:
25+
26+
default:
27+
28+
target: 80%
29+
threshold: 0%
30+
only_pulls: false
31+
32+
comment:
33+
layout: "header,diff,files,footer"
34+
behavior: default
35+
require_changes: false
36+
require_base: false
37+
require_head: true
38+
39+
40+
# Ignore files or packages matching their paths
41+
ignore:
42+
- '\.pb\.go$' # Excludes all protobuf generated files
43+
- '\.gen\.go' # Excludes generated files
44+
- '^fake_.*\.go' # Excludes fakes
45+
- '^test/.*$'
46+
- 'app.go' # app.go and main.go should be tested by integration tests.
47+
- 'main.go'
48+
# ignore metadata generated files
49+
- 'metadata/generated_.*\.go'
50+
# ignore wrappers around gopsutil
51+
- 'internal/datasource/host'
52+
- 'internal/watcher/process'
53+
- 'pkg/nginxprocess'
54+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: configure-goproxy
2+
author: s.breen
3+
description: Sets the current Go module proxy based on the presence of a private proxy URL in secrets
4+
inputs:
5+
user:
6+
description: Artifactory username secret name
7+
required: false
8+
default: ""
9+
token:
10+
description: Artifactory token secret name
11+
required: false
12+
default: ""
13+
url:
14+
description: Artifactory URL
15+
required: false
16+
default: ""
17+
runs:
18+
using: 'composite'
19+
steps:
20+
- name: Configure Go Proxy
21+
id: configure-goproxy
22+
shell: bash
23+
run: |
24+
if [[ -z "${{ inputs.user }}" ]] || \
25+
[[ -z "${{ inputs.token }}" ]] || \
26+
[[ -z "${{ inputs.url }}" ]] || \
27+
[[ "${{ github.event.pull_request.head.repo.fork }}" == 'true' ]] ||
28+
[[ "${{ startsWith(github.head_ref, 'dependabot-')}}" == 'true' ]] ; then
29+
echo "No Artifactory secrets available - using direct GOPROXY"
30+
GOPROXY_VALUE="direct"
31+
else
32+
echo "Development mode - using dev Artifactory"
33+
GOPROXY_VALUE="https://${{ inputs.user }}:${{ inputs.token }}@${{ inputs.url }}"
34+
fi
35+
echo "GOPROXY=${GOPROXY_VALUE}" >> $GITHUB_ENV
36+

.github/workflows/assertion.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
2+
name: Generate and Sign Assertion Document
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
branch:
8+
type: string
9+
description: "The branch to run the assertion workflow on"
10+
required: false
11+
default: main
12+
13+
jobs:
14+
build-assertion-document:
15+
name: Build and Generate Assertion Document
16+
runs-on: ubuntu-22.04
17+
if: ${{ !github.event.pull_request.head.repo.fork }}
18+
permissions:
19+
id-token: write
20+
contents: read
21+
env:
22+
GOPROXY: "https://${{ secrets.ARTIFACTORY_USER }}:${{ secrets.ARTIFACTORY_TOKEN }}@azr.artifactory.f5net.com/artifactory/api/go/f5-nginx-go-local-approved-dependency"
23+
outputs:
24+
agent_binary: ${{ steps.check_binary.outputs.agent_binary }}
25+
goversionm: ${{ steps.godeps.outputs.goversionm }}
26+
assertion_document: ${{ steps.assertiondoc.outputs.assertion-document-path }}
27+
strategy:
28+
matrix:
29+
osarch: [amd64, arm64]
30+
steps:
31+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
32+
33+
- name: Set up Go
34+
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
35+
with:
36+
go-version-file: go.mod
37+
cache: false
38+
39+
- name: Gather build dependencies
40+
id: godeps
41+
run: |
42+
if [ -z ${{inputs.branch}} ]; then
43+
echo "No branch input provided, using current branch: $GITHUB_REF_NAME"
44+
else
45+
echo "Checking out branch: ${{inputs.branch}}"
46+
git checkout ${{inputs.branch}}
47+
fi
48+
echo "Current branch: $GITHUB_REF_NAME"
49+
echo "branch_name=$GITHUB_REF_NAME" >> $GITHUB_ENV
50+
GO_VERSION=$(go version | awk '{print $3}' | sed 's/go//')
51+
echo "GO_VERSION=$GO_VERSION" >> $GITHUB_ENV
52+
echo "GO_VERSION=$GO_VERSION"
53+
echo "time_start=$(date +%s)" >> $GITHUB_ENV
54+
OSARCH=${{matrix.osarch}} make build
55+
echo "time_end=$(date +%s)" >> $GITHUB_ENV
56+
echo "Build time: $((time_end - time_start)) seconds"
57+
58+
echo "Getting sha256sum of the built nginx-agent binary..."
59+
echo "agent-digest=$(sha256sum build/nginx-agent | awk '{print $1}')" >> $GITHUB_ENV
60+
61+
echo "Checking dependencies..."
62+
go version -m build/nginx-agent > goversionm_${{ github.run_id }}_${{ github.run_number }}.txt
63+
ls -l goversionm_*.txt
64+
echo "goversionm=$(find -type f -name "goversionm*.txt" | head -n 1)" >> $GITHUB_ENV
65+
66+
- name: Generate Assertion Document
67+
id: assertiondoc
68+
uses: nginxinc/compliance-rules/.github/actions/assertion@83e452166aaf0ad8f07caf91a4f1f903b3dea1e6 # v0.3.0
69+
with:
70+
artifact-name: nginx-agent_${{ env.branch_name }}_${{ matrix.osarch }}
71+
artifact-digest: ${{ env.agent-digest }}
72+
build-type: 'github'
73+
builder-id: 'github.com'
74+
builder-version: '${{env.GO_VERSION}}_test'
75+
invocation-id: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }}
76+
artifactory-user: ${{ secrets.ARTIFACTORY_USER }}
77+
artifactory-api-token: ${{ secrets.ARTIFACTORY_TOKEN }}
78+
artifactory-url: ${{ secrets.ARTIFACTORY_URL }}
79+
artifactory-repo: 'f5-nginx-go-local-approved-dependency'
80+
assertion-doc-file: assertion_nginx-agent_${{env.branch_name}}_${{matrix.osarch}}.json
81+
build-content-path: ${{ env.goversionm }}
82+
started-on: '${{ env.time_start }}'
83+
finished-on: '${{ env.time_end }}'
84+
85+
- name: Sign and Store Assertion Document
86+
id: sign
87+
uses: nginxinc/compliance-rules/.github/actions/sign@83e452166aaf0ad8f07caf91a4f1f903b3dea1e6 # v0.3.0
88+
with:
89+
assertion-doc: ${{ steps.assertiondoc.outputs.assertion-document-path }}

.github/workflows/ci.yml

Lines changed: 75 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
runs-on: ubuntu-22.04
2929
if: ${{ !github.event.pull_request.head.repo.fork && !startsWith(github.head_ref, 'dependabot-') }}
3030
env:
31-
GOPROXY: "https://${{ secrets.ARTIFACTORY_USER }}:${{ secrets.ARTIFACTORY_TOKEN }}@azr.artifactory.f5net.com/artifactory/api/go/f5-nginx-go-dev"
31+
GOPROXY: "https://${{ secrets.ARTIFACTORY_USER }}:${{ secrets.ARTIFACTORY_TOKEN }}@${{ secrets.ARTIFACTORY_URL_DEV }}"
3232
steps:
3333
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
3434
with:
@@ -46,6 +46,12 @@ jobs:
4646
runs-on: ubuntu-22.04
4747
steps:
4848
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
49+
- name: Configure Go Proxy
50+
uses: ./.github/actions/configure-goproxy
51+
with:
52+
user: ${{ secrets.ARTIFACTORY_USER }}
53+
token: ${{ secrets.ARTIFACTORY_TOKEN }}
54+
url: ${{ secrets.ARTIFACTORY_URL_DEV }}
4955
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
5056
with:
5157
go-version-file: 'go.mod'
@@ -62,26 +68,35 @@ jobs:
6268
contents: write
6369
steps:
6470
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
71+
- name: Configure Go Proxy
72+
uses: ./.github/actions/configure-goproxy
73+
with:
74+
user: ${{ secrets.ARTIFACTORY_USER }}
75+
token: ${{ secrets.ARTIFACTORY_TOKEN }}
76+
url: ${{ secrets.ARTIFACTORY_URL_DEV }}
6577
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
6678
with:
6779
go-version-file: 'go.mod'
6880
cache: false
6981
- name: Run Unit Tests
7082
run: make unit-test
71-
- name: Check Coverage
72-
uses: vladopajic/go-test-coverage@dd4b1f21c4e48db0425e1187d2845404b1206919
83+
- name: Uplaod Test Coverage
84+
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
7385
with:
74-
config: ./.testcoverage.yaml
75-
## when token is not specified (value '') this feature is turned off
76-
git-token: ${{ github.ref_name == 'main' && secrets.GITHUB_TOKEN || '' }}
77-
## name of orphaned branch where badges are stored
78-
git-branch: badges
86+
files: ./build/test/coverage.out
87+
token: ${{ secrets.CODECOV_TOKEN }}
7988

8089
race-condition-test:
8190
name: Unit tests with race condition detection
8291
runs-on: ubuntu-22.04
8392
steps:
8493
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
94+
- name: Configure Go Proxy
95+
uses: ./.github/actions/configure-goproxy
96+
with:
97+
user: ${{ secrets.ARTIFACTORY_USER }}
98+
token: ${{ secrets.ARTIFACTORY_TOKEN }}
99+
url: ${{ secrets.ARTIFACTORY_URL_DEV }}
85100
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
86101
with:
87102
go-version-file: 'go.mod'
@@ -96,6 +111,12 @@ jobs:
96111
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
97112
with:
98113
fetch-tags: 'true'
114+
- name: Configure Go Proxy
115+
uses: ./.github/actions/configure-goproxy
116+
with:
117+
user: ${{ secrets.ARTIFACTORY_USER }}
118+
token: ${{ secrets.ARTIFACTORY_TOKEN }}
119+
url: ${{ secrets.ARTIFACTORY_URL_DEV }}
99120
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
100121
with:
101122
go-version-file: 'go.mod'
@@ -127,6 +148,12 @@ jobs:
127148
version: "3.22"
128149
steps:
129150
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
151+
- name: Configure Go Proxy
152+
uses: ./.github/actions/configure-goproxy
153+
with:
154+
user: ${{ secrets.ARTIFACTORY_USER }}
155+
token: ${{ secrets.ARTIFACTORY_TOKEN }}
156+
url: ${{ secrets.ARTIFACTORY_URL_DEV }}
130157
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
131158
with:
132159
go-version-file: 'go.mod'
@@ -171,6 +198,12 @@ jobs:
171198
version: "3.22"
172199
steps:
173200
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
201+
- name: Configure Go Proxy
202+
uses: ./.github/actions/configure-goproxy
203+
with:
204+
user: ${{ secrets.ARTIFACTORY_USER }}
205+
token: ${{ secrets.ARTIFACTORY_TOKEN }}
206+
url: ${{ secrets.ARTIFACTORY_URL_DEV }}
174207
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
175208
with:
176209
go-version-file: 'go.mod'
@@ -222,6 +255,12 @@ jobs:
222255
release: "alpine"
223256
steps:
224257
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
258+
- name: Configure Go Proxy
259+
uses: ./.github/actions/configure-goproxy
260+
with:
261+
user: ${{ secrets.ARTIFACTORY_USER }}
262+
token: ${{ secrets.ARTIFACTORY_TOKEN }}
263+
url: ${{ secrets.ARTIFACTORY_URL_DEV }}
225264
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
226265
with:
227266
go-version-file: 'go.mod'
@@ -283,6 +322,12 @@ jobs:
283322
path: "/nginx-plus/agent"
284323
steps:
285324
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
325+
- name: Configure Go Proxy
326+
uses: ./.github/actions/configure-goproxy
327+
with:
328+
user: ${{ secrets.ARTIFACTORY_USER }}
329+
token: ${{ secrets.ARTIFACTORY_TOKEN }}
330+
url: ${{ secrets.ARTIFACTORY_URL_DEV }}
286331
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
287332
with:
288333
go-version-file: 'go.mod'
@@ -293,7 +338,7 @@ jobs:
293338
name: nginx-agent-unsigned-snapshots
294339
path: build
295340
- name: Login to Docker Registry
296-
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
341+
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
297342
with:
298343
registry: ${{ secrets.TEST_REGISTRY_URL }}
299344
username: ${{ secrets.REGISTRY_USERNAME }}
@@ -342,7 +387,13 @@ jobs:
342387
version: "mainline"
343388
release: "alpine"
344389
steps:
345-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
390+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
391+
- name: Configure Go Proxy
392+
uses: ./.github/actions/configure-goproxy
393+
with:
394+
user: ${{ secrets.ARTIFACTORY_USER }}
395+
token: ${{ secrets.ARTIFACTORY_TOKEN }}
396+
url: ${{ secrets.ARTIFACTORY_URL_DEV }}
346397
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
347398
with:
348399
go-version-file: 'go.mod'
@@ -403,7 +454,13 @@ jobs:
403454
release: "debian"
404455
path: "/nginx-plus/agent"
405456
steps:
406-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
457+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
458+
- name: Configure Go Proxy
459+
uses: ./.github/actions/configure-goproxy
460+
with:
461+
user: ${{ secrets.ARTIFACTORY_USER }}
462+
token: ${{ secrets.ARTIFACTORY_TOKEN }}
463+
url: ${{ secrets.ARTIFACTORY_URL_DEV }}
407464
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
408465
with:
409466
go-version-file: 'go.mod'
@@ -414,7 +471,7 @@ jobs:
414471
name: nginx-agent-unsigned-snapshots
415472
path: build
416473
- name: Login to Docker Registry
417-
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
474+
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
418475
with:
419476
registry: ${{ secrets.TEST_REGISTRY_URL }}
420477
username: ${{ secrets.REGISTRY_USERNAME }}
@@ -449,6 +506,12 @@ jobs:
449506
contents: write
450507
steps:
451508
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
509+
- name: Configure Go Proxy
510+
uses: ./.github/actions/configure-goproxy
511+
with:
512+
user: ${{ secrets.ARTIFACTORY_USER }}
513+
token: ${{ secrets.ARTIFACTORY_TOKEN }}
514+
url: ${{ secrets.ARTIFACTORY_URL_DEV }}
452515
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
453516
with:
454517
go-version-file: 'go.mod'

.github/workflows/dependency-review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ jobs:
2525
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2626

2727
- name: "Dependency Review"
28-
uses: actions/dependency-review-action@595b5aeba73380359d98a5e087f648dbb0edce1b # v4.7.3
28+
uses: actions/dependency-review-action@40c09b7dc99638e5ddb0bfd91c1673effc064d8a # v4.8.1
2929
with:
3030
config-file: "nginxinc/k8s-common/dependency-review-config.yml@main"

0 commit comments

Comments
 (0)