mirror of
https://github.com/bvanroll/stage-infra.git
synced 2025-08-28 19:42:43 +00:00
132 lines
3.5 KiB
YAML
132 lines
3.5 KiB
YAML
---
|
|
apiVersion: tekton.dev/v1beta1
|
|
kind: Pipeline
|
|
metadata:
|
|
name: 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)
|
|
|
|
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-build-and-push
|
|
taskRef:
|
|
name: github-set-status
|
|
runAfter:
|
|
- clone
|
|
params:
|
|
- name: REPO_FULL_NAME
|
|
value: $(params.git-repo-full-name)
|
|
- name: SHA
|
|
value: $(params.revision)
|
|
- name: STATE
|
|
value: pending
|
|
- name: TARGET_URL
|
|
value: http://tekton.llocal.host/dashboard
|
|
- name: DESCRIPTION
|
|
value: "Build and push has started"
|
|
|
|
- name: build-and-push
|
|
taskRef:
|
|
name: build-and-push
|
|
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-deploy
|
|
taskRef:
|
|
name: github-set-status
|
|
runAfter:
|
|
- build-and-push
|
|
params:
|
|
- name: REPO_FULL_NAME
|
|
value: $(params.git-repo-full-name)
|
|
- name: SHA
|
|
value: $(params.revision)
|
|
- name: STATE
|
|
value: "$(tasks.build-and-push.results.state)"
|
|
- name: TARGET_URL
|
|
value: http://ingress.llocal.host/$(params.git-repo-name)
|
|
- name: DESCRIPTION
|
|
value: "$(tasks.build-and-push.results.description)"
|
|
|
|
- name: deploy-app
|
|
taskRef:
|
|
name: deploy-yaml-file
|
|
runAfter:
|
|
- build-and-push
|
|
conditions:
|
|
- conditionRef: is-not-equal
|
|
params:
|
|
- name: left
|
|
value: "error"
|
|
- name: right
|
|
value: "$(tasks.build-and-push.results.state)"
|
|
|
|
- conditionRef: is-not-equal
|
|
params:
|
|
- name: left
|
|
value: "failure"
|
|
- name: right
|
|
value: "$(tasks.build-and-push.results.state)"
|
|
|
|
workspaces:
|
|
- name: source
|
|
workspace: workspace
|
|
params:
|
|
- name: deploy-name
|
|
value: "$(params.git-repo-name)"
|
|
- name: deploy-version
|
|
value: "$(params.branch)"
|
|
|
|
|
|
- name: set-status-finished
|
|
taskRef:
|
|
name: github-set-status
|
|
runAfter:
|
|
- deploy-app
|
|
params:
|
|
- name: REPO_FULL_NAME
|
|
value: $(params.git-repo-full-name)
|
|
- name: SHA
|
|
value: $(params.revision)
|
|
- name: STATE
|
|
value: "$(tasks.deploy-app.results.state)"
|
|
- name: TARGET_URL
|
|
value: http://tekton.llocal.host/$(params.git-repo-name)
|
|
- name: DESCRIPTION
|
|
value: "$(tasks.deploy-app.results.description)" |