Skip to content

Commit

Permalink
Bump goreleaser version and optimize get-version
Browse files Browse the repository at this point in the history
With go version v1.20.7, goreleaser version also need to be upgraded to
v1.15.2.

Also in get-version task we were running two steps and both the
steps were using same image, hence merged both into a single step. Also
the task was using goreleaser image which is more than 300M in size,
instead using alpine/git which is ~21M

Also use tkn hub install to install tasks from catalog so that we always
use the latest one available

Signed-off-by: vinamra28 <[email protected]>
  • Loading branch information
vinamra28 committed Sep 17, 2023
1 parent ac5df8b commit 7c7eed3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
16 changes: 6 additions & 10 deletions tekton/get-version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,15 @@ spec:
- name: package
description: base package where the source code lies
steps:
- name: pull
image: goreleaser/goreleaser
- name: pull-get-versions
image: alpine/git:v2.40.1
workingDir: $(workspaces.source.path)
script: |
git config --global --add safe.directory $(workspaces.source.path)
git status && git fetch -p --all
- name: get-versions
# because it has git
image: goreleaser/goreleaser
workingDir: $(workspaces.source.path)
script: |
echo -n $(git tag --points-at HEAD) > /tekton/results/version
echo -n $(git tag --points-at HEAD | sed 's/^v\([^\.]*\)\.\([^\.]*\).*/\1/') > /tekton/results/major
echo -n $(git tag --points-at HEAD | sed 's/^v\([^\.]*\)\.\([^\.]*\).*/\2/') > /tekton/results/minor
echo -n $(git tag --points-at HEAD) > $(results.version.path)
echo -n $(git tag --points-at HEAD | sed 's/^v\([^\.]*\)\.\([^\.]*\).*/\1/') > $(results.major.path)
echo -n $(git tag --points-at HEAD | sed 's/^v\([^\.]*\)\.\([^\.]*\).*/\2/') > $(results.minor.path)
results:
- name: version
- name: major
Expand Down
2 changes: 1 addition & 1 deletion tekton/release-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ spec:
- name: github-token-secret-key
value: $(params.github-token-secret-key)
- name: image
value: goreleaser/goreleaser:v1.11.5
value: goreleaser/goreleaser:v1.15.2
workspaces:
- name: source
workspace: shared-workspace
9 changes: 5 additions & 4 deletions tekton/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,15 @@ kubectl create namespace ${TARGET_NAMESPACE} 2>/dev/null || true

for task in ${CATALOG_TASKS};do
if [ ${task} == "lint" ]; then
kubectl -n ${TARGET_NAMESPACE} apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/golangci-${task}/0.2/golangci-${task}.yaml
tkn -n ${TARGET_NAMESPACE} hub install task golangci-lint
else
kubectl -n ${TARGET_NAMESPACE} apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/golang-${task}/0.2/golang-${task}.yaml
tkn -n ${TARGET_NAMESPACE} hub install task golang-${task}
fi
done

kubectl -n ${TARGET_NAMESPACE} apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/git-clone/0.6/git-clone.yaml
kubectl -n ${TARGET_NAMESPACE} apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/goreleaser/0.2/goreleaser.yaml
tkn -n ${TARGET_NAMESPACE} install task git-clone
tkn -n ${TARGET_NAMESPACE} install task goreleaser

kubectl -n ${TARGET_NAMESPACE} apply -f ./tekton/get-version.yaml
kubectl -n ${TARGET_NAMESPACE} apply -f ./tekton/publish.yaml

Expand Down

0 comments on commit 7c7eed3

Please sign in to comment.