Browse Source

argocd hook to create a pipelinerun

gitops
Nicolas Massé 3 years ago
parent
commit
00c36c25f7
  1. 61
      k8s/pipelinerun.yaml
  2. 1
      k8s/vm-database.yaml

61
k8s/pipelinerun.yaml

@ -1,10 +1,14 @@
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
apiVersion: v1
kind: ConfigMap
metadata:
name: demo-appdev-initial
annotations:
argocd.argoproj.io/sync-wave: "2"
spec:
name: pipelinerun-template
data:
template: |
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
generateName: demo-appdev-
spec:
serviceAccountName: tekton-robot
pipelineRef:
name: demo-appdev
@ -22,3 +26,48 @@ spec:
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: tekton-hook
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: tekton-hook
rules:
- apiGroups: ["tekton.dev"]
resources: ["pipelineruns"]
verbs: ["create"]
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: tekton-hook
subjects:
- kind: ServiceAccount
name: tekton-hook
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: tekton-hook
---
apiVersion: batch/v1
kind: Job
metadata:
name: tekton-hook
annotations:
argocd.argoproj.io/sync-wave: "2"
spec:
template:
spec:
containers:
- name: oc
image: image-registry.openshift-image-registry.svc:5000/openshift/cli
command: ["/bin/sh", "-c", "oc get configmap pipelinerun-template -n demo-appdev -o 'jsonpath={.data.template}' | oc create -f - -n demo-appdev"]
restartPolicy: Never
serviceAccountName: tekton-hook

1
k8s/vm-database.yaml

@ -63,6 +63,7 @@ apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
annotations:
argocd.argoproj.io/sync-wave: "2"
labels:
app: database
name: database

Loading…
Cancel
Save