From 610a437f8c47bfb44d5f76b3813efb2f43bd377e Mon Sep 17 00:00:00 2001 From: Przemek Pokrywka <12400578+dekiel@users.noreply.github.com> Date: Mon, 7 Oct 2024 12:32:47 +0200 Subject: [PATCH] Support custom tags on pr images in image-builder reusable workflow (#12069) * Use image-builder-client-config.yaml. It contains only configuration relevant for client. * Refresh build status more often to decrease build time on gh. Shorter refresh time will decrease possible delay. * Use newer image * Use image with removed UseKanikoConfigFromPR flag --- .github/actions/image-builder/action.yml | 4 +- .github/workflows/image-builder.yml | 2 +- .../pull-validate-kaniko-build-config.yml | 4 +- configs/image-builder-client-config.yaml | 9 +++++ configs/kaniko-build-config.yaml | 37 ------------------- 5 files changed, 14 insertions(+), 42 deletions(-) create mode 100644 configs/image-builder-client-config.yaml delete mode 100644 configs/kaniko-build-config.yaml diff --git a/.github/actions/image-builder/action.yml b/.github/actions/image-builder/action.yml index b97a74206158..c2929dbb4bcf 100644 --- a/.github/actions/image-builder/action.yml +++ b/.github/actions/image-builder/action.yml @@ -33,7 +33,7 @@ inputs: config: description: Path to the config file required: false - default: "./configs/kaniko-build-config.yaml" + default: "./configs/image-builder-client-config.yaml" env-file: description: Path to file with environment variables to be loaded in the build required: false @@ -78,7 +78,7 @@ runs: id: prepare-tags shell: bash - - uses: docker://europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240705-0b2e6015 + - uses: docker://europe-docker.pkg.dev/kyma-project/prod/image-builder:v20241007-36d14dd7 id: build with: args: --name=${{ inputs.image-name }} --context=${{ inputs.context }} --dockerfile=${{ inputs.dockerfile }} --azure-access-token=${{ inputs.ado-token }} --oidc-token=${{ inputs.oidc-token }} ${{ steps.prepare-build-args.outputs.build-args }} ${{ steps.prepare-tags.outputs.tags }} --export-tags=${{ inputs.export-tags }} --config=${{ inputs.config }} --env-file=${{ inputs.env-file }} --build-in-ado=true \ No newline at end of file diff --git a/.github/workflows/image-builder.yml b/.github/workflows/image-builder.yml index d8b838d61592..06010c8740a7 100644 --- a/.github/workflows/image-builder.yml +++ b/.github/workflows/image-builder.yml @@ -108,4 +108,4 @@ jobs: image-name: ${{ inputs.name }} dockerfile: ${{ inputs.dockerfile }} env-file: ${{ inputs.env-file }} - config: "./configs/kaniko-build-config.yaml" \ No newline at end of file + config: "./configs/image-builder-client-config.yaml" \ No newline at end of file diff --git a/.github/workflows/pull-validate-kaniko-build-config.yml b/.github/workflows/pull-validate-kaniko-build-config.yml index a501f8da0425..a5502581a2d9 100644 --- a/.github/workflows/pull-validate-kaniko-build-config.yml +++ b/.github/workflows/pull-validate-kaniko-build-config.yml @@ -4,7 +4,7 @@ on: pull_request_target: types: [opened, edited, synchronize, reopened, ready_for_review] paths: - - "configs/kaniko-build-config.yaml" + - "configs/image-builder-client-config.yaml" - ".github/workflows/pull-validate-kaniko-build-config.yaml" permissions: @@ -53,4 +53,4 @@ jobs: - uses: docker://europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240621-63f4f2b1 id: build with: - args: --name=test-infra/ginkgo --context=. --dockerfile=prow/images/ginkgo/Dockerfile --azure-access-token=${{ steps.secrets.outputs.ado-pat }} --oidc-token=${{ steps.get_oidc.outputs.jwt }} --env-file='envs' --build-in-ado=true --test-kaniko-build-config=true --config="./configs/kaniko-build-config.yaml" \ No newline at end of file + args: --name=test-infra/ginkgo --context=. --dockerfile=prow/images/ginkgo/Dockerfile --azure-access-token=${{ steps.secrets.outputs.ado-pat }} --oidc-token=${{ steps.get_oidc.outputs.jwt }} --env-file='envs' --build-in-ado=true --test-kaniko-build-config=true --config="./configs/image-builder-client-config.yaml" \ No newline at end of file diff --git a/configs/image-builder-client-config.yaml b/configs/image-builder-client-config.yaml new file mode 100644 index 000000000000..a42e739035ab --- /dev/null +++ b/configs/image-builder-client-config.yaml @@ -0,0 +1,9 @@ +log-format: json +ado-config: + ado-organization-url: https://dev.azure.com/hyperspace-pipelines + ado-project-name: kyma + ado-pipeline-id: 14902 + ado-retry-strategy: + attempts: 3 + delay: 5s + ado-refresh-interval: 15s \ No newline at end of file diff --git a/configs/kaniko-build-config.yaml b/configs/kaniko-build-config.yaml deleted file mode 100644 index 2b894cc314ab..000000000000 --- a/configs/kaniko-build-config.yaml +++ /dev/null @@ -1,37 +0,0 @@ -tag-template: "v{{ .Date }}-{{ .ShortSHA }}" -registry: - - europe-docker.pkg.dev/kyma-project/prod -dev-registry: - - europe-docker.pkg.dev/kyma-project/dev -reproducible: false -log-format: json -ado-config: - ado-organization-url: https://dev.azure.com/hyperspace-pipelines - ado-project-name: kyma - ado-pipeline-id: 14902 - ado-retry-strategy: - attempts: 3 - delay: 5s - ado-refresh-interval: 30s -cache: - enabled: true - cache-repo: europe-docker.pkg.dev/kyma-project/cache/cache - cache-run-layers: true -sign-config: - enabled-signers: - "*": - - signify-prod - signers: - - name: signify-prod - type: notary - job-type: - - postsubmit - - workflow_dispatch - - schedule - config: - endpoint: https://signing-manage.repositories.cloud.sap/trusted-collections/publish - timeout: 5m - retry-timeout: 10s - secret: - path: /secret-prod/secret.yaml - type: signify \ No newline at end of file