From b4f0e0622c0c4d4fd6c38633a8b017f09852e2ee Mon Sep 17 00:00:00 2001 From: openshift-pipelines-bot <99251431+openshift-pipelines-bot@users.noreply.github.com> Date: Wed, 9 Oct 2024 14:41:16 +0200 Subject: [PATCH] [bot] update konflux configuration (#80) Co-authored-by: openshift-pipelines-bot --- .konflux/main/application.yaml | 7 + .konflux/main/component-cache.yaml | 17 + .konflux/main/image-cache.yaml | 14 + .konflux/main/tests.yaml | 22 + .tekton/docker-build.yaml | 411 ++++++++++++++++++ ...tekton-caches-main-cache-pull-request.yaml | 59 +++ .tekton/tekton-caches-main-cache-push.yaml | 56 +++ 7 files changed, 586 insertions(+) create mode 100644 .konflux/main/application.yaml create mode 100644 .konflux/main/component-cache.yaml create mode 100644 .konflux/main/image-cache.yaml create mode 100644 .konflux/main/tests.yaml create mode 100644 .tekton/docker-build.yaml create mode 100644 .tekton/tekton-caches-main-cache-pull-request.yaml create mode 100644 .tekton/tekton-caches-main-cache-push.yaml diff --git a/.konflux/main/application.yaml b/.konflux/main/application.yaml new file mode 100644 index 000000000..361e06d6b --- /dev/null +++ b/.konflux/main/application.yaml @@ -0,0 +1,7 @@ +--- +apiVersion: appstudio.redhat.com/v1alpha1 +kind: Application +metadata: + name: tekton-caches-main +spec: + displayName: tekton-caches main diff --git a/.konflux/main/component-cache.yaml b/.konflux/main/component-cache.yaml new file mode 100644 index 000000000..d2433b1e3 --- /dev/null +++ b/.konflux/main/component-cache.yaml @@ -0,0 +1,17 @@ +--- +apiVersion: appstudio.redhat.com/v1alpha1 +kind: Component +metadata: + annotations: + build.appstudio.openshift.io/pipeline: '{"name":"docker-build","bundle":"latest"}' + name: tekton-caches-main-cache +spec: + componentName: cache + application: tekton-caches-main + build-nudges-ref: + - operator-main-bundle + source: + git: + url: https://github.com/openshift-pipelines/tekton-caches + dockerfileUrl: openshift/dockerfiles/cache.Dockerfile + revision: main diff --git a/.konflux/main/image-cache.yaml b/.konflux/main/image-cache.yaml new file mode 100644 index 000000000..b86b6a9a5 --- /dev/null +++ b/.konflux/main/image-cache.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: appstudio.redhat.com/v1alpha1 +kind: ImageRepository +metadata: + name: tekton-caches-main-cache + annotations: + image-controller.appstudio.redhat.com/update-component-image: "true" + labels: + appstudio.redhat.com/component: tekton-caches-main-cache + appstudio.redhat.com/application: tekton-caches-main +spec: + image: + name: tekton-caches-main/cache + visibility: public diff --git a/.konflux/main/tests.yaml b/.konflux/main/tests.yaml new file mode 100644 index 000000000..0ded57d5e --- /dev/null +++ b/.konflux/main/tests.yaml @@ -0,0 +1,22 @@ +--- +apiVersion: appstudio.redhat.com/v1beta2 +kind: IntegrationTestScenario +metadata: + name: tekton-caches-main-enterprise-contract +spec: + application: tekton-caches-main + contexts: + - description: Application testing + name: application + params: + - name: POLICY_CONFIGURATION + value: tekton-ecosystem-tenant/tekton-ecosystem-tenant-containers + resolverRef: + params: + - name: url + value: "https://github.com/konflux-ci/build-definitions" + - name: revision + value: main + - name: pathInRepo + value: pipelines/enterprise-contract.yaml + resolver: git diff --git a/.tekton/docker-build.yaml b/.tekton/docker-build.yaml new file mode 100644 index 000000000..fe6bd56b1 --- /dev/null +++ b/.tekton/docker-build.yaml @@ -0,0 +1,411 @@ +apiVersion: tekton.dev/v1 +kind: Pipeline +metadata: + name: docker-build +spec: + params: + - description: Source Repository URL + name: git-url + type: string + - default: "" + description: Revision of the Source Repository + name: revision + type: string + - description: Fully Qualified Output Image + name: output-image + type: string + - default: . + description: Path to the source code of an application's component from where + to build image. + name: path-context + type: string + - default: Dockerfile + description: Path to the Dockerfile inside the context specified by parameter + path-context + name: dockerfile + type: string + - default: "false" + description: Force rebuild image + name: rebuild + type: string + - default: "false" + description: Skip checks against built image + name: skip-checks + type: string + - default: "false" + description: Execute the build with network isolation + name: hermetic + type: string + - default: "" + description: Build dependencies to be prefetched by Cachi2 + name: prefetch-input + type: string + - default: "false" + description: Java build + name: java + type: string + - default: "" + description: Image tag expiration time, time values could be something like + 1h, 2d, 3w for hours, days, and weeks, respectively. + name: image-expires-after + - default: "false" + description: Build a source image. + name: build-source-image + type: string + - default: [] + description: Array of --build-arg values ("arg=value" strings) for buildah + name: build-args + type: array + - default: "" + description: Path to a file with build arguments for buildah, see https://www.mankier.com/1/buildah-build#--build-arg-file + name: build-args-file + type: string + results: + - description: "" + name: IMAGE_URL + value: $(tasks.build-container.results.IMAGE_URL) + - description: "" + name: IMAGE_DIGEST + value: $(tasks.build-container.results.IMAGE_DIGEST) + - description: "" + name: CHAINS-GIT_URL + value: $(tasks.clone-repository.results.url) + - description: "" + name: CHAINS-GIT_COMMIT + value: $(tasks.clone-repository.results.commit) + - description: "" + name: JAVA_COMMUNITY_DEPENDENCIES + value: $(tasks.build-container.results.JAVA_COMMUNITY_DEPENDENCIES) + tasks: + - name: init + params: + - name: image-url + value: $(params.output-image) + - name: rebuild + value: $(params.rebuild) + - name: skip-checks + value: $(params.skip-checks) + taskRef: + params: + - name: name + value: init + - name: bundle + value: quay.io/konflux-ci/tekton-catalog/task-init:0.2@sha256:092c113b614f6551113f17605ae9cb7e822aa704d07f0e37ed209da23ce392cc + - name: kind + value: task + resolver: bundles + - name: clone-repository + params: + - name: url + value: $(params.git-url) + - name: revision + value: $(params.revision) + runAfter: + - init + taskRef: + params: + - name: name + value: git-clone + - name: bundle + value: quay.io/konflux-ci/tekton-catalog/task-git-clone:0.1@sha256:0bb1be8363557e8e07ec34a3c5daaaaa23c9d533f0bb12f00dc604d00de50814 + - name: kind + value: task + resolver: bundles + when: + - input: $(tasks.init.results.build) + operator: in + values: + - "true" + workspaces: + - name: output + workspace: workspace + - name: basic-auth + workspace: git-auth + - name: prefetch-dependencies + params: + - name: input + value: $(params.prefetch-input) + - name: dev-package-managers + value: "true" + runAfter: + - clone-repository + taskRef: + params: + - name: name + value: prefetch-dependencies + - name: bundle + value: quay.io/konflux-ci/tekton-catalog/task-prefetch-dependencies:0.1@sha256:fe7234e3824d1e65d6a7aac352e7a6bbce623d90d8d7da9aceeee108ad2c61be + - name: kind + value: task + resolver: bundles + when: + - input: $(params.prefetch-input) + operator: notin + values: + - "" + workspaces: + - name: source + workspace: workspace + - name: git-basic-auth + workspace: git-auth + - name: netrc + workspace: netrc + - name: build-container + params: + - name: IMAGE + value: $(params.output-image) + - name: DOCKERFILE + value: $(params.dockerfile) + - name: CONTEXT + value: $(params.path-context) + - name: HERMETIC + value: $(params.hermetic) + - name: PREFETCH_INPUT + value: $(params.prefetch-input) + - name: IMAGE_EXPIRES_AFTER + value: $(params.image-expires-after) + - name: COMMIT_SHA + value: $(tasks.clone-repository.results.commit) + - name: BUILD_ARGS + value: + - $(params.build-args[*]) + - name: BUILD_ARGS_FILE + value: $(params.build-args-file) + runAfter: + - prefetch-dependencies + taskRef: + params: + - name: name + value: buildah + - name: bundle + value: quay.io/konflux-ci/tekton-catalog/task-buildah:0.2@sha256:71d3bb81d1c7c9f99946b5f1d4844664f2036636fd114cf5232db644bc088981 + - name: kind + value: task + resolver: bundles + when: + - input: $(tasks.init.results.build) + operator: in + values: + - "true" + workspaces: + - name: source + workspace: workspace + - name: build-source-image + params: + - name: BINARY_IMAGE + value: $(params.output-image) + runAfter: + - build-container + taskRef: + params: + - name: name + value: source-build + - name: bundle + value: quay.io/konflux-ci/tekton-catalog/task-source-build:0.1@sha256:21cb5ebaff7a9216903cf78933dc4ec4dd6283a52636b16590a5f52ceb278269 + - name: kind + value: task + resolver: bundles + when: + - input: $(tasks.init.results.build) + operator: in + values: + - "true" + - input: $(params.build-source-image) + operator: in + values: + - "true" + workspaces: + - name: workspace + workspace: workspace + - name: deprecated-base-image-check + params: + - name: IMAGE_URL + value: $(tasks.build-container.results.IMAGE_URL) + - name: IMAGE_DIGEST + value: $(tasks.build-container.results.IMAGE_DIGEST) + runAfter: + - build-container + taskRef: + params: + - name: name + value: deprecated-image-check + - name: bundle + value: quay.io/konflux-ci/tekton-catalog/task-deprecated-image-check:0.4@sha256:b4f9599f5770ea2e6e4d031224ccc932164c1ecde7f85f68e16e99c98d754003 + - name: kind + value: task + resolver: bundles + when: + - input: $(params.skip-checks) + operator: in + values: + - "false" + - name: clair-scan + params: + - name: image-digest + value: $(tasks.build-container.results.IMAGE_DIGEST) + - name: image-url + value: $(tasks.build-container.results.IMAGE_URL) + runAfter: + - build-container + taskRef: + params: + - name: name + value: clair-scan + - name: bundle + value: quay.io/konflux-ci/tekton-catalog/task-clair-scan:0.2@sha256:9f4ddafd599e06b319cece5a4b8ac36b9e7ec46bea378bc6c6af735d3f7f8060 + - name: kind + value: task + resolver: bundles + when: + - input: $(params.skip-checks) + operator: in + values: + - "false" + - name: ecosystem-cert-preflight-checks + params: + - name: image-url + value: $(tasks.build-container.results.IMAGE_URL) + runAfter: + - build-container + taskRef: + params: + - name: name + value: ecosystem-cert-preflight-checks + - name: bundle + value: quay.io/konflux-ci/tekton-catalog/task-ecosystem-cert-preflight-checks:0.1@sha256:5131cce0f93d0b728c7bcc0d6cee4c61d4c9f67c6d619c627e41e3c9775b497d + - name: kind + value: task + resolver: bundles + when: + - input: $(params.skip-checks) + operator: in + values: + - "false" + - name: sast-snyk-check + params: + - name: image-digest + value: $(tasks.build-container.results.IMAGE_DIGEST) + - name: image-url + value: $(tasks.build-container.results.IMAGE_URL) + runAfter: + - build-container + taskRef: + params: + - name: name + value: sast-snyk-check + - name: bundle + value: quay.io/konflux-ci/tekton-catalog/task-sast-snyk-check:0.2@sha256:06d9b14bed7c7f50593a289f723b074e3c0d6b025f74e61692224425713ece7e + - name: kind + value: task + resolver: bundles + when: + - input: $(params.skip-checks) + operator: in + values: + - "false" + workspaces: + - name: workspace + workspace: workspace + - name: clamav-scan + params: + - name: image-digest + value: $(tasks.build-container.results.IMAGE_DIGEST) + - name: image-url + value: $(tasks.build-container.results.IMAGE_URL) + runAfter: + - build-container + taskRef: + params: + - name: name + value: clamav-scan + - name: bundle + value: quay.io/konflux-ci/tekton-catalog/task-clamav-scan:0.1@sha256:37a2dcca17429a0e06f36a77c362d2f9b3cb4d0ad9c20393167bd740650a4657 + - name: kind + value: task + resolver: bundles + when: + - input: $(params.skip-checks) + operator: in + values: + - "false" + - name: apply-tags + params: + - name: IMAGE + value: $(tasks.build-container.results.IMAGE_URL) + runAfter: + - build-container + taskRef: + params: + - name: name + value: apply-tags + - name: bundle + value: quay.io/konflux-ci/tekton-catalog/task-apply-tags:0.1@sha256:e6beb161ed59d7be26317da03e172137b31b26648d3e139558e9a457bc56caff + - name: kind + value: task + resolver: bundles + - name: push-dockerfile + params: + - name: IMAGE + value: $(tasks.build-container.results.IMAGE_URL) + - name: IMAGE_DIGEST + value: $(tasks.build-container.results.IMAGE_DIGEST) + - name: DOCKERFILE + value: $(params.dockerfile) + - name: CONTEXT + value: $(params.path-context) + runAfter: + - build-container + taskRef: + params: + - name: name + value: push-dockerfile + - name: bundle + value: quay.io/konflux-ci/tekton-catalog/task-push-dockerfile:0.1@sha256:0d2b6d31dc8bc02c5493d7d28a163bb6c867be5f86c3a82388b0d5c69e18d352 + - name: kind + value: task + resolver: bundles + workspaces: + - name: workspace + workspace: workspace + finally: + - name: show-sbom + params: + - name: IMAGE_URL + value: $(tasks.build-container.results.IMAGE_URL) + taskRef: + params: + - name: name + value: show-sbom + - name: bundle + value: quay.io/konflux-ci/tekton-catalog/task-show-sbom:0.1@sha256:9bfc6b99ef038800fe131d7b45ff3cd4da3a415dd536f7c657b3527b01c4a13b + - name: kind + value: task + resolver: bundles + - name: show-summary + params: + - name: pipelinerun-name + value: $(context.pipelineRun.name) + - name: git-url + value: $(tasks.clone-repository.results.url)?rev=$(tasks.clone-repository.results.commit) + - name: image-url + value: $(params.output-image) + - name: build-task-status + value: $(tasks.build-container.status) + taskRef: + params: + - name: name + value: summary + - name: bundle + value: quay.io/konflux-ci/tekton-catalog/task-summary:0.2@sha256:d97c04ab42f277b1103eb6f3a053b247849f4f5b3237ea302a8ecada3b24e15b + - name: kind + value: task + resolver: bundles + workspaces: + - name: workspace + workspace: workspace + workspaces: + - name: workspace + - name: git-auth + optional: true + - name: netrc + optional: true diff --git a/.tekton/tekton-caches-main-cache-pull-request.yaml b/.tekton/tekton-caches-main-cache-pull-request.yaml new file mode 100644 index 000000000..62b977729 --- /dev/null +++ b/.tekton/tekton-caches-main-cache-pull-request.yaml @@ -0,0 +1,59 @@ +apiVersion: tekton.dev/v1 +kind: PipelineRun +metadata: + annotations: + build.appstudio.openshift.io/repo: https://github.com/openshift-pipelines/tekton-caches?rev={{revision}} + build.appstudio.redhat.com/commit_sha: '{{revision}}' + build.appstudio.redhat.com/pull_request_number: '{{pull_request_number}}' + build.appstudio.redhat.com/target_branch: '{{target_branch}}' + pipelinesascode.tekton.dev/max-keep-runs: "3" + pipelinesascode.tekton.dev/on-cel-expression: event == "pull_request" && target_branch + == "main" && + ("upstream/***".pathChanged() || "openshift/***".pathChanged() || + ".tekton/cache-pull-request.yaml".pathChanged() || + ".tekton/cache-push.yaml".pathChanged() || + ".tekton/docker-build.yaml".pathChanged()) + creationTimestamp: null + labels: + appstudio.openshift.io/application: tekton-caches-main + appstudio.openshift.io/component: tekton-caches-main-cache + pipelines.appstudio.openshift.io/type: build + name: tekton-caches-main-cache-on-pull-request + namespace: tekton-ecosystem-tenant +spec: + params: + - name: git-url + value: '{{source_url}}' + - name: revision + value: '{{revision}}' + - name: output-image + value: quay.io/redhat-user-workloads/tekton-ecosystem-tenant/tekton-caches-main/cache:on-pr-{{revision}} + - name: image-expires-after + value: 5d + - name: dockerfile + value: openshift/dockerfiles/cache.Dockerfile + - name: build-source-image + value: "true" + - name: hermetic + value: "true" + - name: prefetch-input + value: | + {"type": "rpm", "path": "openshift/rpms"} + pipelineRef: + name: docker-build + workspaces: + - name: workspace + volumeClaimTemplate: + metadata: + creationTimestamp: null + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + status: {} + - name: git-auth + secret: + secretName: '{{ git_auth_secret }}' +status: {} diff --git a/.tekton/tekton-caches-main-cache-push.yaml b/.tekton/tekton-caches-main-cache-push.yaml new file mode 100644 index 000000000..d6838060d --- /dev/null +++ b/.tekton/tekton-caches-main-cache-push.yaml @@ -0,0 +1,56 @@ +apiVersion: tekton.dev/v1 +kind: PipelineRun +metadata: + annotations: + build.appstudio.openshift.io/repo: https://github.com/openshift-pipelines/tekton-caches?rev={{revision}} + build.appstudio.redhat.com/commit_sha: '{{revision}}' + build.appstudio.redhat.com/target_branch: '{{target_branch}}' + pipelinesascode.tekton.dev/max-keep-runs: "3" + pipelinesascode.tekton.dev/on-cel-expression: event == "push" && target_branch + == "main" && + ("upstream/***".pathChanged() || "openshift/***".pathChanged() || + ".tekton/cache-pull-request.yaml".pathChanged() || + ".tekton/cache-push.yaml".pathChanged() || + ".tekton/docker-build.yaml".pathChanged()) + creationTimestamp: null + labels: + appstudio.openshift.io/application: tekton-caches-main + appstudio.openshift.io/component: tekton-caches-main-cache + pipelines.appstudio.openshift.io/type: build + name: tekton-caches-main-cache-on-push + namespace: tekton-ecosystem-tenant +spec: + params: + - name: git-url + value: '{{source_url}}' + - name: revision + value: '{{revision}}' + - name: output-image + value: quay.io/redhat-user-workloads/tekton-ecosystem-tenant/tekton-caches-main/cache:{{revision}} + - name: dockerfile + value: openshift/dockerfiles/cache.Dockerfile + - name: build-source-image + value: "true" + - name: hermetic + value: "true" + - name: prefetch-input + value: | + {"type": "rpm", "path": "openshift/rpms"} + pipelineRef: + name: docker-build + workspaces: + - name: workspace + volumeClaimTemplate: + metadata: + creationTimestamp: null + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + status: {} + - name: git-auth + secret: + secretName: '{{ git_auth_secret }}' +status: {}