Working version with hook-boot and gerrit.
This commit is contained in:
parent
a82cfc1323
commit
ce59c0c40b
|
|
@ -17,12 +17,18 @@ spec:
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: tekton-hook-bot
|
- name: tekton-hook-bot
|
||||||
image: 192.168.1.128:8443/tekton-hooks-bot:0.3
|
image: 192.168.1.128:8443/tekton-hooks-bot:0.7
|
||||||
env:
|
env:
|
||||||
- name: LISTEN_ADDR
|
- name: LISTEN_ADDR
|
||||||
value: 0.0.0.0:3000
|
value: 0.0.0.0:3000
|
||||||
- name: SERVICE_ADDR
|
- name: SERVICE_ADDR
|
||||||
value: el-test-listener:8080
|
value: http://el-git-pipeline-listener.default.svc.cluster.local:8080
|
||||||
|
- name: CLONE_URL
|
||||||
|
value: "ssh://tekton@gerrit.internal.jpace121.net:29418"
|
||||||
|
- name: FEEDBACK_URL
|
||||||
|
value: "tekton@gerrit.internal.jpace121.net"
|
||||||
|
- name: FEEDBACK_PORT
|
||||||
|
value: "29418"
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 3000
|
- containerPort: 3000
|
||||||
name: service-port
|
name: service-port
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,18 @@ metadata:
|
||||||
spec:
|
spec:
|
||||||
description: A test pipeline.
|
description: A test pipeline.
|
||||||
params:
|
params:
|
||||||
- name: repo-url
|
- name: clone_url
|
||||||
type: string
|
type: string
|
||||||
description: The git repository URL to clone from.
|
description: The git repository URL to clone from.
|
||||||
- name: commit
|
- name: commit
|
||||||
type: string
|
type: string
|
||||||
description: The git hash to checkout.
|
description: The git hash to checkout.
|
||||||
|
- name: feedback_url
|
||||||
|
type: string
|
||||||
|
description: The url to ssh into to post feedback using gerrit.
|
||||||
|
- name: feedback_port
|
||||||
|
type: string
|
||||||
|
description: The port on the feedback url to use to post feedback.
|
||||||
- name: use-gerrit
|
- name: use-gerrit
|
||||||
type: string
|
type: string
|
||||||
description: Should we report back to gerrit?
|
description: Should we report back to gerrit?
|
||||||
|
|
@ -29,7 +35,7 @@ spec:
|
||||||
workspace: git-credentials
|
workspace: git-credentials
|
||||||
params:
|
params:
|
||||||
- name: url
|
- name: url
|
||||||
value: $(params.repo-url)
|
value: $(params.clone_url)
|
||||||
- name: commit
|
- name: commit
|
||||||
value: $(params.commit)
|
value: $(params.commit)
|
||||||
taskRef:
|
taskRef:
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,13 @@ spec:
|
||||||
secret:
|
secret:
|
||||||
secretName: git-credentials
|
secretName: git-credentials
|
||||||
params:
|
params:
|
||||||
- name: repo-url
|
- name: clone_url
|
||||||
value: ssh://git@git.jpace121.net:2222/jimmy/tekton-test.git
|
value: ssh://git@git.jpace121.net:2222/jimmy/tekton-test.git
|
||||||
- name: commit
|
- name: commit
|
||||||
value: master
|
value: master
|
||||||
- name: use-gerrit
|
- name: use-gerrit
|
||||||
value: false
|
value: false
|
||||||
|
- name: feedback_url
|
||||||
|
value: ""
|
||||||
|
- name: feedback_port
|
||||||
|
value: ""
|
||||||
|
|
|
||||||
|
|
@ -18,4 +18,6 @@ spec:
|
||||||
chmod -R 400 ~/.ssh/*
|
chmod -R 400 ~/.ssh/*
|
||||||
git clone $(params.url) $(workspaces.output.path)
|
git clone $(params.url) $(workspaces.output.path)
|
||||||
cd $(workspaces.output.path)
|
cd $(workspaces.output.path)
|
||||||
git checkout -f $(params.commit)
|
git fetch origin $(params.commit)
|
||||||
|
git checkout -f $(params.commit) -b pr-check
|
||||||
|
git rebase origin/main
|
||||||
|
|
@ -1,70 +0,0 @@
|
||||||
---
|
|
||||||
apiVersion: triggers.tekton.dev/v1beta1
|
|
||||||
kind: EventListener
|
|
||||||
metadata:
|
|
||||||
name: test-listener
|
|
||||||
spec:
|
|
||||||
serviceAccountName: tekton-bot
|
|
||||||
triggers:
|
|
||||||
- name: test-trigger
|
|
||||||
bindings:
|
|
||||||
- ref: message-binding
|
|
||||||
template:
|
|
||||||
ref: pipeline-template
|
|
||||||
resources:
|
|
||||||
kubernetesResource:
|
|
||||||
serviceType: NodePort
|
|
||||||
---
|
|
||||||
apiVersion: triggers.tekton.dev/v1beta1
|
|
||||||
kind: TriggerBinding
|
|
||||||
metadata:
|
|
||||||
name: pipeline-binding
|
|
||||||
spec:
|
|
||||||
params:
|
|
||||||
- name: gitrevision
|
|
||||||
value: $(body.patchSet.revision)
|
|
||||||
---
|
|
||||||
apiVersion: triggers.tekton.dev/v1beta1
|
|
||||||
kind: TriggerBinding
|
|
||||||
metadata:
|
|
||||||
name: message-binding
|
|
||||||
spec:
|
|
||||||
params:
|
|
||||||
- name: gitrepositoryurl
|
|
||||||
value: ssh://tekton@gerrit.internal.jpace121.net:29418/ci/test
|
|
||||||
---
|
|
||||||
|
|
||||||
apiVersion: triggers.tekton.dev/v1beta1
|
|
||||||
kind: TriggerTemplate
|
|
||||||
metadata:
|
|
||||||
name: pipeline-template
|
|
||||||
spec:
|
|
||||||
params:
|
|
||||||
- name: gitrevision
|
|
||||||
description: The git revision
|
|
||||||
default: main
|
|
||||||
- name: gitrepositoryurl
|
|
||||||
description: The git repository url
|
|
||||||
resourcetemplates:
|
|
||||||
- apiVersion: tekton.dev/v1beta1
|
|
||||||
kind: PipelineRun
|
|
||||||
metadata:
|
|
||||||
generateName: test-run-
|
|
||||||
spec:
|
|
||||||
pipelineRef:
|
|
||||||
name: git-pipeline
|
|
||||||
params:
|
|
||||||
- name: repo-url
|
|
||||||
value: $(tt.params.gitrepositoryurl)
|
|
||||||
workspaces:
|
|
||||||
- name: shared-data
|
|
||||||
volumeClaimTemplate:
|
|
||||||
spec:
|
|
||||||
accessModes:
|
|
||||||
- ReadWriteOnce
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
storage: 1Gi
|
|
||||||
- name: git-credentials
|
|
||||||
secret:
|
|
||||||
secretName: git-credentials
|
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
---
|
||||||
|
apiVersion: triggers.tekton.dev/v1beta1
|
||||||
|
kind: EventListener
|
||||||
|
metadata:
|
||||||
|
name: git-pipeline-listener
|
||||||
|
spec:
|
||||||
|
serviceAccountName: tekton-bot
|
||||||
|
triggers:
|
||||||
|
- name: git-pipeline-trigger
|
||||||
|
bindings:
|
||||||
|
- ref: git-pipeline-binding
|
||||||
|
template:
|
||||||
|
ref: git-pipeline-template
|
||||||
|
resources:
|
||||||
|
kubernetesResource:
|
||||||
|
serviceType: ClusterIP
|
||||||
|
---
|
||||||
|
apiVersion: triggers.tekton.dev/v1beta1
|
||||||
|
kind: TriggerBinding
|
||||||
|
metadata:
|
||||||
|
name: git-pipeline-binding
|
||||||
|
spec:
|
||||||
|
params:
|
||||||
|
- name: commit
|
||||||
|
value: $(body.commit)
|
||||||
|
- name: clone_url
|
||||||
|
value: $(body.clone_url)
|
||||||
|
- name: feedback_url
|
||||||
|
value: $(body.feedback_url)
|
||||||
|
- name: feedback_port
|
||||||
|
value: $(body.feedback_port)
|
||||||
|
- name: use-gerrit
|
||||||
|
value: "true"
|
||||||
|
---
|
||||||
|
|
||||||
|
apiVersion: triggers.tekton.dev/v1beta1
|
||||||
|
kind: TriggerTemplate
|
||||||
|
metadata:
|
||||||
|
name: git-pipeline-template
|
||||||
|
spec:
|
||||||
|
params:
|
||||||
|
- name: commit
|
||||||
|
- name: clone_url
|
||||||
|
- name: feedback_url
|
||||||
|
- name: feedback_port
|
||||||
|
- name: use-gerrit
|
||||||
|
resourcetemplates:
|
||||||
|
- apiVersion: tekton.dev/v1beta1
|
||||||
|
kind: PipelineRun
|
||||||
|
metadata:
|
||||||
|
generateName: test-run-
|
||||||
|
spec:
|
||||||
|
pipelineRef:
|
||||||
|
name: git-pipeline
|
||||||
|
params:
|
||||||
|
- name: commit
|
||||||
|
value: $(tt.params.commit)
|
||||||
|
- name: clone_url
|
||||||
|
value: $(tt.params.clone_url)
|
||||||
|
- name: feedback_url
|
||||||
|
value: $(tt.params.feedback_url)
|
||||||
|
- name: feedback_port
|
||||||
|
value: $(tt.params.feedback_port)
|
||||||
|
- name: use-gerrit
|
||||||
|
value: $(tt.params.use-gerrit)
|
||||||
|
workspaces:
|
||||||
|
- name: shared-data
|
||||||
|
volumeClaimTemplate:
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 1Gi
|
||||||
|
- name: git-credentials
|
||||||
|
secret:
|
||||||
|
secretName: git-credentials
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
apiVersion: networking.k8s.io/v1
|
|
||||||
kind: Ingress
|
|
||||||
metadata:
|
|
||||||
name: git-tekton-ingress
|
|
||||||
annotations:
|
|
||||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
|
||||||
spec:
|
|
||||||
rules:
|
|
||||||
- host: tekton.internal.jpace121.net
|
|
||||||
http:
|
|
||||||
paths:
|
|
||||||
- path: /test-events/
|
|
||||||
pathType: Prefix
|
|
||||||
backend:
|
|
||||||
service:
|
|
||||||
name: el-test-listener
|
|
||||||
port:
|
|
||||||
number: 8080
|
|
||||||
Loading…
Reference in New Issue