From bdc9f379fac7055ea4b77cf1da2edb9ff53edab6 Mon Sep 17 00:00:00 2001 From: wuhuizuo Date: Tue, 25 Jun 2024 21:49:05 +0800 Subject: [PATCH 1/4] feat(apps/prod/tekton/configs): support tibuild trigger with custom builder image Signed-off-by: wuhuizuo --- .../configs/pipelines/pingcap-build-package.yaml | 11 +++++++++++ .../configs/tasks/pingcap-get-builder-image.yaml | 14 +++++++++++++- .../_/fake-github/fake-github-branch-push.yaml | 6 ++++++ .../triggers/_/fake-github/fake-github-pr.yaml | 6 ++++++ .../_/fake-github/fake-github-tag-create.yaml | 6 ++++++ 5 files changed, 42 insertions(+), 1 deletion(-) diff --git a/apps/prod/tekton/configs/pipelines/pingcap-build-package.yaml b/apps/prod/tekton/configs/pipelines/pingcap-build-package.yaml index 27e0dbc3b..d4589e4cf 100644 --- a/apps/prod/tekton/configs/pipelines/pingcap-build-package.yaml +++ b/apps/prod/tekton/configs/pipelines/pingcap-build-package.yaml @@ -39,6 +39,12 @@ spec: - name: registry description: the base OCI registry server for store artifacts, it can be set with prefix repo path. default: "hub.pingcap.net" + - name: force-builder-image + description: > + The builder image to use for building binaries by force, if empty. + Defalt the task will complete one from config in artifacts.git repo. + type: string + default: "" results: - name: pushed-binaries description: pushed binaries. @@ -118,6 +124,11 @@ spec: value: "$(params.profile)" - name: version value: "$(tasks.get-release-ver.results.version)" + - name: force-builder-image + value: "$(params.force-builder-image)" + - name: acquire-mac-machine + runAfter: + - get-binaries-builder - name: build-binaries runAfter: - checkout-ext diff --git a/apps/prod/tekton/configs/tasks/pingcap-get-builder-image.yaml b/apps/prod/tekton/configs/tasks/pingcap-get-builder-image.yaml index 83ce7fb7b..d30b02597 100644 --- a/apps/prod/tekton/configs/tasks/pingcap-get-builder-image.yaml +++ b/apps/prod/tekton/configs/tasks/pingcap-get-builder-image.yaml @@ -3,7 +3,7 @@ kind: Task metadata: name: pingcap-get-builder-image labels: - app.kubernetes.io/version: "0.1" + app.kubernetes.io/version: "0.2" annotations: tekton.dev/platforms: "linux/amd64,linux/arm64" spec: @@ -28,10 +28,22 @@ spec: default: release description: > supports: 'release' or 'failpoint' or others. + - name: force-builder-image + type: string + description: > + force to use a specific builder image, it will be used as the base + image for building binaries. + default: "" steps: - name: get image: ghcr.io/pingcap-qe/cd/utils/release:v20231216-37-g8e0ca7e script: | + if [ -n "$(params.force-builder-image)" ]; then + echo "use force builder image: $(params.force-builder-image)" + printf "%s" "$(params.force-builder-image)" > $(results.image-url.path) + exit 0 + fi + git clone --depth=1 --branch=main https://github.com/PingCAP-QE/artifacts.git /workspace/artifacts out="/workspace/builder-package-artifacts.txt" diff --git a/apps/prod/tekton/configs/triggers/triggers/_/fake-github/fake-github-branch-push.yaml b/apps/prod/tekton/configs/triggers/triggers/_/fake-github/fake-github-branch-push.yaml index 2462ef4c8..ee0c40d67 100644 --- a/apps/prod/tekton/configs/triggers/triggers/_/fake-github/fake-github-branch-push.yaml +++ b/apps/prod/tekton/configs/triggers/triggers/_/fake-github/fake-github-branch-push.yaml @@ -50,6 +50,11 @@ spec: 'tikv/pd': '32Gi', 'tikv/tikv': '64Gi', }[body.repository.full_name] + - key: custom-params + expression: >- + { + 'builder-image': header.canonical('ce-param-builder-image'), + } bindings: - ref: github-branch-push - ref: ce-context @@ -61,5 +66,6 @@ spec: - { name: builder-resources-cpu, value: $(extensions.builder-resources-cpu) } - { name: builder-resources-memory, value: $(extensions.builder-resources-memory) } - { name: registry, value: hub.pingcap.net/devbuild } + - { name: force-builder-image, value: $(extensions.custom-params.force-builder-image) } template: ref: build-component diff --git a/apps/prod/tekton/configs/triggers/triggers/_/fake-github/fake-github-pr.yaml b/apps/prod/tekton/configs/triggers/triggers/_/fake-github/fake-github-pr.yaml index 85924f678..d146ba786 100644 --- a/apps/prod/tekton/configs/triggers/triggers/_/fake-github/fake-github-pr.yaml +++ b/apps/prod/tekton/configs/triggers/triggers/_/fake-github/fake-github-pr.yaml @@ -50,6 +50,11 @@ spec: 'tikv/pd': '32Gi', 'tikv/tikv': '64Gi', }[body.repository.full_name] + - key: custom-params + expression: >- + { + 'builder-image': header.canonical('ce-param-builder-image'), + } bindings: - ref: github-pr - ref: ce-context @@ -61,5 +66,6 @@ spec: - { name: builder-resources-cpu, value: $(extensions.builder-resources-cpu) } - { name: builder-resources-memory, value: $(extensions.builder-resources-memory) } - { name: registry, value: hub.pingcap.net/devbuild } + - { name: force-builder-image, value: $(extensions.custom-params.force-builder-image) } template: ref: build-component diff --git a/apps/prod/tekton/configs/triggers/triggers/_/fake-github/fake-github-tag-create.yaml b/apps/prod/tekton/configs/triggers/triggers/_/fake-github/fake-github-tag-create.yaml index 340d74cf7..15dbb960e 100644 --- a/apps/prod/tekton/configs/triggers/triggers/_/fake-github/fake-github-tag-create.yaml +++ b/apps/prod/tekton/configs/triggers/triggers/_/fake-github/fake-github-tag-create.yaml @@ -52,6 +52,11 @@ spec: 'tikv/pd': '32Gi', 'tikv/tikv': '64Gi', }[body.repository.full_name] + - key: custom-params + expression: >- + { + 'builder-image': header.canonical('ce-param-builder-image'), + } bindings: - ref: github-tag-create - ref: ce-context @@ -63,5 +68,6 @@ spec: - { name: builder-resources-cpu, value: $(extensions.builder-resources-cpu) } - { name: builder-resources-memory, value: $(extensions.builder-resources-memory) } - { name: registry, value: hub.pingcap.net/devbuild } + - { name: force-builder-image, value: $(extensions.custom-params.force-builder-image) } template: ref: build-component From a24f589c22c42d372be634753d806fc40f7a4d46 Mon Sep 17 00:00:00 2001 From: wuhuizuo Date: Thu, 4 Jul 2024 18:11:32 +0800 Subject: [PATCH 2/4] Update apps/prod/tekton/configs/pipelines/pingcap-build-package.yaml --- apps/prod/tekton/configs/pipelines/pingcap-build-package.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/apps/prod/tekton/configs/pipelines/pingcap-build-package.yaml b/apps/prod/tekton/configs/pipelines/pingcap-build-package.yaml index d4589e4cf..5055ae479 100644 --- a/apps/prod/tekton/configs/pipelines/pingcap-build-package.yaml +++ b/apps/prod/tekton/configs/pipelines/pingcap-build-package.yaml @@ -126,9 +126,6 @@ spec: value: "$(tasks.get-release-ver.results.version)" - name: force-builder-image value: "$(params.force-builder-image)" - - name: acquire-mac-machine - runAfter: - - get-binaries-builder - name: build-binaries runAfter: - checkout-ext From 4ea63ae9b90ea8f2ea89e8f0fb8c01a0e3b6733a Mon Sep 17 00:00:00 2001 From: wuhuizuo Date: Thu, 4 Jul 2024 18:16:51 +0800 Subject: [PATCH 3/4] Update apps/prod/tekton/configs/pipelines/pingcap-build-package.yaml Co-authored-by: codiumai-pr-agent-pro[bot] <151058649+codiumai-pr-agent-pro[bot]@users.noreply.github.com> --- apps/prod/tekton/configs/pipelines/pingcap-build-package.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/prod/tekton/configs/pipelines/pingcap-build-package.yaml b/apps/prod/tekton/configs/pipelines/pingcap-build-package.yaml index 5055ae479..79120b039 100644 --- a/apps/prod/tekton/configs/pipelines/pingcap-build-package.yaml +++ b/apps/prod/tekton/configs/pipelines/pingcap-build-package.yaml @@ -42,7 +42,7 @@ spec: - name: force-builder-image description: > The builder image to use for building binaries by force, if empty. - Defalt the task will complete one from config in artifacts.git repo. + Default the task will complete one from config in artifacts.git repo. type: string default: "" results: From 2a277c252d41a7ff8e3b67aaf04cf7cd26b9ec31 Mon Sep 17 00:00:00 2001 From: wuhuizuo Date: Thu, 4 Jul 2024 18:17:00 +0800 Subject: [PATCH 4/4] Update apps/prod/tekton/configs/triggers/triggers/_/fake-github/fake-github-branch-push.yaml Co-authored-by: codiumai-pr-agent-pro[bot] <151058649+codiumai-pr-agent-pro[bot]@users.noreply.github.com> --- .../triggers/_/fake-github/fake-github-branch-push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/prod/tekton/configs/triggers/triggers/_/fake-github/fake-github-branch-push.yaml b/apps/prod/tekton/configs/triggers/triggers/_/fake-github/fake-github-branch-push.yaml index ee0c40d67..ed6c09eb5 100644 --- a/apps/prod/tekton/configs/triggers/triggers/_/fake-github/fake-github-branch-push.yaml +++ b/apps/prod/tekton/configs/triggers/triggers/_/fake-github/fake-github-branch-push.yaml @@ -53,7 +53,7 @@ spec: - key: custom-params expression: >- { - 'builder-image': header.canonical('ce-param-builder-image'), + 'builder-image': header.canonical('ce-param-builder-image') } bindings: - ref: github-branch-push