Skip to content

Commit aa1a8e7

Browse files
authored
feat(tidb-operator): add package config for operator v2 (#530)
## Background TiDB-operator owner want publish artifacts for the refactoring tidb-operator, the version start from v2.0.0. --------- Signed-off-by: wuhuizuo <[email protected]>
1 parent ee7bfd3 commit aa1a8e7

File tree

3 files changed

+35
-5
lines changed

3 files changed

+35
-5
lines changed

.github/scripts/ci.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ function test_get_builder_freedom_releasing() {
7777
local profile="release"
7878
local os="linux"
7979
for ac in $architectures; do
80-
for version in v1.5.0 v1.6.0; do
80+
for version in v2.0.0 v1.6.0 v1.5.0; do
8181
echo -en "[🚢] $cm $os $ac $version $profile:\t"
8282
$script "$cm" "$os" "$ac" "$version" $profile
8383
done
@@ -192,7 +192,7 @@ function test_gen_package_artifacts_script_freedom_releasing() {
192192
local cm="tidb-operator"
193193
local os="linux"
194194
for ac in $architectures; do
195-
for version in v1.5.0 v1.6.0; do
195+
for version in v2.0.0 v1.6.0 v1.5.0; do
196196
echo -en "[📃📦] $cm $os $ac $version $profile:\t"
197197
$script "$cm" "$os" "$ac" "$version" $profile branch-xxx 123456789abcdef
198198
shellcheck -S error packages/scripts/build-package-artifacts.sh
@@ -287,7 +287,7 @@ function test_gen_package_images_script_freedom_releasing() {
287287
# tidb-operator
288288
local cm="tidb-operator"
289289
for ac in $architectures; do
290-
for version in v1.6.0 v1.5.0; do
290+
for version in v2.0.0 v1.6.0 v1.5.0; do
291291
echo -en "[📃💿] $cm $os $ac $version $profile:\t"
292292
$script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef
293293
shellcheck -S error packages/scripts/build-package-images.sh

packages/packages.yaml.tmpl

+25-2
Original file line numberDiff line numberDiff line change
@@ -1387,8 +1387,31 @@ components:
13871387
- if: {{ semver.CheckConstraint "< 1.6.0-0" .Release.version }}
13881388
image: ghcr.io/pingcap-qe/cd/builders/tidb-operator:v2024.10.8-14-g52a7228-go1.21
13891389
routers:
1390-
- description: starts from 1.5.0
1391-
if: {{ semver.CheckConstraint ">= 1.5.0-0" .Release.version }}
1390+
- description: for range [v2.0.0, )
1391+
if: {{ semver.CheckConstraint ">= 2.0.0-0" .Release.version }}
1392+
os: [linux]
1393+
arch: [amd64, arm64]
1394+
profile: [release]
1395+
steps:
1396+
release:
1397+
- script: make build
1398+
artifacts:
1399+
- name: container image - operator
1400+
type: image
1401+
artifactory:
1402+
repo: "{{ .Release.registry }}/pingcap/tidb-operator/images/tidb-operator"
1403+
context: .
1404+
dockerfile: image/Dockerfile
1405+
target: operator # target build stage in Dockerfile
1406+
- name: container image - prestop-checker
1407+
type: image
1408+
artifactory:
1409+
repo: "{{ .Release.registry }}/pingcap/tidb-operator/images/prestop-checker"
1410+
context: .
1411+
dockerfile: image/Dockerfile
1412+
target: prestop-checker # target build stage in Dockerfile
1413+
- description: for range [v1.5.0, v2.0.0)
1414+
if: {{ semver.CheckConstraint ">= 1.5.0-0, < 2.0.0-0" .Release.version }}
13921415
os: [linux]
13931416
arch: [amd64, arm64]
13941417
profile: [release, fips]

packages/scripts/build-package-images.sh.tmpl

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# Code generated by gomplate, DO NOT EDIT.
33

44
# It needs kaniko and oras tools, but it can be run in different containers for seperated stages.
5+
# kaniko: https://github.com/GoogleContainerTools/kaniko/blob/main/README.md
6+
# oras: https://oras.land/docs/category/oras-commands/
57

68
set -exo pipefail
79

@@ -123,12 +125,17 @@ build_and_push_images() {
123125
destination="{{ .artifactory.repo }}:$tag"
124126
digest_file="${archive_dir}/digest.txt"
125127
kaniko_options="$kaniko_global_options --destination=${destination} --digest-file=${digest_file}"
128+
126129
{{- if has . "build_args" }}
127130
{{- range .build_args }}
128131
kaniko_options="$kaniko_options --build-arg {{.}}"
129132
{{- end }}
130133
{{- end }}
131134

135+
{{- if has . "target" }}
136+
kaniko_options="$kaniko_options --target {{.target}} --skip-unused-stages"
137+
{{- end }}
138+
132139
{{- if has . "context" }}
133140
# just build it with native build from git repo's dockerfile
134141
$kaniko_executor $kaniko_options --context {{ .context }} --dockerfile {{ .dockerfile }}

0 commit comments

Comments
 (0)