diff --git a/pipelines/app-pipeline.yaml b/pipelines/app-pipeline.yaml new file mode 100644 index 0000000..a4fd3d2 --- /dev/null +++ b/pipelines/app-pipeline.yaml @@ -0,0 +1,61 @@ +apiVersion: tekton.dev/v1beta1 +kind: Pipeline +metadata: + name: app-pipeline + namespace: tekton-pipelines +spec: + params: + - name: app-name + - name: git-url + - name: git-revision + - name: pr-number + default: "" + - name: event-type + workspaces: + - name: shared-data + tasks: + - name: fetch-repository + taskRef: + name: git-clone + workspaces: + - name: output + workspace: shared-data + params: + - name: url + value: $(params.git-url) + - name: revision + value: $(params.git-revision) + + # 2. Build and Push Image (using standard Kaniko) + - name: build-and-push + runAfter: [fetch-repository] + taskRef: + name: kaniko + workspaces: + - name: source + workspace: shared-data + params: + - name: IMAGE + value: "ghcr.io/pingu-studio/$(params.app-name):$(params.git-revision)" + + # 3. PREVIEW: Runs only on PR + - name: deploy-preview + when: + - input: "$(params.event-type)" + operator: in + values: ["pull_request"] + runAfter: [build-and-push] + taskRef: + name: manage-preview + workspaces: + - name: source + workspace: shared-data + params: + - name: app-name + value: $(params.app-name) + - name: pr-number + value: "$(params.pr-number)" + - name: image-tag + value: "$(params.git-revision)" + - name: action + value: "apply" \ No newline at end of file