diff --git a/.github/scripts/ci.sh b/.github/scripts/ci.sh index 5b49b299..0edac3d1 100755 --- a/.github/scripts/ci.sh +++ b/.github/scripts/ci.sh @@ -77,7 +77,7 @@ function test_get_builder_freedom_releasing() { local profile="release" local os="linux" for ac in $architectures; do - for version in v1.5.0 v1.6.0; 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 done @@ -192,7 +192,7 @@ function test_gen_package_artifacts_script_freedom_releasing() { local cm="tidb-operator" local os="linux" for ac in $architectures; do - for version in v1.5.0 v1.6.0; 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 shellcheck -S error packages/scripts/build-package-artifacts.sh @@ -287,7 +287,7 @@ function test_gen_package_images_script_freedom_releasing() { # tidb-operator local cm="tidb-operator" for ac in $architectures; do - for version in v1.6.0 v1.5.0; 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 shellcheck -S error packages/scripts/build-package-images.sh diff --git a/packages/packages.yaml.tmpl b/packages/packages.yaml.tmpl index 79a00400..379b4517 100644 --- a/packages/packages.yaml.tmpl +++ b/packages/packages.yaml.tmpl @@ -1387,8 +1387,31 @@ components: - if: {{ semver.CheckConstraint "< 1.6.0-0" .Release.version }} image: ghcr.io/pingcap-qe/cd/builders/tidb-operator:v2024.10.8-14-g52a7228-go1.21 routers: - - description: starts from 1.5.0 - if: {{ semver.CheckConstraint ">= 1.5.0-0" .Release.version }} + - description: for range [v2.0.0, ) + if: {{ semver.CheckConstraint ">= 2.0.0-0" .Release.version }} + os: [linux] + arch: [amd64, arm64] + profile: [release] + steps: + release: + - script: make build + artifacts: + - name: container image - operator + type: image + artifactory: + repo: "{{ .Release.registry }}/pingcap/tidb-operator/images/tidb-operator" + context: . + dockerfile: image/Dockerfile + target: operator # target build stage in Dockerfile + - name: container image - prestop-checker + type: image + artifactory: + repo: "{{ .Release.registry }}/pingcap/tidb-operator/images/prestop-checker" + context: . + dockerfile: image/Dockerfile + target: prestop-checker # target build stage in Dockerfile + - description: for range [v1.5.0, v2.0.0) + if: {{ semver.CheckConstraint ">= 1.5.0-0, < 2.0.0-0" .Release.version }} os: [linux] arch: [amd64, arm64] profile: [release, fips] diff --git a/packages/scripts/build-package-images.sh.tmpl b/packages/scripts/build-package-images.sh.tmpl index bb421c86..4f554821 100644 --- a/packages/scripts/build-package-images.sh.tmpl +++ b/packages/scripts/build-package-images.sh.tmpl @@ -2,6 +2,8 @@ # Code generated by gomplate, DO NOT EDIT. # It needs kaniko and oras tools, but it can be run in different containers for seperated stages. +# kaniko: https://github.com/GoogleContainerTools/kaniko/blob/main/README.md +# oras: https://oras.land/docs/category/oras-commands/ set -exo pipefail @@ -123,12 +125,17 @@ build_and_push_images() { destination="{{ .artifactory.repo }}:$tag" digest_file="${archive_dir}/digest.txt" kaniko_options="$kaniko_global_options --destination=${destination} --digest-file=${digest_file}" + {{- if has . "build_args" }} {{- range .build_args }} kaniko_options="$kaniko_options --build-arg {{.}}" {{- end }} {{- end }} + {{- if has . "target" }} + kaniko_options="$kaniko_options --target {{.target}} --skip-unused-stages" + {{- end }} + {{- if has . "context" }} # just build it with native build from git repo's dockerfile $kaniko_executor $kaniko_options --context {{ .context }} --dockerfile {{ .dockerfile }}