Skip to content

Commit 6e15c39

Browse files
committed
Merge branch 'main' into workflow-release-updater
2 parents 04a7ea6 + d202006 commit 6e15c39

File tree

248 files changed

+15686
-6751
lines changed

Some content is hidden

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

248 files changed

+15686
-6751
lines changed

.codecov.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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+
default:
26+
informational: true
27+
target: auto
28+
threshold: 0%
29+
only_pulls: false
30+
31+
comment:
32+
layout: "header,diff,files,footer"
33+
behavior: default
34+
require_changes: false
35+
require_base: false
36+
require_head: true
37+
38+
39+
# Ignore files or packages matching their paths
40+
ignore:
41+
- '\.pb\.go$' # Excludes all protobuf generated files
42+
- '\.gen\.go' # Excludes generated files
43+
- '^fake_.*\.go' # Excludes fakes
44+
- '^test/.*$'
45+
- 'app.go' # app.go and main.go should be tested by integration tests.
46+
- 'main.go'
47+
# ignore metadata generated files
48+
- 'metadata/generated_.*\.go'
49+
# ignore wrappers around gopsutil
50+
- 'internal/datasource/host'
51+
- 'internal/watcher/process'
52+
- 'pkg/nginxprocess'
53+
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+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Start Promtail
2+
description: Start promtail in a docker container to ship test results to Grafana Loki, then stop the container
3+
inputs:
4+
loki_url:
5+
description: URL endpoint of the Grafana Loki instance
6+
required: true
7+
runs:
8+
using: 'composite'
9+
steps:
10+
- name: Start promtail container
11+
shell: bash
12+
run: |
13+
docker run -d \
14+
--name=promtail \
15+
-v ${{ github.workspace }}/test/dashboard/promtail/promtail-config.yaml:/etc/promtail/promtail-config.yaml \
16+
-v ${{ github.workspace }}/test/dashboard/logs/:/var/log \
17+
-e TEST_OUTDIR=test/dashboard/logs \
18+
-e LOKI_URL=${{ inputs.loki_url }} \
19+
-e GITHUB_RUN_ID="${{ github.run_id }}" \
20+
-e GITHUB_WORKFLOW="${{ github.workflow }}" \
21+
-e GITHUB_EVENT_NAME="${{ github.event_name }}" \
22+
-e GITHUB_REPOSITORY="${{ github.repository }}" \
23+
-e GITHUB_SERVER_URL="${{ github.server_url }}" \
24+
-e GITHUB_JOB="${{ github.job }}" \
25+
-e GITHUB_HEAD_REF="${{ github.head_ref }}" \
26+
-e GITHUB_SHA="${{ github.sha }}" \
27+
-e GITHUB_ACTOR="${{ github.actor }}" \
28+
grafana/promtail:3.4.4 \
29+
-config.file=/etc/promtail/promtail-config.yaml \
30+
-config.expand-env=true

.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 }}

0 commit comments

Comments
 (0)