111 lines
3.2 KiB
YAML
111 lines
3.2 KiB
YAML
apiVersion: tekton.dev/v1beta1
|
|
kind: Pipeline
|
|
metadata:
|
|
name: {{.Values.config.prefix}}-pipeline
|
|
spec:
|
|
## TODO https://tekton.dev/docs/pipelines/pipelines/#using-execution-status-of-pipelinetask
|
|
description: |
|
|
This pipeline builds batleforc template-rust.
|
|
params:
|
|
- name: repo-url
|
|
type: string
|
|
description: The git repo URL to clone from.
|
|
- name: repo-branch
|
|
type: string
|
|
default: main
|
|
description: The git repo branch to clone from.
|
|
- name: repo-revision
|
|
type: string
|
|
default: main
|
|
description: The git repo revision to clone from.
|
|
workspaces:
|
|
- name: shared-data
|
|
description: |
|
|
This workspace contains the cloned repo files, so they can be read by the
|
|
next task.
|
|
- name: dockerconfig
|
|
description: |
|
|
This workspace contains the docker config.json file, so it can be used by
|
|
the next task.
|
|
- name: kubeconfig
|
|
description: |
|
|
This workspace contains the kubeconfig file, it define the namespace to rollout.
|
|
{{- if .Values.config.sonarqube.useToken }}
|
|
- name: sonarqube
|
|
description: |
|
|
This workspace contains the sonarqube credentials.
|
|
{{- end }}
|
|
tasks:
|
|
- name: fetch-source
|
|
taskRef:
|
|
name: git-clone
|
|
workspaces:
|
|
- name: output
|
|
workspace: shared-data
|
|
params:
|
|
- name: url
|
|
value: $(params.repo-url)
|
|
- name: revision
|
|
value: $(params.repo-revision)
|
|
- name: build-docker
|
|
runAfter: ["fetch-source"]
|
|
taskRef:
|
|
name: build
|
|
workspaces:
|
|
- name: shared-data
|
|
workspace: shared-data
|
|
- name: dockerconfig
|
|
workspace: dockerconfig
|
|
params:
|
|
- name: path-dockerfile
|
|
value: .
|
|
- name: context-dockerfile
|
|
value: .
|
|
- name: IMAGE
|
|
value: {{.Values.config.registry.imageName}}
|
|
- name: repo-branch
|
|
value: $(params.repo-branch)
|
|
{{ if .Values.config.sonarqube.enabled }}
|
|
- name: sonarqube-scan
|
|
runAfter: ["build-docker"]
|
|
taskRef:
|
|
name: sonarqube-scanner
|
|
workspaces:
|
|
- name: source
|
|
workspace: shared-data
|
|
{{ if .Values.config.sonarqube.useToken }}
|
|
- name: sonar-credentials
|
|
workspace: sonarqube
|
|
{{ end }}
|
|
params:
|
|
- name: SONAR_HOST_URL
|
|
value: {{.Values.config.sonarqube.host}}
|
|
- name: SONAR_SCANNER_IMAGE
|
|
value: {{.Values.config.sonarqube.image}}
|
|
{{ if .Values.config.sonarqube.useToken }}
|
|
- name: SONAR_TOKEN_KEY
|
|
value: token
|
|
{{ end }}
|
|
{{ end }}
|
|
- name: helm-upgrade
|
|
{{ if .Values.config.sonarqube.enabled }}
|
|
runAfter: ["sonarqube-scan"]
|
|
{{ else }}
|
|
runAfter: ["build-docker"]
|
|
{{ end }}
|
|
taskRef:
|
|
name: helm-upgrade-from-source
|
|
workspaces:
|
|
- name: source
|
|
workspace: shared-data
|
|
- name: kubeconfig-dir
|
|
workspace: kubeconfig
|
|
params:
|
|
- name: charts_dir
|
|
value: ./chart
|
|
- name: release_name
|
|
value: $(params.repo-branch)
|
|
- name: release_namespace
|
|
value: {{.Release.Namespace}}
|
|
- name: overwrite_values
|
|
value: "image.tag=$(params.repo-branch)" |