khuedoan-homelab/.ci/pipeline.yaml

114 lines
2.6 KiB
YAML
Raw Normal View History

apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: homelab
spec:
workspaces:
- name: shared-data
tasks:
2022-05-14 19:04:46 +07:00
- name: git-clone
taskRef:
name: git-clone
workspaces:
- name: output
workspace: shared-data
params:
- name: url
value: http://gitea-http.gitea:3000/ops/homelab
- name: revision
value: master
2022-05-14 19:04:46 +07:00
- name: tools
2021-12-27 00:30:16 +07:00
runAfter:
2022-05-14 19:04:46 +07:00
- git-clone
2021-12-27 00:30:16 +07:00
workspaces:
- name: source
workspace: shared-data
2022-05-14 19:04:46 +07:00
# TODO secure registry
# - name: dockerconfig
# workspace: dockerconfig
2021-12-27 00:30:16 +07:00
taskRef:
2022-05-14 19:04:46 +07:00
name: kaniko
params:
- name: CONTEXT
value: ./tools
- name: IMAGE
value: registry.khuedoan.com/tools:latest
- name: EXTRA_ARGS
value:
- --cache=true
- name: pre-commit
2022-05-14 19:04:46 +07:00
runAfter:
- tools
workspaces:
- name: source
workspace: shared-data
2022-05-14 21:08:18 +07:00
taskSpec:
workspaces:
- name: source
stepTemplate:
image: registry.khuedoan.com/tools:latest
workingDir: /workspace/source
2022-05-14 21:08:18 +07:00
steps:
- name: run
2022-05-14 21:08:18 +07:00
command:
- pre-commit
2022-05-14 21:08:18 +07:00
args:
- run
# - --all-files
- --color=always
2022-05-14 19:04:46 +07:00
- name: external
runAfter:
- pre-commit
workspaces:
- name: source
workspace: shared-data
2022-05-14 19:04:46 +07:00
taskSpec:
workspaces:
- name: source
2022-05-14 20:59:15 +07:00
volumes:
- name: terraform-secrets
secret:
secretName: terraform-secrets
2022-05-14 19:04:46 +07:00
stepTemplate:
image: registry.khuedoan.com/tools:latest
workingDir: /workspace/source/external
2022-05-14 20:59:15 +07:00
volumeMounts:
- name: terraform-secrets
mountPath: /root/.terraform.d/credentials.tfrc.json
subPath: credentials.tfrc.json
- name: terraform-secrets
mountPath: /workspace/source/external/terraform.tfvars
subPath: terraform.tfvars
2022-05-14 19:04:46 +07:00
command:
- make
steps:
- name: plan
args:
- plan
- name: apply
args:
- apply
---
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
2021-12-27 00:30:16 +07:00
name: homelab
spec:
2022-05-14 20:59:15 +07:00
serviceAccountName: tekton-admin
pipelineRef:
name: homelab
workspaces:
- name: shared-data
volumeClaimTemplate:
spec:
2021-12-24 18:50:24 +07:00
storageClassName: longhorn
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi