Skip to content

Commit ee263e6

Browse files
committed
Merge branch 'main' into mrajagopal-unit-tests
2 parents b1f649c + e875ba9 commit ee263e6

26 files changed

+1980
-1003
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### Proposed changes
2+
3+
Describe the use case and detail of the change. If this PR addresses an issue on GitHub, make sure to include a link to
4+
that issue here in this description (not in the title of the PR).
5+
6+
### Checklist
7+
8+
Before creating a PR, run through this checklist and mark each as complete.
9+
10+
- [ ] I have read the [CONTRIBUTING](https://github.com/nginxinc/nginx-supportpkg-for-k8s/blob/main/CONTRIBUTING.md) guide
11+
- [ ] I have proven my fix is effective or that my feature works
12+
- [ ] I have checked that all unit tests pass after adding my changes
13+
- [ ] I have ensured the README is up to date
14+
- [ ] I have rebased my branch onto main
15+
- [ ] I will ensure my PR is targeting the main branch and pulling from my branch on my own fork

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: daily
7+
8+
- package-ecosystem: gomod
9+
directory: /
10+
schedule:
11+
interval: daily

.github/workflows/docker-build.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Build and Push Docker Image For nginx-utils Container
2+
permissions:
3+
contents: read
4+
packages: write
5+
actions: write
6+
on:
7+
release:
8+
types: [created]
9+
10+
env:
11+
RELEASE_VERSION: ${{ github.event.release.tag_name }}
12+
jobs:
13+
run-on-release:
14+
if: endsWith(github.event.release.tag_name, '-docker')
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Set Release Version
18+
run: echo "RELEASE_VERSION=${RELEASE_VERSION%-docker}" >> $GITHUB_ENV
19+
20+
- name: Starting Release Build
21+
run: echo "Starting Release Build for ${RELEASE_VERSION}"
22+
23+
- name: Checkout code
24+
uses: actions/[email protected]
25+
26+
- name: List repository files
27+
run: ls -R .; pwd
28+
- name: Set up Docker Buildx
29+
uses: docker/[email protected]
30+
31+
- name: Log in to GitHub Container Registry
32+
uses: docker/[email protected]
33+
with:
34+
registry: ghcr.io
35+
username: ${{ github.repository_owner }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
- name: Build and push Docker image
38+
uses: docker/[email protected]
39+
with:
40+
context: .
41+
file: nginx-utils/Dockerfile
42+
push: true
43+
platforms: linux/amd64,linux/arm64
44+
tags: |
45+
ghcr.io/nginx/nginx-utils:${{ env.RELEASE_VERSION }}
46+
ghcr.io/nginx/nginx-utils:latest
47+
48+
- name: Install Trivy and scan image for vulnerabilities
49+
uses: aquasecurity/[email protected]
50+
51+
with:
52+
image-ref: ghcr.io/${{ github.repository_owner }}/nginx-utils:latest
53+
format: json
54+
output: vuln-report.json
55+
56+
- name: Upload Vulnerability Report
57+
uses: actions/[email protected]
58+
with:
59+
name: vuln-report
60+
path: vuln-report.json
61+
62+
- name: Update Release Notes with Docker Image Info
63+
uses: softprops/[email protected]
64+
with:
65+
tag_name: ${{ github.event.release.tag_name }}
66+
body: |
67+
## Docker Image
68+
The Docker image for this release can be pulled using:
69+
70+
```
71+
docker pull ghcr.io/${{ github.repository_owner }}/nginx-utils:${{ github.event.release.tag_name }}
72+
```
73+
74+
Or use the `latest` tag:
75+
76+
```
77+
docker pull ghcr.io/${{ github.repository_owner }}/nginx-utils:latest
78+
```

.github/workflows/f5.cla.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: F5 CLA
2+
3+
on:
4+
issue_comment:
5+
types:
6+
- created
7+
pull_request_target:
8+
types:
9+
- opened
10+
- synchronize
11+
- reopened
12+
13+
concurrency:
14+
group: ${{ github.ref_name }}-cla
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
f5-cla:
21+
name: F5 CLA
22+
runs-on: ubuntu-22.04
23+
permissions:
24+
actions: write
25+
contents: read
26+
pull-requests: write
27+
statuses: write
28+
steps:
29+
- name: Run F5 Contributor License Agreement (CLA) assistant
30+
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have hereby read the F5 CLA and agree to its terms') || github.event_name == 'pull_request_target'
31+
uses: contributor-assistant/github-action@ca4a40a7d1004f18d9960b404b97e5f30a505a08 # v2.6.1
32+
with:
33+
# Any pull request targeting the following branch will trigger a CLA check.
34+
branch: "main"
35+
# Path to the CLA document.
36+
path-to-document: "https://github.com/f5/.github/blob/main/CLA/cla-markdown.md"
37+
# Custom CLA messages.
38+
custom-notsigned-prcomment: "🎉 Thank you for your contribution! It appears you have not yet signed the F5 Contributor License Agreement (CLA), which is required for your changes to be incorporated into an F5 Open Source Software (OSS) project. Please kindly read the [F5 CLA](https://github.com/f5/.github/blob/main/CLA/cla-markdown.md) and reply on a new comment with the following text to agree:"
39+
custom-pr-sign-comment: "I have hereby read the F5 CLA and agree to its terms"
40+
custom-allsigned-prcomment: "✅ All required contributors have signed the F5 CLA for this PR. Thank you!"
41+
# Remote repository storing CLA signatures.
42+
remote-organization-name: "f5"
43+
remote-repository-name: "f5-cla-data"
44+
path-to-signatures: "signatures/beta/signatures.json"
45+
# Comma separated list of usernames for maintainers or any other individuals who should not be prompted for a CLA.
46+
allowlist: bot*
47+
# Do not lock PRs after a merge.
48+
lock-pullrequest-aftermerge: false
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
PERSONAL_ACCESS_TOKEN: ${{ secrets.F5_CLA_TOKEN }}

.github/workflows/fossa.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Fossa
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- "**.md"
9+
- "LICENSE"
10+
11+
concurrency:
12+
group: ${{ github.ref_name }}-fossa
13+
cancel-in-progress: true
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
scan:
20+
name: Fossa
21+
runs-on: ubuntu-22.04
22+
if: ${{ github.event.repository.fork == false }}
23+
steps:
24+
- name: Checkout Repository
25+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
26+
27+
- name: Scan
28+
uses: fossas/fossa-action@3ebcea1862c6ffbd5cf1b4d0bd6b3fe7bd6f2cac # v1.7.0
29+
with:
30+
api-key: ${{ secrets.FOSSA_TOKEN }}

.github/workflows/go-builder.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 58 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Build and upload release artifact
22

3+
permissions:
4+
contents: read
5+
36
on:
47
release:
58
types: [created]
@@ -9,44 +12,61 @@ env:
912

1013
jobs:
1114
build:
15+
if: endsWith(github.event.release.tag_name, '-krew')
16+
permissions:
17+
contents: write
18+
1219
runs-on: ubuntu-latest
1320

1421
steps:
15-
- name: Checkout code
16-
uses: actions/checkout@v4
17-
18-
- name: Set Release Version
19-
run: echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
20-
21-
- name: Set up Go
22-
uses: actions/setup-go@v5
23-
with:
24-
go-version: '1.22.4'
25-
26-
- name: Build
27-
run: |
28-
BUILD=$(git log --format='%H' -n 1)
29-
VERSION=$RELEASE_VERSION
30-
OSES="linux darwin windows"
31-
ARCHS="amd64 arm64"
32-
IFS=" "
33-
34-
for OS in $OSES; do
35-
for ARCH in $ARCHS; do
36-
echo "OS: ${OS} and ARCH: ${ARCH}"
37-
CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH} go build -ldflags "-w -s -X github.com/nginxinc/nginx-k8s-supportpkg/pkg/version.Build=$BUILD\
38-
-X github.com/nginxinc/nginx-k8s-supportpkg/pkg/version.Version=$VERSION"\
39-
-o release/kubectl-nginx_supportpkg_${VERSION}_${OS}_${ARCH}/kubectl-nginx_supportpkg
40-
cp LICENSE release/kubectl-nginx_supportpkg_${VERSION}_${OS}_${ARCH}/
41-
tar czvf release/kubectl-nginx_supportpkg_${VERSION}_${OS}_${ARCH}.tar.gz -C release/kubectl-nginx_supportpkg_${VERSION}_${OS}_${ARCH}/ .
42-
done; done
43-
44-
- name: Upload release binaries
45-
uses: alexellis/[email protected]
46-
env:
47-
GITHUB_TOKEN: ${{ github.token }}
48-
with:
49-
asset_paths: '["./release/*.gz"]'
50-
51-
- name: Update new version in krew-index
52-
uses: rajatjindal/[email protected]
22+
- name: Checkout code
23+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
24+
25+
- name: Set Release Version
26+
run: echo "RELEASE_VERSION=${RELEASE_VERSION%-krew}" >> $GITHUB_ENV
27+
28+
- name: Set up Go
29+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
30+
with:
31+
go-version: '1.24.3'
32+
33+
- name: Install Cosign
34+
uses: sigstore/cosign-installer@3454372f43399081ed03b604cb2d021dabca52bb # v3.8.2
35+
with:
36+
cosign-release: 'v2.4.0'
37+
38+
- name: Check cosign version
39+
run: cosign version
40+
41+
- name: Build
42+
run: |
43+
set -e
44+
BUILD=$(git log --format='%H' -n 1)
45+
VERSION=$RELEASE_VERSION
46+
OSES="linux darwin windows"
47+
ARCHS="amd64 arm64"
48+
IFS=" "
49+
50+
for OS in $OSES; do
51+
for ARCH in $ARCHS; do
52+
echo "OS: ${OS} and ARCH: ${ARCH}"
53+
CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH} go build -ldflags "-w -s -X github.com/nginxinc/nginx-k8s-supportpkg/pkg/version.Build=$BUILD\
54+
-X github.com/nginxinc/nginx-k8s-supportpkg/pkg/version.Version=$VERSION"\
55+
-o release/kubectl-nginx_supportpkg_${VERSION}_${OS}_${ARCH}/kubectl-nginx_supportpkg
56+
cp LICENSE release/kubectl-nginx_supportpkg_${VERSION}_${OS}_${ARCH}/
57+
tar czvf release/kubectl-nginx_supportpkg_${VERSION}_${OS}_${ARCH}.tar.gz -C release/kubectl-nginx_supportpkg_${VERSION}_${OS}_${ARCH}/ .
58+
sha256sum "release/kubectl-nginx_supportpkg_${VERSION}_${OS}_${ARCH}.tar.gz" >> "release/kubectl-nginx_supportpkg_${VERSION}_checksums.txt"
59+
done; done
60+
cosign sign-blob "release/kubectl-nginx_supportpkg_${VERSION}_checksums.txt" \
61+
--output-signature="release/kubectl-nginx_supportpkg_${VERSION}_checksums.txt.sig" \
62+
--output-certificate="release/kubectl-nginx_supportpkg_${VERSION}_checksums.txt.pem" -y
63+
64+
- name: Upload release binaries
65+
uses: alexellis/upload-assets@13926a61cdb2cb35f5fdef1c06b8b591523236d3 # 0.4.1
66+
env:
67+
GITHUB_TOKEN: ${{ github.token }}
68+
with:
69+
asset_paths: '["./release/*.gz", "./release/*.txt", "./release/*.sig", "./release/*.pem"]'
70+
71+
- name: Update new version in krew-index
72+
uses: rajatjindal/krew-release-bot@3d9faef30a82761d610544f62afddca00993eef9 # v0.0.47

0 commit comments

Comments
 (0)