Files
stage-infra/Tekton/pipeline/pipeline.yaml

125 lines
3.3 KiB
YAML

---
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: stage-application-pipeline
namespace: tekton-pipeline-1
spec:
params:
- name: git-repo-name
description: name of the git repo (used to determine the name of the image)
- name: git-url
description: url of the git repository to clone
- name: revision
description: revision to checkout
- name: branch
description: name of the master branch of the repository
- name: git-repo-full-name
description: full name of the github repo (used for status updates)
- name: sha
description: used for github status updates
workspaces:
- name: workspace
tasks:
- name: clone
taskRef:
name: git-clone
workspaces:
- name: output
workspace: workspace
params:
- name: url
value: $(params.git-url)
- name: revision
value: $(params.revision)
# - name: set-status-building
# taskRef:
# name: github-set-status
# runAfter:
# - clone
# params:
# - name: REPO_FULL_NAME
# value: $(params.git-repo-full-name)
# - name: SHA
# value: $(params.sha)
# - name: STATE
# value: pending
# - name: TARGET_URL
# value: http://ingress.llocal.host/$(params.git-repo-name)
# - name: DESCRIPTION
# value: "Build and push has started"
- name: build-and-push
taskRef:
name: build-and-push
conditions:
- conditionRef: "is-not-equal"
params:
- name: "left"
value: "stage-infra"
- name: "right"
value: "$(params.git-repo-name)"
runAfter:
- clone
Timeout: "1h30m00s"
workspaces:
- name: source
workspace: workspace
params:
- name: context
value: "src"
- name: image-name
value: "$(params.git-repo-name)"
- name: version
value: "$(params.branch)"
# - name: set-status-building
# taskRef:
# name: github-set-status
# runAfter:
# - build-and-push
# params:
# - name: REPO_FULL_NAME
# value: $(params.git-repo-full-name)
# - name: SHA
# value: $(params.sha)
# - name: STATE
# value: pending
# - name: TARGET_URL
# value: http://ingress.llocal.host/$(params.git-repo-name)
# - name: DESCRIPTION
# value: "Build and push has completed, starting deploy-app"
- name: deploy-app
taskRef:
name: deploy-app
runAfter:
- build-and-push
workspaces:
- name: source
workspace: workspace
params:
- name: deploy-name
value: "$(params.git-repo-name)"
- name: deploy-version
value: "$(params.branch)"
- name: set-status-building
taskRef:
name: github-set-status
runAfter:
- deploy-app
params:
- name: REPO_FULL_NAME
value: $(params.git-repo-full-name)
- name: SHA
value: $(params.sha)
- name: STATE
value: success
- name: TARGET_URL
value: http://tekton.llocal.host/$(params.git-repo-name)
- name: DESCRIPTION
value: "Deploy finished"