Skip to content

Commit

Permalink
Remove hardcoded golangci-lint and go version
Browse files Browse the repository at this point in the history
This will remove hardcoded versions of golangci-lint and go
in Makefile and release pipeline, instead detect them from
go.mod files

This will eliminate the need to update them during release
and also CI will run the latest golangci-lint version
  • Loading branch information
piyush-garg authored and tekton-robot committed Aug 26, 2024
1 parent f6d3776 commit 8dd3404
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ M = $(shell printf "\033[34;1m🐱\033[0m")
TIMEOUT_UNIT = 5m
TIMEOUT_E2E = 20m

GOLANGCI_VERSION = v1.60.1
# Get golangci_version from tools/go.mod to eliminate the manual bump
GOLANGCI_VERSION = $(shell cat tools/go.mod | grep golangci-lint | awk '{ print $$3 }')

YAML_FILES := $(shell find . -type f -regex ".*y[a]ml" -print)

Expand Down
10 changes: 7 additions & 3 deletions tekton/release-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ spec:
- name: github-token-secret-key
description: name of the key for the secret holding the github-token
default: bot-token
- name: golangci-lint-version
description: version of the golangci-lint tool
- name: go-version
description: version of the go language
tasks:
- name: fetch-repository
taskRef:
Expand Down Expand Up @@ -54,7 +58,7 @@ spec:
- name: flags
value: "-v --timeout 20m"
- name: version
value: v1.60.1
value: $(params.golangci-lint-version)
workspaces:
- name: source
workspace: shared-workspace
Expand All @@ -68,7 +72,7 @@ spec:
- name: packages
value: ./pkg/... ./cmd/...
- name: version
value: "1.22.5"
value: $(params.go-version)
- name: flags
value: -v -mod=vendor
workspaces:
Expand All @@ -82,7 +86,7 @@ spec:
- name: package
value: $(params.package)
- name: version
value: "1.22.5"
value: $(params.go-version)
- name: flags
value: -v -mod=vendor
workspaces:
Expand Down
5 changes: 5 additions & 0 deletions tekton/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ CATALOG_TASKS="lint build test"

BINARIES="kubectl jq tkn git"

GOLANGCI_VERSION="$(cat tools/go.mod | grep golangci-lint | awk '{ print $3 }')"
GO_VERSION="$(cat go.mod | grep "go" | awk 'NR==1{ print $2 }')"

set -e

for b in ${BINARIES};do
Expand Down Expand Up @@ -147,6 +150,8 @@ URL=$(git remote get-url "${PUSH_REMOTE}" | sed 's,[email protected]:,https://githu
tkn -n ${TARGET_NAMESPACE} pipeline start cli-release-pipeline \
-p revision="${RELEASE_VERSION}" \
-p url="${URL}" \
-p golangci-lint-version="${GOLANGCI_VERSION}" \
-p go-version="${GO_VERSION}" \
-w name=shared-workspace,volumeClaimTemplateFile=./tekton/volume-claim-template.yml

tkn -n ${TARGET_NAMESPACE} pipeline logs cli-release-pipeline -f --last

0 comments on commit 8dd3404

Please sign in to comment.