From 80a0e788a9ebeeb7dfa994ec3b0e75cc9b5aa843 Mon Sep 17 00:00:00 2001 From: wuhuizuo Date: Wed, 4 Mar 2026 09:23:24 +0800 Subject: [PATCH 1/7] feat(packages): add support for configurable git url in package templates The commit adds support for configurable Git URLs in package templates by: 1. Adding `.Git.url` to the list of available template variables in README.md 2. Updating all package components to use the new `.Git.url` template variable with default values 3. Modifying build scripts to support passing a custom Git URL 4. Adding default Git URLs for image source labels in build scripts This change allows for more flexible configuration of Git repository URLs in the package generation process. --- packages/README.md | 1 + packages/packages.yaml.tmpl | 38 +++++++++---------- .../scripts/build-package-artifacts.sh.tmpl | 2 +- packages/scripts/build-package-images.sh.tmpl | 2 +- .../gen-package-artifacts-with-config.sh | 4 ++ .../scripts/gen-package-images-with-config.sh | 4 ++ 6 files changed, 30 insertions(+), 21 deletions(-) diff --git a/packages/README.md b/packages/README.md index e06202ef..fe91bda3 100644 --- a/packages/README.md +++ b/packages/README.md @@ -37,6 +37,7 @@ You can get them by run: $ grep -oE "{{\s*\..*?}}" packages/packages.yaml.tmpl | grep -oE "\.\w+(\.\w+)*" | sort -u .Git.ref .Git.sha +.Git.url .Release.arch .Release.os .Release.version diff --git a/packages/packages.yaml.tmpl b/packages/packages.yaml.tmpl index 940a6280..eb9ea7c5 100644 --- a/packages/packages.yaml.tmpl +++ b/packages/packages.yaml.tmpl @@ -26,7 +26,7 @@ components: advanced-statefulset: desc: git: - url: https://github.com/pingcap/advanced-statefulset.git + url: '{{ .Git.url | default "https://github.com/pingcap/advanced-statefulset.git" }}' ref: '{{ .Git.ref | default "master" }}' sha: '{{ .Git.sha | default "" }}' version: {{ .Release.version }} # segment version. @@ -56,7 +56,7 @@ components: ctl: desc: ctl components git: - url: https://github.com/pingcap/tidb.git + url: '{{ .Git.url | default "https://github.com/pingcap/tidb.git" }}' ref: {{ .Git.ref | default "master" }} sha: '{{ .Git.sha | default "" }}' version: {{ .Release.version }} # segment version. @@ -263,7 +263,7 @@ components: monitoring: desc: git: - url: https://github.com/pingcap/monitoring.git + url: '{{ .Git.url | default "https://github.com/pingcap/monitoring.git" }}' ref: '{{ .Git.ref | default "master" }}' sha: '{{ .Git.sha | default "" }}' version: {{ .Release.version }} # segment version. @@ -420,7 +420,7 @@ components: ng-monitoring: desc: ng-monitoring component git: - url: https://github.com/pingcap/ng-monitoring.git + url: '{{ .Git.url | default "https://github.com/pingcap/ng-monitoring.git" }}' ref: {{ .Git.ref | default "master" }} sha: {{ .Git.sha | default "" }} version: {{ .Release.version }} # segment version. @@ -544,7 +544,7 @@ components: pd: desc: pd server component tarball git: - url: https://github.com/tikv/pd.git + url: '{{ .Git.url | default "https://github.com/tikv/pd.git" }}' ref: {{ .Git.ref | default "master" }} sha: {{ .Git.sha | default "" }} version: {{ .Release.version }} # segment version. @@ -891,7 +891,7 @@ components: tidb: desc: tidb server component tarball git: - url: https://github.com/pingcap/tidb.git + url: '{{ .Git.url | default "https://github.com/pingcap/tidb.git" }}' ref: {{ .Git.ref | default "master" }} sha: {{ .Git.sha | default "" }} version: {{ .Release.version }} # segment version. @@ -1368,7 +1368,7 @@ components: tidb-tools: desc: tidb tools component tarball git: - url: https://github.com/pingcap/tidb-tools.git + url: '{{ .Git.url | default "https://github.com/pingcap/tidb-tools.git" }}' ref: {{ .Git.ref | default "master" }} sha: {{ .Git.sha | default "" }} version: {{ .Release.version }} # segment version. @@ -1416,7 +1416,7 @@ components: tidb-ctl: desc: tidb ctl component tarball git: - url: https://github.com/pingcap/tidb-ctl.git + url: '{{ .Git.url | default "https://github.com/pingcap/tidb-ctl.git" }}' ref: {{ .Git.ref | default "master" }} sha: {{ .Git.sha | default "" }} version: {{ .Release.version }} # segment version. @@ -1455,7 +1455,7 @@ components: [Deprecated] Delcared Deprecation in v8.3.0, removed in v8.4.0 tidb binlog component tarball git: - url: https://github.com/pingcap/tidb-binlog.git + url: '{{ .Git.url | default "https://github.com/pingcap/tidb-binlog.git" }}' ref: {{ .Git.ref | default "master" }} sha: {{ .Git.sha | default "" }} version: {{ .Release.version }} # segment version. @@ -1545,7 +1545,7 @@ components: tidb-operator: desc: tidb opreator component tarball git: - url: https://github.com/pingcap/tidb-operator.git + url: '{{ .Git.url | default "https://github.com/pingcap/tidb-operator.git" }}' ref: {{ .Git.ref | default "master" }} sha: {{ .Git.sha | default "" }} version: {{ .Release.version }} # segment version. @@ -1717,7 +1717,7 @@ components: tidb-dashboard: desc: '' git: - url: https://github.com/pingcap/tidb-dashboard.git + url: '{{ .Git.url | default "https://github.com/pingcap/tidb-dashboard.git" }}' ref: {{ .Git.ref | default "master" }} sha: {{ .Git.sha | default "" }} version: {{ .Release.version }} # segment version. @@ -1844,7 +1844,7 @@ components: tiflash: desc: tiflash components tarball git: - url: https://github.com/pingcap/tiflash.git + url: '{{ .Git.url | default "https://github.com/pingcap/tiflash.git" }}' ref: {{ .Git.ref | default "master" }} sha: {{ .Git.sha | default "" }} version: {{ .Release.version }} # segment version. @@ -2196,7 +2196,7 @@ components: tiflow: desc: tiflow components git: - url: https://github.com/pingcap/tiflow.git + url: '{{ .Git.url | default "https://github.com/pingcap/tiflow.git" }}' ref: {{ .Git.ref | default "master" }} sha: {{ .Git.sha | default "" }} version: {{ .Release.version }} # segment version. @@ -2739,7 +2739,7 @@ components: ticdc: desc: ticdc components git: - url: https://github.com/pingcap/ticdc.git + url: '{{ .Git.url | default "https://github.com/pingcap/ticdc.git" }}' ref: {{ .Git.ref | default "master" }} sha: {{ .Git.sha | default "" }} version: {{ .Release.version }} # segment version. @@ -2816,7 +2816,7 @@ components: tiflow-operator: desc: tiflow operator components tarball git: - url: https://github.com/pingcap/tiflow-operator.git + url: '{{ .Git.url | default "https://github.com/pingcap/tiflow-operator.git" }}' ref: {{ .Git.ref | default "master" }} sha: {{ .Git.sha | default "" }} version: {{ .Release.version }} # segment version. @@ -2848,7 +2848,7 @@ components: tikv: desc: tikv components tarball git: - url: https://github.com/tikv/tikv.git + url: '{{ .Git.url | default "https://github.com/tikv/tikv.git" }}' ref: {{ .Git.ref | default "master" }} sha: {{ .Git.sha | default "" }} version: {{ .Release.version }} # segment version. @@ -3096,7 +3096,7 @@ components: tiproxy: desc: tiproxy components tarballs and images git: - url: https://github.com/pingcap/tiproxy.git + url: '{{ .Git.url | default "https://github.com/pingcap/tiproxy.git" }}' ref: {{ .Git.ref | default "main" }} sha: {{ .Git.sha | default "" }} version: {{ .Release.version }} # segment version. @@ -3148,7 +3148,7 @@ components: desc: tici components tarballs and images git: # In the future, the repo will be open source in the `pingcap` ORG. - url: https://github.com/pingcap-inc/tici.git + url: '{{ .Git.url | default "https://github.com/pingcap-inc/tici.git" }}' ref: {{ .Git.ref | default "main" }} sha: {{ .Git.sha | default "" }} version: {{ .Release.version }} # segment version. @@ -3195,7 +3195,7 @@ components: desc: tiup components tarballs and images git: # In the future, the repo will be open source in the `pingcap` ORG. - url: https://github.com/pingcap/tiup.git + url: '{{ .Git.url | default "https://github.com/pingcap/tiup.git" }}' ref: {{ .Git.ref | default "main" }} sha: {{ .Git.sha | default "" }} version: {{ .Release.version }} # segment version. diff --git a/packages/scripts/build-package-artifacts.sh.tmpl b/packages/scripts/build-package-artifacts.sh.tmpl index e29a695e..2037cd53 100644 --- a/packages/scripts/build-package-artifacts.sh.tmpl +++ b/packages/scripts/build-package-artifacts.sh.tmpl @@ -250,7 +250,7 @@ function prepare_artifact_config() { .["org.opencontainers.image.version"] = "{{ .version }}" | .["org.opencontainers.image.title"] = "{{ .component }}" | .["org.opencontainers.image.licenses"] = "{{ .license | default "Apache-2.0" }}" | - .["org.opencontainers.image.source"] = "{{ .git.url }}" | + .["org.opencontainers.image.source"] = "{{ .git.url | default "https://github.com/unknown/unknown.git" }}" | .["org.opencontainers.image.ref.name"] = "{{ .git.ref }}" | .["org.opencontainers.image.revision"] = "{{ .git.sha }}" | .["net.pingcap.tibuild.os"] = "{{ .os }}" | diff --git a/packages/scripts/build-package-images.sh.tmpl b/packages/scripts/build-package-images.sh.tmpl index 4f170221..2424a837 100644 --- a/packages/scripts/build-package-images.sh.tmpl +++ b/packages/scripts/build-package-images.sh.tmpl @@ -158,7 +158,7 @@ build_and_push_images() { {{ end }} kaniko_global_options="$kaniko_global_options --label org.opencontainers.image.title={{ .component }}" kaniko_global_options="$kaniko_global_options --label org.opencontainers.image.licenses={{ .license | default "Apache-2.0" }}" - kaniko_global_options="$kaniko_global_options --label org.opencontainers.image.source={{ .git.url }}" + kaniko_global_options="$kaniko_global_options --label org.opencontainers.image.source={{ .git.url | default "https://github.com/unknown/unknown.git" }}" kaniko_global_options="$kaniko_global_options --label org.opencontainers.image.ref.name={{ .git.ref }}" {{ if .git.sha }} kaniko_global_options="$kaniko_global_options --label org.opencontainers.image.revision={{ .git.sha }}" diff --git a/packages/scripts/gen-package-artifacts-with-config.sh b/packages/scripts/gen-package-artifacts-with-config.sh index 6f0e12fd..ea142c4e 100755 --- a/packages/scripts/gen-package-artifacts-with-config.sh +++ b/packages/scripts/gen-package-artifacts-with-config.sh @@ -15,6 +15,7 @@ function main() { local template_file="${8:-${PROJECT_ROOT_DIR}/packages/packages.yaml.tmpl}" local out_file="${9:-${RELEASE_SCRIPTS_DIR}/build-package-artifacts.sh}" local registry="${10:-hub.pingcap.net}" + local git_url="${11:-}" local target_info="component: $component, os: $os, arch: $arch, version: $version, profile: $profile" # prepare template file's context. @@ -26,6 +27,9 @@ function main() { yq -i ".Release.registry = \"$registry\"" release-context.yaml yq -i ".Git.ref = \"$git_ref\"" release-context.yaml yq -i ".Git.sha = \"$git_sha\"" release-context.yaml + if [ -n "$git_url" ]; then + yq -i ".Git.url = \"$git_url\"" release-context.yaml + fi gomplate --context .=release-context.yaml -f "$template_file" --out release-packages.yaml yq ".components[\"${component}\"]" release-packages.yaml >release-package.yaml diff --git a/packages/scripts/gen-package-images-with-config.sh b/packages/scripts/gen-package-images-with-config.sh index 6263880b..cd73aa54 100755 --- a/packages/scripts/gen-package-images-with-config.sh +++ b/packages/scripts/gen-package-images-with-config.sh @@ -15,6 +15,7 @@ function main() { local template_file="${8:-${PROJECT_ROOT_DIR}/packages/packages.yaml.tmpl}" local out_file="${9:-${RELEASE_SCRIPTS_DIR}/build-package-images.sh}" local registry="${10:-hub.pingcap.net}" + local git_url="${11:-}" local target_info="component: $component, os: $os, arch: $arch, version: $version, profile: $profile" if [ "$os" != "linux" ]; then @@ -31,6 +32,9 @@ function main() { yq -i ".Release.registry = \"$registry\"" release-context.yaml yq -i ".Git.ref = \"$git_ref\"" release-context.yaml yq -i ".Git.sha = \"$git_sha\"" release-context.yaml + if [ -n "$git_url" ]; then + yq -i ".Git.url = \"$git_url\"" release-context.yaml + fi gomplate --context .=release-context.yaml -f "$template_file" --out release-packages.yaml yq ".components[\"${component}\"]" release-packages.yaml >release-package.yaml From 8f82c61c2416471a55f7c9bd796542ff182212e6 Mon Sep 17 00:00:00 2001 From: wuhuizuo Date: Wed, 4 Mar 2026 09:25:27 +0800 Subject: [PATCH 2/7] chore(package): update default registry to pingcap-testing-account --- packages/scripts/gen-package-artifacts-with-config.sh | 2 +- packages/scripts/gen-package-images-with-config.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/scripts/gen-package-artifacts-with-config.sh b/packages/scripts/gen-package-artifacts-with-config.sh index ea142c4e..6a36f8a0 100755 --- a/packages/scripts/gen-package-artifacts-with-config.sh +++ b/packages/scripts/gen-package-artifacts-with-config.sh @@ -14,7 +14,7 @@ function main() { local git_sha=$7 local template_file="${8:-${PROJECT_ROOT_DIR}/packages/packages.yaml.tmpl}" local out_file="${9:-${RELEASE_SCRIPTS_DIR}/build-package-artifacts.sh}" - local registry="${10:-hub.pingcap.net}" + local registry="${10:-us-docker.pkg.dev/pingcap-testing-account/hub}" local git_url="${11:-}" local target_info="component: $component, os: $os, arch: $arch, version: $version, profile: $profile" diff --git a/packages/scripts/gen-package-images-with-config.sh b/packages/scripts/gen-package-images-with-config.sh index cd73aa54..385b44aa 100755 --- a/packages/scripts/gen-package-images-with-config.sh +++ b/packages/scripts/gen-package-images-with-config.sh @@ -14,7 +14,7 @@ function main() { local git_sha=$7 local template_file="${8:-${PROJECT_ROOT_DIR}/packages/packages.yaml.tmpl}" local out_file="${9:-${RELEASE_SCRIPTS_DIR}/build-package-images.sh}" - local registry="${10:-hub.pingcap.net}" + local registry="${10:-us-docker.pkg.dev/pingcap-testing-account/hub}" local git_url="${11:-}" local target_info="component: $component, os: $os, arch: $arch, version: $version, profile: $profile" From 2c9c47d3cd35380d185a221d71cb4d0dcb1ef5e6 Mon Sep 17 00:00:00 2001 From: wuhuizuo Date: Wed, 4 Mar 2026 09:33:21 +0800 Subject: [PATCH 3/7] fix(ci): add default git url to ci script add default git url to ci script and update package scripts to always set git url --- .github/scripts/ci.sh | 54 ++++++++++--------- .../gen-package-artifacts-with-config.sh | 4 +- .../scripts/gen-package-images-with-config.sh | 4 +- .../get-package-builder-with-config.sh | 1 + 4 files changed, 31 insertions(+), 32 deletions(-) diff --git a/.github/scripts/ci.sh b/.github/scripts/ci.sh index b59d96e7..29347ac0 100755 --- a/.github/scripts/ci.sh +++ b/.github/scripts/ci.sh @@ -1,6 +1,8 @@ #! /usr/bin/env bash set -euo pipefail +readonly DEFAULT_GIT_URL="https://github.com/pingcap/tidb.git" + function check_image_existed() { local img=$1 # skip the check if the image starts with "hub.pingcap.net" which is the internal image. @@ -34,7 +36,7 @@ function test_get_builder() { for os in $operating_systems; do for ac in $architectures; do echo -en "[🚢] $cm $os $ac $version $profile:\t" - img=$($script "$cm" "$os" "$ac" "$version" "$profile") + img=$($script "$cm" "$os" "$ac" "$version" "$profile" "" "" "$DEFAULT_GIT_URL") echo $img check_image_existed $img done @@ -49,7 +51,7 @@ function test_get_builder() { for os in $operating_systems; do for ac in $architectures; do echo -en "[🚢] $cm $os $ac $version $profile:\t" - img=$($script "$cm" "$os" "$ac" "$version" "$profile") + img=$($script "$cm" "$os" "$ac" "$version" "$profile" "" "" "$DEFAULT_GIT_URL") echo $img check_image_existed $img done @@ -63,7 +65,7 @@ function test_get_builder() { for os in $operating_systems; do for ac in $architectures; do echo -en "[🚢] $cm $os $ac $version enterprise:\t" - img=$($script "$cm" "$os" "$ac" "$version" enterprise) + img=$($script "$cm" "$os" "$ac" "$version" enterprise "" "" "$DEFAULT_GIT_URL") echo $img check_image_existed $img done @@ -80,7 +82,7 @@ function test_get_builder() { for os in $operating_systems; do for ac in $architectures; do echo -en "[🚢] $cm $os $ac $version $profile:\t" - img=$($script "$cm" "$os" "$ac" "$version" $profile) + img=$($script "$cm" "$os" "$ac" "$version" $profile "" "" "$DEFAULT_GIT_URL") echo $img check_image_existed $img done @@ -102,7 +104,7 @@ function test_get_builder_freedom_releasing() { for ac in $architectures; do for version in v2.0.0 v1.6.0 v1.5.0; do echo -en "[🚢] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile + $script "$cm" "$os" "$ac" "$version" $profile "" "" "$DEFAULT_GIT_URL" done done @@ -113,7 +115,7 @@ function test_get_builder_freedom_releasing() { for ac in $architectures; do for version in v6.4.0-20221102-1667359250 v20221018; do echo -en "[🚢] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile + $script "$cm" "$os" "$ac" "$version" $profile "" "" "$DEFAULT_GIT_URL" done done @@ -123,7 +125,7 @@ function test_get_builder_freedom_releasing() { for ac in $architectures; do for version in v0.5.0 v0.6.0; do echo -en "[🚢] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile + $script "$cm" "$os" "$ac" "$version" $profile "" "" "$DEFAULT_GIT_URL" done done @@ -133,7 +135,7 @@ function test_get_builder_freedom_releasing() { for ac in $architectures; do for version in v0.1.2 v0.1.3; do echo -en "[🚢] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile + $script "$cm" "$os" "$ac" "$version" $profile "" "" "$DEFAULT_GIT_URL" done done done @@ -144,7 +146,7 @@ function test_get_builder_freedom_releasing() { for ac in $architectures; do for version in v0.1.0 v0.2.0; do echo -en "[🚢] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile + $script "$cm" "$os" "$ac" "$version" $profile "" "" "$DEFAULT_GIT_URL" done done done @@ -169,7 +171,7 @@ function test_gen_package_artifacts_script() { for os in $operating_systems; do for ac in $architectures; do echo -en "[📃📦] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef + $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-artifacts.sh done done @@ -184,7 +186,7 @@ function test_gen_package_artifacts_script() { for os in $operating_systems; do for ac in $architectures; do echo -en "[📃📦] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" enterprise branch-xxx 123456789abcdef + $script "$cm" "$os" "$ac" "$version" enterprise branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-artifacts.sh done done @@ -199,7 +201,7 @@ function test_gen_package_artifacts_script() { for os in $operating_systems; do for ac in $architectures; do echo -en "[📃📦] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" failpoint branch-xxx 123456789abcdef + $script "$cm" "$os" "$ac" "$version" failpoint branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-artifacts.sh done done @@ -215,7 +217,7 @@ function test_gen_package_artifacts_script() { for os in $operating_systems; do for ac in $architectures; do echo -en "[📃📦] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef + $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-artifacts.sh done done @@ -236,7 +238,7 @@ function test_gen_package_artifacts_script_freedom_releasing() { for ac in $architectures; do for version in v2.0.0 v1.6.0 v1.5.0; do echo -en "[📃📦] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef + $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-artifacts.sh done done @@ -247,7 +249,7 @@ function test_gen_package_artifacts_script_freedom_releasing() { for ac in $architectures; do for version in v6.4.0-20221102-1667359250 v20221018; do echo -en "[📃📦] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef + $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-artifacts.sh done done @@ -258,7 +260,7 @@ function test_gen_package_artifacts_script_freedom_releasing() { for ac in $architectures; do for version in v0.5.0 v0.6.0; do echo -en "[📃📦] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef + $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-artifacts.sh done done @@ -269,7 +271,7 @@ function test_gen_package_artifacts_script_freedom_releasing() { for ac in $architectures; do for version in v0.1.2 v0.1.3; do echo -en "[📃📦] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef + $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-artifacts.sh done done @@ -280,7 +282,7 @@ function test_gen_package_artifacts_script_freedom_releasing() { for ac in $architectures; do for version in v0.1.0 v0.2.0; do echo -en "[📃📦] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef + $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-artifacts.sh done done @@ -304,7 +306,7 @@ function test_gen_package_images_script() { fi for ac in $architectures; do echo -en "[📃💿] $cm $os $ac $version $profile:\t" - $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef + $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-images.sh done done @@ -317,7 +319,7 @@ function test_gen_package_images_script() { for version in $versions; do for ac in $architectures; do echo -en "[📃💿] $cm $os $ac $version $profile:\t" - $script $cm $os $ac $version $profile branch-xxx 123456789abcdef + $script $cm $os $ac $version $profile branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-images.sh done done @@ -331,7 +333,7 @@ function test_gen_package_images_script() { for version in $versions; do for ac in $architectures; do echo -en "[📃💿] $cm $os $ac $version $profile:\t" - $script $cm $os $ac $version $profile branch-xxx 123456789abcdef + $script $cm $os $ac $version $profile branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-images.sh done done @@ -350,7 +352,7 @@ function test_gen_package_images_script_freedom_releasing() { for ac in $architectures; do for version in v2.0.0 v1.6.0 v1.5.0; do echo -en "[📃💿] $cm $os $ac $version $profile:\t" - $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef + $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-images.sh done done @@ -360,7 +362,7 @@ function test_gen_package_images_script_freedom_releasing() { for ac in $architectures; do for version in v6.4.0-20221102-1667359250 v20221018; do echo -en "[📃💿] $cm $os $ac $version $profile:\t" - $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef + $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-images.sh done done @@ -370,7 +372,7 @@ function test_gen_package_images_script_freedom_releasing() { for version in v0.5.0 v0.6.0; do for ac in $architectures; do echo -en "[📃💿] $cm $os $ac $version $profile:\t" - $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef + $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-images.sh done done @@ -380,7 +382,7 @@ function test_gen_package_images_script_freedom_releasing() { for ac in $architectures; do for version in v0.1.2 v0.1.3; do echo -en "[📃💿] $cm $os $ac $version $profile:\t" - $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef + $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-images.sh done done @@ -390,7 +392,7 @@ function test_gen_package_images_script_freedom_releasing() { for version in v0.1.0 v0.2.0; do for ac in $architectures; do echo -en "[📃💿] $cm $os $ac $version $profile:\t" - $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef + $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-images.sh done done diff --git a/packages/scripts/gen-package-artifacts-with-config.sh b/packages/scripts/gen-package-artifacts-with-config.sh index 6a36f8a0..1d2ebff9 100755 --- a/packages/scripts/gen-package-artifacts-with-config.sh +++ b/packages/scripts/gen-package-artifacts-with-config.sh @@ -27,9 +27,7 @@ function main() { yq -i ".Release.registry = \"$registry\"" release-context.yaml yq -i ".Git.ref = \"$git_ref\"" release-context.yaml yq -i ".Git.sha = \"$git_sha\"" release-context.yaml - if [ -n "$git_url" ]; then - yq -i ".Git.url = \"$git_url\"" release-context.yaml - fi + yq -i ".Git.url = \"$git_url\"" release-context.yaml gomplate --context .=release-context.yaml -f "$template_file" --out release-packages.yaml yq ".components[\"${component}\"]" release-packages.yaml >release-package.yaml diff --git a/packages/scripts/gen-package-images-with-config.sh b/packages/scripts/gen-package-images-with-config.sh index 385b44aa..3242aba8 100755 --- a/packages/scripts/gen-package-images-with-config.sh +++ b/packages/scripts/gen-package-images-with-config.sh @@ -32,9 +32,7 @@ function main() { yq -i ".Release.registry = \"$registry\"" release-context.yaml yq -i ".Git.ref = \"$git_ref\"" release-context.yaml yq -i ".Git.sha = \"$git_sha\"" release-context.yaml - if [ -n "$git_url" ]; then - yq -i ".Git.url = \"$git_url\"" release-context.yaml - fi + yq -i ".Git.url = \"$git_url\"" release-context.yaml gomplate --context .=release-context.yaml -f "$template_file" --out release-packages.yaml yq ".components[\"${component}\"]" release-packages.yaml >release-package.yaml diff --git a/packages/scripts/get-package-builder-with-config.sh b/packages/scripts/get-package-builder-with-config.sh index a3fd94eb..c56ef8e4 100755 --- a/packages/scripts/get-package-builder-with-config.sh +++ b/packages/scripts/get-package-builder-with-config.sh @@ -23,6 +23,7 @@ function main() { yq -i '.Release.registry = "localhost"' release-context.yaml yq -i '.Git.ref = ""' release-context.yaml yq -i '.Git.sha = ""' release-context.yaml + yq -i '.Git.url = ""' release-context.yaml gomplate --context .=release-context.yaml -f "$template_file" --out release-packages.yaml yq ".components[\"${component}\"]" release-packages.yaml >release-package.yaml From 12fea3adb794c61a93ddd93600ce2f8125e65c91 Mon Sep 17 00:00:00 2001 From: wuhuizuo Date: Wed, 4 Mar 2026 09:48:54 +0800 Subject: [PATCH 4/7] fix(ci): remove default git url from ci script This change removes the hardcoded default Git URL from the CI script, allowing each component to use its own default repository URL instead. This makes the script more flexible and component-specific. --- .github/scripts/ci.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/scripts/ci.sh b/.github/scripts/ci.sh index 29347ac0..7cd8036f 100755 --- a/.github/scripts/ci.sh +++ b/.github/scripts/ci.sh @@ -1,7 +1,8 @@ #! /usr/bin/env bash set -euo pipefail -readonly DEFAULT_GIT_URL="https://github.com/pingcap/tidb.git" +# Keep empty so each component uses its own default repository URL. +readonly DEFAULT_GIT_URL="" function check_image_existed() { local img=$1 From 6b8616b4b6bb601cd07cde938d1017999c337c89 Mon Sep 17 00:00:00 2001 From: wuhuizuo Date: Wed, 4 Mar 2026 09:54:42 +0800 Subject: [PATCH 5/7] fix(packages): harden git url handling in templates --- packages/scripts/build-package-artifacts.sh.tmpl | 8 +++++++- packages/scripts/build-package-images.sh.tmpl | 6 +++++- packages/scripts/get-package-builder-with-config.sh | 3 ++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/packages/scripts/build-package-artifacts.sh.tmpl b/packages/scripts/build-package-artifacts.sh.tmpl index 2037cd53..79406291 100644 --- a/packages/scripts/build-package-artifacts.sh.tmpl +++ b/packages/scripts/build-package-artifacts.sh.tmpl @@ -243,6 +243,12 @@ function archive() { {{ if has .artifactory "package_repo" -}} function prepare_artifact_config() { local save_file="$1" + local source_url + + source_url="${GIT_URL:-$(cat <<'EOF' +{{ .git.url | default "https://github.com/unknown/unknown.git" }} +EOF +)}" :> "$save_file" # Inject OCI standard metadata labels and PingCAP build labels. @@ -250,7 +256,6 @@ function prepare_artifact_config() { .["org.opencontainers.image.version"] = "{{ .version }}" | .["org.opencontainers.image.title"] = "{{ .component }}" | .["org.opencontainers.image.licenses"] = "{{ .license | default "Apache-2.0" }}" | - .["org.opencontainers.image.source"] = "{{ .git.url | default "https://github.com/unknown/unknown.git" }}" | .["org.opencontainers.image.ref.name"] = "{{ .git.ref }}" | .["org.opencontainers.image.revision"] = "{{ .git.sha }}" | .["net.pingcap.tibuild.os"] = "{{ .os }}" | @@ -259,6 +264,7 @@ function prepare_artifact_config() { .["net.pingcap.tibuild.git-sha"] = "{{ .git.sha }}" | .["net.pingcap.tibuild.tiup"] = [] ' "$save_file" + SOURCE_URL="$source_url" yq -p json -o json -i '.["org.opencontainers.image.source"] = strenv(SOURCE_URL)' "$save_file" {{- if has (coll.Slice "release" "next-gen") .profile }} {{- range (.artifacts | jq `map(select((.type == "file" or .type == null) and .if != false and .tiup != null))`) }} diff --git a/packages/scripts/build-package-images.sh.tmpl b/packages/scripts/build-package-images.sh.tmpl index 2424a837..51b91b29 100644 --- a/packages/scripts/build-package-images.sh.tmpl +++ b/packages/scripts/build-package-images.sh.tmpl @@ -147,6 +147,10 @@ build_and_push_images() { release_ws="$1" digests_file="$2" kaniko_executor="$3" + source_url="${GIT_URL:-$(cat <<'EOF' +{{ .git.url | default "https://github.com/unknown/unknown.git" }} +EOF +)}" ################# build and push image ################ tag="{{ index $tags 0 }}" @@ -158,7 +162,7 @@ build_and_push_images() { {{ end }} kaniko_global_options="$kaniko_global_options --label org.opencontainers.image.title={{ .component }}" kaniko_global_options="$kaniko_global_options --label org.opencontainers.image.licenses={{ .license | default "Apache-2.0" }}" - kaniko_global_options="$kaniko_global_options --label org.opencontainers.image.source={{ .git.url | default "https://github.com/unknown/unknown.git" }}" + kaniko_global_options="$kaniko_global_options --label org.opencontainers.image.source=${source_url}" kaniko_global_options="$kaniko_global_options --label org.opencontainers.image.ref.name={{ .git.ref }}" {{ if .git.sha }} kaniko_global_options="$kaniko_global_options --label org.opencontainers.image.revision={{ .git.sha }}" diff --git a/packages/scripts/get-package-builder-with-config.sh b/packages/scripts/get-package-builder-with-config.sh index c56ef8e4..9739aa1a 100755 --- a/packages/scripts/get-package-builder-with-config.sh +++ b/packages/scripts/get-package-builder-with-config.sh @@ -12,6 +12,7 @@ function main() { local profile=$5 local template_file="${6:-${PROJECT_ROOT_DIR}/packages/packages.yaml.tmpl}" local out_file="${7:-build-package-builder.txt}" + local git_url="${8:-}" local target_info="component: $component, os: $os, arch: $arch, version: $version, profile: $profile" # prepare template file's context. @@ -23,7 +24,7 @@ function main() { yq -i '.Release.registry = "localhost"' release-context.yaml yq -i '.Git.ref = ""' release-context.yaml yq -i '.Git.sha = ""' release-context.yaml - yq -i '.Git.url = ""' release-context.yaml + yq -i ".Git.url = \"$git_url\"" release-context.yaml gomplate --context .=release-context.yaml -f "$template_file" --out release-packages.yaml yq ".components[\"${component}\"]" release-packages.yaml >release-package.yaml From 54b12218faa2a295cfa819225b6ceadb0b73cdd9 Mon Sep 17 00:00:00 2001 From: wuhuizuo Date: Wed, 4 Mar 2026 10:01:46 +0800 Subject: [PATCH 6/7] fix(ci): address review feedback for git url arguments --- .github/scripts/ci.sh | 52 +++++++++---------- .../gen-package-artifacts-with-config.sh | 16 +++--- .../scripts/gen-package-images-with-config.sh | 16 +++--- .../get-package-builder-with-config.sh | 10 ++-- 4 files changed, 47 insertions(+), 47 deletions(-) diff --git a/.github/scripts/ci.sh b/.github/scripts/ci.sh index 7cd8036f..75dd86a2 100755 --- a/.github/scripts/ci.sh +++ b/.github/scripts/ci.sh @@ -37,7 +37,7 @@ function test_get_builder() { for os in $operating_systems; do for ac in $architectures; do echo -en "[🚢] $cm $os $ac $version $profile:\t" - img=$($script "$cm" "$os" "$ac" "$version" "$profile" "" "" "$DEFAULT_GIT_URL") + img=$($script "$cm" "$os" "$ac" "$version" "$profile" "./packages/packages.yaml.tmpl" "build-package-builder.txt" "$DEFAULT_GIT_URL") echo $img check_image_existed $img done @@ -52,7 +52,7 @@ function test_get_builder() { for os in $operating_systems; do for ac in $architectures; do echo -en "[🚢] $cm $os $ac $version $profile:\t" - img=$($script "$cm" "$os" "$ac" "$version" "$profile" "" "" "$DEFAULT_GIT_URL") + img=$($script "$cm" "$os" "$ac" "$version" "$profile" "./packages/packages.yaml.tmpl" "build-package-builder.txt" "$DEFAULT_GIT_URL") echo $img check_image_existed $img done @@ -66,7 +66,7 @@ function test_get_builder() { for os in $operating_systems; do for ac in $architectures; do echo -en "[🚢] $cm $os $ac $version enterprise:\t" - img=$($script "$cm" "$os" "$ac" "$version" enterprise "" "" "$DEFAULT_GIT_URL") + img=$($script "$cm" "$os" "$ac" "$version" enterprise "./packages/packages.yaml.tmpl" "build-package-builder.txt" "$DEFAULT_GIT_URL") echo $img check_image_existed $img done @@ -83,7 +83,7 @@ function test_get_builder() { for os in $operating_systems; do for ac in $architectures; do echo -en "[🚢] $cm $os $ac $version $profile:\t" - img=$($script "$cm" "$os" "$ac" "$version" $profile "" "" "$DEFAULT_GIT_URL") + img=$($script "$cm" "$os" "$ac" "$version" $profile "./packages/packages.yaml.tmpl" "build-package-builder.txt" "$DEFAULT_GIT_URL") echo $img check_image_existed $img done @@ -105,7 +105,7 @@ function test_get_builder_freedom_releasing() { for ac in $architectures; do for version in v2.0.0 v1.6.0 v1.5.0; do echo -en "[🚢] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile "" "" "$DEFAULT_GIT_URL" + $script "$cm" "$os" "$ac" "$version" $profile "./packages/packages.yaml.tmpl" "build-package-builder.txt" "$DEFAULT_GIT_URL" done done @@ -116,7 +116,7 @@ function test_get_builder_freedom_releasing() { for ac in $architectures; do for version in v6.4.0-20221102-1667359250 v20221018; do echo -en "[🚢] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile "" "" "$DEFAULT_GIT_URL" + $script "$cm" "$os" "$ac" "$version" $profile "./packages/packages.yaml.tmpl" "build-package-builder.txt" "$DEFAULT_GIT_URL" done done @@ -126,7 +126,7 @@ function test_get_builder_freedom_releasing() { for ac in $architectures; do for version in v0.5.0 v0.6.0; do echo -en "[🚢] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile "" "" "$DEFAULT_GIT_URL" + $script "$cm" "$os" "$ac" "$version" $profile "./packages/packages.yaml.tmpl" "build-package-builder.txt" "$DEFAULT_GIT_URL" done done @@ -136,7 +136,7 @@ function test_get_builder_freedom_releasing() { for ac in $architectures; do for version in v0.1.2 v0.1.3; do echo -en "[🚢] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile "" "" "$DEFAULT_GIT_URL" + $script "$cm" "$os" "$ac" "$version" $profile "./packages/packages.yaml.tmpl" "build-package-builder.txt" "$DEFAULT_GIT_URL" done done done @@ -147,7 +147,7 @@ function test_get_builder_freedom_releasing() { for ac in $architectures; do for version in v0.1.0 v0.2.0; do echo -en "[🚢] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile "" "" "$DEFAULT_GIT_URL" + $script "$cm" "$os" "$ac" "$version" $profile "./packages/packages.yaml.tmpl" "build-package-builder.txt" "$DEFAULT_GIT_URL" done done done @@ -172,7 +172,7 @@ function test_gen_package_artifacts_script() { for os in $operating_systems; do for ac in $architectures; do echo -en "[📃📦] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-artifacts.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-artifacts.sh done done @@ -187,7 +187,7 @@ function test_gen_package_artifacts_script() { for os in $operating_systems; do for ac in $architectures; do echo -en "[📃📦] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" enterprise branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" "$os" "$ac" "$version" enterprise branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-artifacts.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-artifacts.sh done done @@ -202,7 +202,7 @@ function test_gen_package_artifacts_script() { for os in $operating_systems; do for ac in $architectures; do echo -en "[📃📦] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" failpoint branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" "$os" "$ac" "$version" failpoint branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-artifacts.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-artifacts.sh done done @@ -218,7 +218,7 @@ function test_gen_package_artifacts_script() { for os in $operating_systems; do for ac in $architectures; do echo -en "[📃📦] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-artifacts.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-artifacts.sh done done @@ -239,7 +239,7 @@ function test_gen_package_artifacts_script_freedom_releasing() { for ac in $architectures; do for version in v2.0.0 v1.6.0 v1.5.0; do echo -en "[📃📦] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-artifacts.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-artifacts.sh done done @@ -250,7 +250,7 @@ function test_gen_package_artifacts_script_freedom_releasing() { for ac in $architectures; do for version in v6.4.0-20221102-1667359250 v20221018; do echo -en "[📃📦] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-artifacts.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-artifacts.sh done done @@ -261,7 +261,7 @@ function test_gen_package_artifacts_script_freedom_releasing() { for ac in $architectures; do for version in v0.5.0 v0.6.0; do echo -en "[📃📦] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-artifacts.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-artifacts.sh done done @@ -272,7 +272,7 @@ function test_gen_package_artifacts_script_freedom_releasing() { for ac in $architectures; do for version in v0.1.2 v0.1.3; do echo -en "[📃📦] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-artifacts.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-artifacts.sh done done @@ -283,7 +283,7 @@ function test_gen_package_artifacts_script_freedom_releasing() { for ac in $architectures; do for version in v0.1.0 v0.2.0; do echo -en "[📃📦] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-artifacts.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-artifacts.sh done done @@ -307,7 +307,7 @@ function test_gen_package_images_script() { fi for ac in $architectures; do echo -en "[📃💿] $cm $os $ac $version $profile:\t" - $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-images.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-images.sh done done @@ -320,7 +320,7 @@ function test_gen_package_images_script() { for version in $versions; do for ac in $architectures; do echo -en "[📃💿] $cm $os $ac $version $profile:\t" - $script $cm $os $ac $version $profile branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script $cm $os $ac $version $profile branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-images.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-images.sh done done @@ -334,7 +334,7 @@ function test_gen_package_images_script() { for version in $versions; do for ac in $architectures; do echo -en "[📃💿] $cm $os $ac $version $profile:\t" - $script $cm $os $ac $version $profile branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script $cm $os $ac $version $profile branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-images.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-images.sh done done @@ -353,7 +353,7 @@ function test_gen_package_images_script_freedom_releasing() { for ac in $architectures; do for version in v2.0.0 v1.6.0 v1.5.0; do echo -en "[📃💿] $cm $os $ac $version $profile:\t" - $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-images.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-images.sh done done @@ -363,7 +363,7 @@ function test_gen_package_images_script_freedom_releasing() { for ac in $architectures; do for version in v6.4.0-20221102-1667359250 v20221018; do echo -en "[📃💿] $cm $os $ac $version $profile:\t" - $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-images.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-images.sh done done @@ -373,7 +373,7 @@ function test_gen_package_images_script_freedom_releasing() { for version in v0.5.0 v0.6.0; do for ac in $architectures; do echo -en "[📃💿] $cm $os $ac $version $profile:\t" - $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-images.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-images.sh done done @@ -383,7 +383,7 @@ function test_gen_package_images_script_freedom_releasing() { for ac in $architectures; do for version in v0.1.2 v0.1.3; do echo -en "[📃💿] $cm $os $ac $version $profile:\t" - $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-images.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-images.sh done done @@ -393,7 +393,7 @@ function test_gen_package_images_script_freedom_releasing() { for version in v0.1.0 v0.2.0; do for ac in $architectures; do echo -en "[📃💿] $cm $os $ac $version $profile:\t" - $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-images.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-images.sh done done diff --git a/packages/scripts/gen-package-artifacts-with-config.sh b/packages/scripts/gen-package-artifacts-with-config.sh index 1d2ebff9..aecbf74a 100755 --- a/packages/scripts/gen-package-artifacts-with-config.sh +++ b/packages/scripts/gen-package-artifacts-with-config.sh @@ -20,14 +20,14 @@ function main() { # prepare template file's context. : >release-context.yaml - yq -i ".Release.os = \"$os\"" release-context.yaml - yq -i ".Release.arch = \"$arch\"" release-context.yaml - yq -i ".Release.version = \"$version\"" release-context.yaml - yq -i ".Release.profile = \"$profile\"" release-context.yaml - yq -i ".Release.registry = \"$registry\"" release-context.yaml - yq -i ".Git.ref = \"$git_ref\"" release-context.yaml - yq -i ".Git.sha = \"$git_sha\"" release-context.yaml - yq -i ".Git.url = \"$git_url\"" release-context.yaml + RELEASE_OS="$os" yq -i '.Release.os = strenv(RELEASE_OS)' release-context.yaml + RELEASE_ARCH="$arch" yq -i '.Release.arch = strenv(RELEASE_ARCH)' release-context.yaml + RELEASE_VERSION="$version" yq -i '.Release.version = strenv(RELEASE_VERSION)' release-context.yaml + RELEASE_PROFILE="$profile" yq -i '.Release.profile = strenv(RELEASE_PROFILE)' release-context.yaml + RELEASE_REGISTRY="$registry" yq -i '.Release.registry = strenv(RELEASE_REGISTRY)' release-context.yaml + GIT_REF="$git_ref" yq -i '.Git.ref = strenv(GIT_REF)' release-context.yaml + GIT_SHA="$git_sha" yq -i '.Git.sha = strenv(GIT_SHA)' release-context.yaml + GIT_URL="$git_url" yq -i '.Git.url = strenv(GIT_URL)' release-context.yaml gomplate --context .=release-context.yaml -f "$template_file" --out release-packages.yaml yq ".components[\"${component}\"]" release-packages.yaml >release-package.yaml diff --git a/packages/scripts/gen-package-images-with-config.sh b/packages/scripts/gen-package-images-with-config.sh index 3242aba8..99ab4a82 100755 --- a/packages/scripts/gen-package-images-with-config.sh +++ b/packages/scripts/gen-package-images-with-config.sh @@ -25,14 +25,14 @@ function main() { # prepare template file's context. : >release-context.yaml - yq -i ".Release.os = \"$os\"" release-context.yaml - yq -i ".Release.arch = \"$arch\"" release-context.yaml - yq -i ".Release.version = \"$version\"" release-context.yaml - yq -i ".Release.profile = \"$profile\"" release-context.yaml - yq -i ".Release.registry = \"$registry\"" release-context.yaml - yq -i ".Git.ref = \"$git_ref\"" release-context.yaml - yq -i ".Git.sha = \"$git_sha\"" release-context.yaml - yq -i ".Git.url = \"$git_url\"" release-context.yaml + RELEASE_OS="$os" yq -i '.Release.os = strenv(RELEASE_OS)' release-context.yaml + RELEASE_ARCH="$arch" yq -i '.Release.arch = strenv(RELEASE_ARCH)' release-context.yaml + RELEASE_VERSION="$version" yq -i '.Release.version = strenv(RELEASE_VERSION)' release-context.yaml + RELEASE_PROFILE="$profile" yq -i '.Release.profile = strenv(RELEASE_PROFILE)' release-context.yaml + RELEASE_REGISTRY="$registry" yq -i '.Release.registry = strenv(RELEASE_REGISTRY)' release-context.yaml + GIT_REF="$git_ref" yq -i '.Git.ref = strenv(GIT_REF)' release-context.yaml + GIT_SHA="$git_sha" yq -i '.Git.sha = strenv(GIT_SHA)' release-context.yaml + GIT_URL="$git_url" yq -i '.Git.url = strenv(GIT_URL)' release-context.yaml gomplate --context .=release-context.yaml -f "$template_file" --out release-packages.yaml yq ".components[\"${component}\"]" release-packages.yaml >release-package.yaml diff --git a/packages/scripts/get-package-builder-with-config.sh b/packages/scripts/get-package-builder-with-config.sh index 9739aa1a..8f43fc10 100755 --- a/packages/scripts/get-package-builder-with-config.sh +++ b/packages/scripts/get-package-builder-with-config.sh @@ -17,14 +17,14 @@ function main() { # prepare template file's context. : >release-context.yaml - yq -i ".Release.os = \"$os\"" release-context.yaml - yq -i ".Release.arch = \"$arch\"" release-context.yaml - yq -i ".Release.version = \"$version\"" release-context.yaml - yq -i ".Release.profile = \"$profile\"" release-context.yaml + RELEASE_OS="$os" yq -i '.Release.os = strenv(RELEASE_OS)' release-context.yaml + RELEASE_ARCH="$arch" yq -i '.Release.arch = strenv(RELEASE_ARCH)' release-context.yaml + RELEASE_VERSION="$version" yq -i '.Release.version = strenv(RELEASE_VERSION)' release-context.yaml + RELEASE_PROFILE="$profile" yq -i '.Release.profile = strenv(RELEASE_PROFILE)' release-context.yaml yq -i '.Release.registry = "localhost"' release-context.yaml yq -i '.Git.ref = ""' release-context.yaml yq -i '.Git.sha = ""' release-context.yaml - yq -i ".Git.url = \"$git_url\"" release-context.yaml + GIT_URL="$git_url" yq -i '.Git.url = strenv(GIT_URL)' release-context.yaml gomplate --context .=release-context.yaml -f "$template_file" --out release-packages.yaml yq ".components[\"${component}\"]" release-packages.yaml >release-package.yaml From b8cc61edb4b0bff50845a305b82829733d669841 Mon Sep 17 00:00:00 2001 From: wuhuizuo Date: Wed, 4 Mar 2026 11:12:55 +0800 Subject: [PATCH 7/7] Revert "fix(ci): address review feedback for git url arguments" This reverts commit 54b12218faa2a295cfa819225b6ceadb0b73cdd9. --- .github/scripts/ci.sh | 52 +++++++++---------- .../gen-package-artifacts-with-config.sh | 16 +++--- .../scripts/gen-package-images-with-config.sh | 16 +++--- .../get-package-builder-with-config.sh | 10 ++-- 4 files changed, 47 insertions(+), 47 deletions(-) diff --git a/.github/scripts/ci.sh b/.github/scripts/ci.sh index 75dd86a2..7cd8036f 100755 --- a/.github/scripts/ci.sh +++ b/.github/scripts/ci.sh @@ -37,7 +37,7 @@ function test_get_builder() { for os in $operating_systems; do for ac in $architectures; do echo -en "[🚢] $cm $os $ac $version $profile:\t" - img=$($script "$cm" "$os" "$ac" "$version" "$profile" "./packages/packages.yaml.tmpl" "build-package-builder.txt" "$DEFAULT_GIT_URL") + img=$($script "$cm" "$os" "$ac" "$version" "$profile" "" "" "$DEFAULT_GIT_URL") echo $img check_image_existed $img done @@ -52,7 +52,7 @@ function test_get_builder() { for os in $operating_systems; do for ac in $architectures; do echo -en "[🚢] $cm $os $ac $version $profile:\t" - img=$($script "$cm" "$os" "$ac" "$version" "$profile" "./packages/packages.yaml.tmpl" "build-package-builder.txt" "$DEFAULT_GIT_URL") + img=$($script "$cm" "$os" "$ac" "$version" "$profile" "" "" "$DEFAULT_GIT_URL") echo $img check_image_existed $img done @@ -66,7 +66,7 @@ function test_get_builder() { for os in $operating_systems; do for ac in $architectures; do echo -en "[🚢] $cm $os $ac $version enterprise:\t" - img=$($script "$cm" "$os" "$ac" "$version" enterprise "./packages/packages.yaml.tmpl" "build-package-builder.txt" "$DEFAULT_GIT_URL") + img=$($script "$cm" "$os" "$ac" "$version" enterprise "" "" "$DEFAULT_GIT_URL") echo $img check_image_existed $img done @@ -83,7 +83,7 @@ function test_get_builder() { for os in $operating_systems; do for ac in $architectures; do echo -en "[🚢] $cm $os $ac $version $profile:\t" - img=$($script "$cm" "$os" "$ac" "$version" $profile "./packages/packages.yaml.tmpl" "build-package-builder.txt" "$DEFAULT_GIT_URL") + img=$($script "$cm" "$os" "$ac" "$version" $profile "" "" "$DEFAULT_GIT_URL") echo $img check_image_existed $img done @@ -105,7 +105,7 @@ function test_get_builder_freedom_releasing() { for ac in $architectures; do for version in v2.0.0 v1.6.0 v1.5.0; do echo -en "[🚢] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile "./packages/packages.yaml.tmpl" "build-package-builder.txt" "$DEFAULT_GIT_URL" + $script "$cm" "$os" "$ac" "$version" $profile "" "" "$DEFAULT_GIT_URL" done done @@ -116,7 +116,7 @@ function test_get_builder_freedom_releasing() { for ac in $architectures; do for version in v6.4.0-20221102-1667359250 v20221018; do echo -en "[🚢] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile "./packages/packages.yaml.tmpl" "build-package-builder.txt" "$DEFAULT_GIT_URL" + $script "$cm" "$os" "$ac" "$version" $profile "" "" "$DEFAULT_GIT_URL" done done @@ -126,7 +126,7 @@ function test_get_builder_freedom_releasing() { for ac in $architectures; do for version in v0.5.0 v0.6.0; do echo -en "[🚢] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile "./packages/packages.yaml.tmpl" "build-package-builder.txt" "$DEFAULT_GIT_URL" + $script "$cm" "$os" "$ac" "$version" $profile "" "" "$DEFAULT_GIT_URL" done done @@ -136,7 +136,7 @@ function test_get_builder_freedom_releasing() { for ac in $architectures; do for version in v0.1.2 v0.1.3; do echo -en "[🚢] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile "./packages/packages.yaml.tmpl" "build-package-builder.txt" "$DEFAULT_GIT_URL" + $script "$cm" "$os" "$ac" "$version" $profile "" "" "$DEFAULT_GIT_URL" done done done @@ -147,7 +147,7 @@ function test_get_builder_freedom_releasing() { for ac in $architectures; do for version in v0.1.0 v0.2.0; do echo -en "[🚢] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile "./packages/packages.yaml.tmpl" "build-package-builder.txt" "$DEFAULT_GIT_URL" + $script "$cm" "$os" "$ac" "$version" $profile "" "" "$DEFAULT_GIT_URL" done done done @@ -172,7 +172,7 @@ function test_gen_package_artifacts_script() { for os in $operating_systems; do for ac in $architectures; do echo -en "[📃📦] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-artifacts.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-artifacts.sh done done @@ -187,7 +187,7 @@ function test_gen_package_artifacts_script() { for os in $operating_systems; do for ac in $architectures; do echo -en "[📃📦] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" enterprise branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-artifacts.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" "$os" "$ac" "$version" enterprise branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-artifacts.sh done done @@ -202,7 +202,7 @@ function test_gen_package_artifacts_script() { for os in $operating_systems; do for ac in $architectures; do echo -en "[📃📦] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" failpoint branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-artifacts.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" "$os" "$ac" "$version" failpoint branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-artifacts.sh done done @@ -218,7 +218,7 @@ function test_gen_package_artifacts_script() { for os in $operating_systems; do for ac in $architectures; do echo -en "[📃📦] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-artifacts.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-artifacts.sh done done @@ -239,7 +239,7 @@ function test_gen_package_artifacts_script_freedom_releasing() { for ac in $architectures; do for version in v2.0.0 v1.6.0 v1.5.0; do echo -en "[📃📦] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-artifacts.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-artifacts.sh done done @@ -250,7 +250,7 @@ function test_gen_package_artifacts_script_freedom_releasing() { for ac in $architectures; do for version in v6.4.0-20221102-1667359250 v20221018; do echo -en "[📃📦] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-artifacts.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-artifacts.sh done done @@ -261,7 +261,7 @@ function test_gen_package_artifacts_script_freedom_releasing() { for ac in $architectures; do for version in v0.5.0 v0.6.0; do echo -en "[📃📦] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-artifacts.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-artifacts.sh done done @@ -272,7 +272,7 @@ function test_gen_package_artifacts_script_freedom_releasing() { for ac in $architectures; do for version in v0.1.2 v0.1.3; do echo -en "[📃📦] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-artifacts.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-artifacts.sh done done @@ -283,7 +283,7 @@ function test_gen_package_artifacts_script_freedom_releasing() { for ac in $architectures; do for version in v0.1.0 v0.2.0; do echo -en "[📃📦] $cm $os $ac $version $profile:\t" - $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-artifacts.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-artifacts.sh done done @@ -307,7 +307,7 @@ function test_gen_package_images_script() { fi for ac in $architectures; do echo -en "[📃💿] $cm $os $ac $version $profile:\t" - $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-images.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-images.sh done done @@ -320,7 +320,7 @@ function test_gen_package_images_script() { for version in $versions; do for ac in $architectures; do echo -en "[📃💿] $cm $os $ac $version $profile:\t" - $script $cm $os $ac $version $profile branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-images.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script $cm $os $ac $version $profile branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-images.sh done done @@ -334,7 +334,7 @@ function test_gen_package_images_script() { for version in $versions; do for ac in $architectures; do echo -en "[📃💿] $cm $os $ac $version $profile:\t" - $script $cm $os $ac $version $profile branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-images.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script $cm $os $ac $version $profile branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-images.sh done done @@ -353,7 +353,7 @@ function test_gen_package_images_script_freedom_releasing() { for ac in $architectures; do for version in v2.0.0 v1.6.0 v1.5.0; do echo -en "[📃💿] $cm $os $ac $version $profile:\t" - $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-images.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-images.sh done done @@ -363,7 +363,7 @@ function test_gen_package_images_script_freedom_releasing() { for ac in $architectures; do for version in v6.4.0-20221102-1667359250 v20221018; do echo -en "[📃💿] $cm $os $ac $version $profile:\t" - $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-images.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-images.sh done done @@ -373,7 +373,7 @@ function test_gen_package_images_script_freedom_releasing() { for version in v0.5.0 v0.6.0; do for ac in $architectures; do echo -en "[📃💿] $cm $os $ac $version $profile:\t" - $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-images.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-images.sh done done @@ -383,7 +383,7 @@ function test_gen_package_images_script_freedom_releasing() { for ac in $architectures; do for version in v0.1.2 v0.1.3; do echo -en "[📃💿] $cm $os $ac $version $profile:\t" - $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-images.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-images.sh done done @@ -393,7 +393,7 @@ function test_gen_package_images_script_freedom_releasing() { for version in v0.1.0 v0.2.0; do for ac in $architectures; do echo -en "[📃💿] $cm $os $ac $version $profile:\t" - $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "./packages/packages.yaml.tmpl" "./packages/scripts/build-package-images.sh" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" + $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef "" "" us-docker.pkg.dev/pingcap-testing-account/hub "$DEFAULT_GIT_URL" shellcheck -S error packages/scripts/build-package-images.sh done done diff --git a/packages/scripts/gen-package-artifacts-with-config.sh b/packages/scripts/gen-package-artifacts-with-config.sh index aecbf74a..1d2ebff9 100755 --- a/packages/scripts/gen-package-artifacts-with-config.sh +++ b/packages/scripts/gen-package-artifacts-with-config.sh @@ -20,14 +20,14 @@ function main() { # prepare template file's context. : >release-context.yaml - RELEASE_OS="$os" yq -i '.Release.os = strenv(RELEASE_OS)' release-context.yaml - RELEASE_ARCH="$arch" yq -i '.Release.arch = strenv(RELEASE_ARCH)' release-context.yaml - RELEASE_VERSION="$version" yq -i '.Release.version = strenv(RELEASE_VERSION)' release-context.yaml - RELEASE_PROFILE="$profile" yq -i '.Release.profile = strenv(RELEASE_PROFILE)' release-context.yaml - RELEASE_REGISTRY="$registry" yq -i '.Release.registry = strenv(RELEASE_REGISTRY)' release-context.yaml - GIT_REF="$git_ref" yq -i '.Git.ref = strenv(GIT_REF)' release-context.yaml - GIT_SHA="$git_sha" yq -i '.Git.sha = strenv(GIT_SHA)' release-context.yaml - GIT_URL="$git_url" yq -i '.Git.url = strenv(GIT_URL)' release-context.yaml + yq -i ".Release.os = \"$os\"" release-context.yaml + yq -i ".Release.arch = \"$arch\"" release-context.yaml + yq -i ".Release.version = \"$version\"" release-context.yaml + yq -i ".Release.profile = \"$profile\"" release-context.yaml + yq -i ".Release.registry = \"$registry\"" release-context.yaml + yq -i ".Git.ref = \"$git_ref\"" release-context.yaml + yq -i ".Git.sha = \"$git_sha\"" release-context.yaml + yq -i ".Git.url = \"$git_url\"" release-context.yaml gomplate --context .=release-context.yaml -f "$template_file" --out release-packages.yaml yq ".components[\"${component}\"]" release-packages.yaml >release-package.yaml diff --git a/packages/scripts/gen-package-images-with-config.sh b/packages/scripts/gen-package-images-with-config.sh index 99ab4a82..3242aba8 100755 --- a/packages/scripts/gen-package-images-with-config.sh +++ b/packages/scripts/gen-package-images-with-config.sh @@ -25,14 +25,14 @@ function main() { # prepare template file's context. : >release-context.yaml - RELEASE_OS="$os" yq -i '.Release.os = strenv(RELEASE_OS)' release-context.yaml - RELEASE_ARCH="$arch" yq -i '.Release.arch = strenv(RELEASE_ARCH)' release-context.yaml - RELEASE_VERSION="$version" yq -i '.Release.version = strenv(RELEASE_VERSION)' release-context.yaml - RELEASE_PROFILE="$profile" yq -i '.Release.profile = strenv(RELEASE_PROFILE)' release-context.yaml - RELEASE_REGISTRY="$registry" yq -i '.Release.registry = strenv(RELEASE_REGISTRY)' release-context.yaml - GIT_REF="$git_ref" yq -i '.Git.ref = strenv(GIT_REF)' release-context.yaml - GIT_SHA="$git_sha" yq -i '.Git.sha = strenv(GIT_SHA)' release-context.yaml - GIT_URL="$git_url" yq -i '.Git.url = strenv(GIT_URL)' release-context.yaml + yq -i ".Release.os = \"$os\"" release-context.yaml + yq -i ".Release.arch = \"$arch\"" release-context.yaml + yq -i ".Release.version = \"$version\"" release-context.yaml + yq -i ".Release.profile = \"$profile\"" release-context.yaml + yq -i ".Release.registry = \"$registry\"" release-context.yaml + yq -i ".Git.ref = \"$git_ref\"" release-context.yaml + yq -i ".Git.sha = \"$git_sha\"" release-context.yaml + yq -i ".Git.url = \"$git_url\"" release-context.yaml gomplate --context .=release-context.yaml -f "$template_file" --out release-packages.yaml yq ".components[\"${component}\"]" release-packages.yaml >release-package.yaml diff --git a/packages/scripts/get-package-builder-with-config.sh b/packages/scripts/get-package-builder-with-config.sh index 8f43fc10..9739aa1a 100755 --- a/packages/scripts/get-package-builder-with-config.sh +++ b/packages/scripts/get-package-builder-with-config.sh @@ -17,14 +17,14 @@ function main() { # prepare template file's context. : >release-context.yaml - RELEASE_OS="$os" yq -i '.Release.os = strenv(RELEASE_OS)' release-context.yaml - RELEASE_ARCH="$arch" yq -i '.Release.arch = strenv(RELEASE_ARCH)' release-context.yaml - RELEASE_VERSION="$version" yq -i '.Release.version = strenv(RELEASE_VERSION)' release-context.yaml - RELEASE_PROFILE="$profile" yq -i '.Release.profile = strenv(RELEASE_PROFILE)' release-context.yaml + yq -i ".Release.os = \"$os\"" release-context.yaml + yq -i ".Release.arch = \"$arch\"" release-context.yaml + yq -i ".Release.version = \"$version\"" release-context.yaml + yq -i ".Release.profile = \"$profile\"" release-context.yaml yq -i '.Release.registry = "localhost"' release-context.yaml yq -i '.Git.ref = ""' release-context.yaml yq -i '.Git.sha = ""' release-context.yaml - GIT_URL="$git_url" yq -i '.Git.url = strenv(GIT_URL)' release-context.yaml + yq -i ".Git.url = \"$git_url\"" release-context.yaml gomplate --context .=release-context.yaml -f "$template_file" --out release-packages.yaml yq ".components[\"${component}\"]" release-packages.yaml >release-package.yaml