From aa34547a2d4de96d22614a614760ef351bae475b Mon Sep 17 00:00:00 2001 From: Kevin Ahmad Date: Sat, 27 Apr 2024 01:29:08 +0000 Subject: [PATCH] add tekton pipeline yaml --- .tekton/pipeline.yaml | 149 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 .tekton/pipeline.yaml diff --git a/.tekton/pipeline.yaml b/.tekton/pipeline.yaml new file mode 100644 index 0000000..a927d75 --- /dev/null +++ b/.tekton/pipeline.yaml @@ -0,0 +1,149 @@ +# Completed cd-pipeline from the OpenShift lab +--- +apiVersion: tekton.dev/v1 +kind: Pipeline +metadata: + name: cd-pipeline +spec: + workspaces: + - name: pipeline-workspace + params: + - name: GIT_REPO + description: The URL to the git repo + type: string + - name: GIT_REF + description: The reference (branch or ref) + type: string + default: master + - name: APP_NAME + description: Name of the application + type: string + default: petshop + - name: IMAGE_NAME + description: The name of the image to build + type: string + default: 'image-registry.openshift-image-registry.svc:5000/$(context.pipelineRun.namespace)/$(params.APP_NAME):latest' + tasks: + - name: git-clone + params: + - name: url + value: $(params.GIT_REPO) + - name: revision + value: $(params.GIT_REF) + - name: refspec + value: '' + - name: submodules + value: 'true' + - name: depth + value: '1' + - name: sslVerify + value: 'true' + - name: crtFileName + value: ca-bundle.crt + - name: subdirectory + value: '' + - name: sparseCheckoutDirectories + value: '' + - name: deleteExisting + value: 'true' + - name: httpProxy + value: '' + - name: httpsProxy + value: '' + - name: noProxy + value: '' + - name: verbose + value: 'true' + - name: gitInitImage + value: >- + registry.redhat.io/openshift-pipelines/pipelines-git-init-rhel8@sha256:1a50511583fc02a27012d17d942e247813404104ddd282d7e26f99765174392c + - name: userHome + value: /home/git + taskRef: + kind: ClusterTask + name: git-clone + workspaces: + - name: output + workspace: pipeline-workspace + - name: linting + params: + - name: image + value: 'docker.io/python:3.11-slim' + - name: path + value: service + - name: args + value: [] + - name: requirements_file + value: requirements.txt + runAfter: + - git-clone + taskRef: + kind: Task + name: pylint + workspaces: + - name: source + workspace: pipeline-workspace + - name: testing + params: + - name: PYTEST_ARGS + value: + - '--pspec' + - '--cov=service' + - '--cov-fail-under=95' + - name: SECRET_NAME + value: postgres-creds + - name: SECRET_KEY + value: database_uri + runAfter: + - git-clone + taskRef: + kind: Task + name: pytest-env + workspaces: + - name: source + workspace: pipeline-workspace + - name: buildah + params: + - name: IMAGE + value: $(params.IMAGE_NAME) + - name: BUILDER_IMAGE + value: 'registry.redhat.io/rhel8/buildah@sha256:b48f410efa0ff8ab0db6ead420a5d8d866d64af846fece5efb185230d7ecf591' + - name: STORAGE_DRIVER + value: vfs + - name: DOCKERFILE + value: ./Dockerfile + - name: CONTEXT + value: . + - name: TLSVERIFY + value: 'true' + - name: FORMAT + value: oci + - name: BUILD_EXTRA_ARGS + value: '' + - name: PUSH_EXTRA_ARGS + value: '' + - name: SKIP_PUSH + value: 'false' + runAfter: + - linting + - testing + taskRef: + kind: ClusterTask + name: buildah + workspaces: + - name: source + workspace: pipeline-workspace + - name: deploy-image + params: + - name: image_name + value: $(params.IMAGE_NAME) + - name: manifest_dir + value: k8s + runAfter: + - buildah + taskRef: + kind: Task + name: deploy-image + workspaces: + - name: source + workspace: pipeline-workspace \ No newline at end of file