From 4ff2b602998dacaf635e9f54b2f3575629ff5193 Mon Sep 17 00:00:00 2001 From: wuhuizuo Date: Mon, 4 Mar 2024 17:26:05 +0800 Subject: [PATCH] feat(pingcap/monitoring): support build for tag creating triggers (#262) For example: run: "./packages/scripts/gen-package-artifacts-with-config.sh monitoring darwin amd64 v7.1.1 release v8.0.0 ''" output: ```bash function build() { export TARGET=release-8.0 export TARGET_OS=darwin TARGET_ARCH=amd64 make grafana_without_pull make default -C ng-monitoring make output/prometheus echo "building finished." } ``` Signed-off-by: wuhuizuo Signed-off-by: wuhuizuo --- packages/packages.yaml.tmpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/packages.yaml.tmpl b/packages/packages.yaml.tmpl index 0416a8a7..8289382b 100644 --- a/packages/packages.yaml.tmpl +++ b/packages/packages.yaml.tmpl @@ -151,8 +151,8 @@ components: profile: [release] steps: release: - - script: |- - export TARGET={{ .Git.ref }} + - script: |- + export TARGET={{ if strings.HasPrefix "v" .Git.ref }}{{ printf "release-%d.%d" (semver.Semver .Git.ref).Major (semver.Semver .Git.ref).Minor }}{{ else }}{{ .Git.ref }}{{ end }} export TARGET_OS={{ .Release.os }} TARGET_ARCH={{ .Release.arch }} make grafana_without_pull make default -C ng-monitoring @@ -188,7 +188,7 @@ components: steps: release: - script: |- - export TARGET={{ .Git.ref }} + export TARGET={{ if strings.HasPrefix "v" .Git.ref }}{{ printf "release-%d.%d" (semver.Semver .Git.ref).Major (semver.Semver .Git.ref).Minor }}{{ else }}{{ .Git.ref }}{{ end }} export TARGET_OS={{ .Release.os }} TARGET_ARCH={{ .Release.arch }} go run ./cmd/monitoring.go --config=monitoring.yaml --tag={{ .Git.ref }} make default -C ng-monitoring @@ -213,7 +213,7 @@ components: steps: release: - script: |- - export TARGET={{ .Git.ref }} + export TARGET={{ if strings.HasPrefix "v" .Git.ref }}{{ printf "release-%d.%d" (semver.Semver .Git.ref).Major (semver.Semver .Git.ref).Minor }}{{ else }}{{ .Git.ref }}{{ end }} export TARGET_OS={{ .Release.os }} TARGET_ARCH={{ .Release.arch }} go run ./cmd/monitoring.go --config=monitoring.yaml --tag={{ .Git.ref }} make output/prometheus