From 705c24e8bc2df1b4da59fada3f446bf95c6ecdb2 Mon Sep 17 00:00:00 2001 From: Andrew Pantuso Date: Mon, 7 Mar 2022 13:32:45 -0500 Subject: [PATCH] refactoring ci --- .goreleaser.yaml | 1 + build_tag.sh | 9 ++------- cicd/jenkins_env.sh | 8 ++++++++ magefile.go | 3 ++- pr_check.sh | 10 ++-------- 5 files changed, 15 insertions(+), 16 deletions(-) create mode 100644 cicd/jenkins_env.sh diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 3e914465..938e5243 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -35,5 +35,6 @@ changelog: order: 999 filters: exclude: + - Merge pull request - '^docs:' - '^test:' diff --git a/build_tag.sh b/build_tag.sh index 66fb5c86..4b367e04 100755 --- a/build_tag.sh +++ b/build_tag.sh @@ -2,11 +2,6 @@ set -exvo pipefail -o nounset -# utilize local go 1.17 version if available -GO_1_17="/opt/go/1.17.5/bin" +source "${PWD}/cicd/jenkins_env.sh" -if [ -d "${GO_1_17}" ]; then - PATH="${GO_1_17}:${PATH}" -fi - -echo "$(curl -sL https://git.io/goreleaser) --rm-dist" | bash +./mage release diff --git a/cicd/jenkins_env.sh b/cicd/jenkins_env.sh new file mode 100644 index 00000000..9662510f --- /dev/null +++ b/cicd/jenkins_env.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# utilize local go 1.17 version if available +GO_1_17="/opt/go/1.17.7/bin" + +if [ -d "${GO_1_17}" ]; then + PATH="${GO_1_17}:${PATH}" +fi diff --git a/magefile.go b/magefile.go index ac635bc0..61972bfc 100644 --- a/magefile.go +++ b/magefile.go @@ -20,6 +20,7 @@ var Aliases = map[string]interface{}{ "clean": All.Clean, "test": All.Test, "install": Build.Install, + "release": Release.Full, } type All mg.Namespace @@ -238,7 +239,7 @@ func (Release) Full() error { Release.Clean, ) - return sh.Run(path.Join(_depBin, "goreleaser"), "release") + return sh.Run(path.Join(_depBin, "goreleaser"), "release", "--rm-dist") } // Generates release artifacts locally. diff --git a/pr_check.sh b/pr_check.sh index 35da60a8..13529795 100755 --- a/pr_check.sh +++ b/pr_check.sh @@ -2,12 +2,6 @@ set -exvo pipefail -o nounset -# utilize local go 1.17 version if available -GO_1_17="/opt/go/1.17.5/bin" +source "${PWD}/cicd/jenkins_env.sh" -if [ -d "${GO_1_17}" ]; then - PATH="${GO_1_17}:${PATH}" -fi - -./mage -t 10m check -./mage -t 10m test +./mage -t 10m check && ./mage -t 10m test