Browse Source

argocd hook to create a pipelinerun

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

89
k8s/pipelinerun.yaml

@ -1,24 +1,73 @@
apiVersion: tekton.dev/v1beta1 apiVersion: v1
kind: PipelineRun kind: ConfigMap
metadata: metadata:
name: demo-appdev-initial name: pipelinerun-template
data:
template: |
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
generateName: demo-appdev-
spec:
serviceAccountName: tekton-robot
pipelineRef:
name: demo-appdev
params:
- name: gitRepositoryURL
value: https://github.com/nmasse-itix/demo-appdev.git
- name: outputContainerImage
value: image-registry.openshift-image-registry.svc:5000/demo-appdev/function
workspaces:
- name: scratch
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
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: annotations:
argocd.argoproj.io/sync-wave: "2" argocd.argoproj.io/sync-wave: "2"
spec: spec:
serviceAccountName: tekton-robot template:
pipelineRef: spec:
name: demo-appdev containers:
params: - name: oc
- name: gitRepositoryURL image: image-registry.openshift-image-registry.svc:5000/openshift/cli
value: https://github.com/nmasse-itix/demo-appdev.git command: ["/bin/sh", "-c", "oc get configmap pipelinerun-template -n demo-appdev -o 'jsonpath={.data.template}' | oc create -f - -n demo-appdev"]
- name: outputContainerImage restartPolicy: Never
value: image-registry.openshift-image-registry.svc:5000/demo-appdev/function serviceAccountName: tekton-hook
workspaces:
- name: scratch
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi

1
k8s/vm-database.yaml

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

Loading…
Cancel
Save