From e87c840e892de7a0974ab661a31e55480b6014be Mon Sep 17 00:00:00 2001 From: Ruben Romero Montes Date: Tue, 29 Aug 2023 18:40:36 +0200 Subject: [PATCH] chore: add integration test pipeline Signed-off-by: Ruben Romero Montes --- .tekton/exhort-it-pull-request.yaml | 195 +++++++++++++++++++++++++++ src/main/docker/Dockerfile.it-native | 14 ++ 2 files changed, 209 insertions(+) create mode 100644 .tekton/exhort-it-pull-request.yaml create mode 100644 src/main/docker/Dockerfile.it-native diff --git a/.tekton/exhort-it-pull-request.yaml b/.tekton/exhort-it-pull-request.yaml new file mode 100644 index 00000000..26c92604 --- /dev/null +++ b/.tekton/exhort-it-pull-request.yaml @@ -0,0 +1,195 @@ +apiVersion: tekton.dev/v1beta1 +kind: PipelineRun +metadata: + annotations: + build.appstudio.openshift.io/repo: https://github.com/RHEcosystemAppEng/exhort?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-event: '[pull_request, push]' + pipelinesascode.tekton.dev/on-target-branch: '[stable]' + creationTimestamp: null + labels: + appstudio.openshift.io/application: exhort-alpha + appstudio.openshift.io/component: exhort + pipelines.appstudio.openshift.io/type: test + name: exhort-it-on-pull-request + namespace: trusted-content-tenant +spec: + params: + - name: dockerfile + value: src/main/docker/Dockerfile.it-native + - name: git-url + value: '{{repo_url}}' + - name: output-image + value: quay.io/redhat-user-workloads/trusted-content-tenant/exhort-alpha/exhort:it-on-pr-{{revision}} + - name: path-context + value: . + - name: revision + value: '{{revision}}' + pipelineSpec: + 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: The path to your source code + name: path-context + type: string + - default: "false" + description: Skip checks against built image + name: skip-checks + type: string + - default: "true" + description: Skip optional checks, set false if you want to run optional checks + name: skip-optional + 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 + tasks: + - name: init + params: + - name: image-url + value: $(params.output-image) + - name: rebuild + value: $(params.rebuild) + - name: skip-checks + value: $(params.skip-checks) + - name: skip-optional + value: $(params.skip-optional) + - name: pipelinerun-name + value: $(context.pipelineRun.name) + - name: pipelinerun-uid + value: $(context.pipelineRun.uid) + taskRef: + params: + - name: name + value: init + - name: bundle + value: quay.io/redhat-appstudio-tekton-catalog/task-init:0.1@sha256:26586a7ef08c3e86dfdaf0a5cc38dd3d70c4c02db1331b469caaed0a0f5b3d86 + - 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/redhat-appstudio-tekton-catalog/task-git-clone:0.1@sha256:1f84973a21aabea38434b1f663abc4cb2d86565a9c7aae1f90decb43a8fa48eb + - 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) + runAfter: + - clone-repository + taskRef: + params: + - name: name + value: prefetch-dependencies + - name: bundle + value: quay.io/redhat-appstudio-tekton-catalog/task-prefetch-dependencies:0.1@sha256:c7b7f13d5d2a1545e95c2d56521327001d56ba54645900db41aa414607eff1e5 + - name: kind + value: task + resolver: bundles + when: + - input: $(params.hermetic) + operator: in + values: + - "true" + workspaces: + - name: source + workspace: workspace + - name: native-it + 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: COMMIT_SHA + value: $(tasks.clone-repository.results.commit) + - name: SKIP_PUSH + value: "true" + runAfter: + - prefetch-dependencies + taskRef: + params: + - name: name + value: buildah-8gb + - name: bundle + value: quay.io/redhat-appstudio-tekton-catalog/task-buildah-8gb:0.1 + - name: kind + value: task + resolver: bundles + when: + - input: $(tasks.init.results.build) + operator: in + values: + - "true" + workspaces: + - name: source + workspace: workspace + workspaces: + - name: workspace + - name: git-auth + optional: true + 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/src/main/docker/Dockerfile.it-native b/src/main/docker/Dockerfile.it-native new file mode 100644 index 00000000..c57a18bd --- /dev/null +++ b/src/main/docker/Dockerfile.it-native @@ -0,0 +1,14 @@ +## Stage 1 : build with maven builder image with native capabilities +FROM quay.io/quarkus/ubi-quarkus-mandrel-builder-image:22.3-java17 AS build + +COPY --chown=quarkus:quarkus mvnw /code/mvnw +COPY --chown=quarkus:quarkus .mvn /code/.mvn +COPY --chown=quarkus:quarkus pom.xml /code/ +COPY --chown=quarkus:quarkus api-spec /code/api-spec +COPY --chown=quarkus:quarkus ui /code/ui + +USER quarkus +WORKDIR /code +RUN ./mvnw -B dependency:go-offline +COPY --chown=quarkus:quarkus src /code/src +RUN ./mvnw verify -Pnative