Skip to content

Commit ba88e4c

Browse files
authored
[CI/CD] Various fixes (#1200)
* fix version check, and reenable perf test results upload * fetch tags * fetch tags * update step title
1 parent a03f7cf commit ba88e4c

File tree

2 files changed

+28
-14
lines changed

2 files changed

+28
-14
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,26 @@ permissions:
2020

2121
env:
2222
NFPM_VERSION: 'v2.35.3'
23-
GOPROXY: "https://${{ secrets.ARTIFACTORY_USER }}:${{ secrets.ARTIFACTORY_TOKEN }}@azr.artifactory.f5net.com/artifactory/api/go/f5-nginx-go-dev"
23+
GOPROXY: "direct"
2424

2525
jobs:
26-
set-vars:
26+
proxy-sanity-check:
27+
name: Proxy Sanity Check
2728
runs-on: ubuntu-22.04
29+
if: ${{ !github.event.pull_request.head.repo.fork }}
30+
env:
31+
GOPROXY: "https://${{ secrets.ARTIFACTORY_USER }}:${{ secrets.ARTIFACTORY_TOKEN }}@azr.artifactory.f5net.com/artifactory/api/go/f5-nginx-go-dev"
2832
steps:
29-
- name: Set Variables
33+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
34+
with:
35+
fetch-tags: 'true'
36+
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
37+
with:
38+
go-version-file: 'go.mod'
39+
cache: false
40+
- name: run goproxy-sanity-check
3041
run: |
31-
if [[ -z ${{ secrets.ARTIFACTORY_USER }} ]] ||
32-
[[ -z ${{ secrets.ARTIFACTORY_TOKEN }} ]] ||
33-
${{ github.event.pull_request.head.repo.fork }}; then
34-
echo "GOPROXY=direct" >> $GITHUB_ENV
35-
fi
42+
make build
3643
3744
lint:
3845
name: Lint
@@ -47,6 +54,7 @@ jobs:
4754
run: make install-tools
4855
- name: run lint
4956
run: make lint
57+
5058
unit-test:
5159
name: Unit Tests
5260
runs-on: ubuntu-22.04
@@ -63,9 +71,10 @@ jobs:
6371
with:
6472
config: ./.testcoverage.yaml
6573
## when token is not specified (value '') this feature is turned off
66-
git-token: ${{ github.ref_name == 'v3' && secrets.GITHUB_TOKEN || '' }}
74+
git-token: ${{ github.ref_name == 'main' && secrets.GITHUB_TOKEN || '' }}
6775
## name of orphaned branch where badges are stored
6876
git-branch: badges
77+
6978
race-condition-test:
7079
name: Unit tests with race condition detection
7180
runs-on: ubuntu-22.04
@@ -77,11 +86,14 @@ jobs:
7786
cache: false
7887
- name: Run unit tests with race condition detection
7988
run: make race-condition-test
89+
8090
build-unsigned-snapshot:
8191
name: Build Unsigned Snapshot
8292
runs-on: ubuntu-22.04
8393
steps:
8494
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
95+
with:
96+
fetch-tags: 'true'
8597
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
8698
with:
8799
go-version-file: 'go.mod'
@@ -247,7 +259,7 @@ jobs:
247259
gh-pages-branch: "benchmark-results"
248260
fail-on-alert: true
249261
- name: Push benchmark result
250-
if: ${{ success() && github.ref_name == 'v3'}}
262+
if: ${{ success() && github.ref_name == 'main'}}
251263
run: git push 'https://github-actions:${{ secrets.GITHUB_TOKEN }}@github.com/nginx/agent.git' benchmark-results:benchmark-results
252264
load-tests:
253265
name: Load Tests
@@ -314,10 +326,10 @@ jobs:
314326
benchmark-data-dir-path: ""
315327
# Set auto-push to false since GitHub API token is not given
316328
auto-push: false
317-
alert-threshold: '175%'
329+
alert-threshold: '125%'
318330
gh-pages-branch: "benchmark-results"
319331
fail-on-alert: true
320332

321333
- name: Push load test result
322-
if: ${{ success() && github.ref_name == 'v3'}}
334+
if: ${{ success() && github.ref_name == 'main' }}
323335
run: git push 'https://github-actions:${{ secrets.GITHUB_TOKEN }}@github.com/nginx/agent.git' benchmark-results:benchmark-results

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ MANIFEST_DIR ?= /var/lib/nginx-agent
4848
DIRS = $(BUILD_DIR) $(TEST_BUILD_DIR) $(BUILD_DIR)/$(DOCS_DIR) $(BUILD_DIR)/$(DOCS_DIR)/$(PROTO_DIR)
4949
$(shell mkdir -p $(DIRS))
5050

51-
VERSION ?= "v3.0.0"
51+
VERSION ?= $(shell git describe --match "v[0-9]*" --abbrev=0 --tags)
52+
ifeq ($(strip $(VERSION)),)
53+
VERSION := $(shell curl https://api.github.com/repos/nginx/agent/releases/latest -s | jq .name -r)
54+
endif
5255
COMMIT = $(shell git rev-parse --short HEAD)
5356
DATE = $(shell date +%F_%H-%M-%S)
5457
LDFLAGS = "-s -w -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(DATE)"
@@ -104,7 +107,6 @@ include Makefile.containers
104107
include Makefile.packaging
105108

106109
.PHONY: help clean no-local-changes build lint format unit-test integration-test run dev run-mock-management-grpc-server generate generate-mocks local-apk-package local-deb-package local-rpm-package
107-
108110
help: ## Show help message
109111
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\033[36m\033[0m\n"} /^[$$()% 0-9a-zA-Z_-]+:.*?##/ { printf " \033[36m%-24s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
110112

0 commit comments

Comments
 (0)