Track otherwise untracked changes.
This commit is contained in:
parent
52dcab2621
commit
a82cfc1323
|
|
@ -0,0 +1,58 @@
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: tekton-hook-bot-deployment
|
||||||
|
labels:
|
||||||
|
app: tekton-hook-bot
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: tekton-hook-bot
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: tekton-hook-bot
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: tekton-hook-bot
|
||||||
|
image: 192.168.1.128:8443/tekton-hooks-bot:0.3
|
||||||
|
env:
|
||||||
|
- name: LISTEN_ADDR
|
||||||
|
value: 0.0.0.0:3000
|
||||||
|
- name: SERVICE_ADDR
|
||||||
|
value: el-test-listener:8080
|
||||||
|
ports:
|
||||||
|
- containerPort: 3000
|
||||||
|
name: service-port
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: hook-bot-service
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: tekton-hook-bot
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
targetPort: 3000
|
||||||
|
port: 3000
|
||||||
|
name: service-port
|
||||||
|
---
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: hook-bot-ingress
|
||||||
|
spec:
|
||||||
|
rules:
|
||||||
|
- host: tekton.internal.jpace121.net
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: hook-bot-service
|
||||||
|
port:
|
||||||
|
number: 3000
|
||||||
|
|
@ -8,6 +8,13 @@ spec:
|
||||||
- name: repo-url
|
- name: repo-url
|
||||||
type: string
|
type: string
|
||||||
description: The git repository URL to clone from.
|
description: The git repository URL to clone from.
|
||||||
|
- name: commit
|
||||||
|
type: string
|
||||||
|
description: The git hash to checkout.
|
||||||
|
- name: use-gerrit
|
||||||
|
type: string
|
||||||
|
description: Should we report back to gerrit?
|
||||||
|
default: "false"
|
||||||
workspaces:
|
workspaces:
|
||||||
- name: shared-data
|
- name: shared-data
|
||||||
description: Shared data.
|
description: Shared data.
|
||||||
|
|
@ -23,9 +30,10 @@ spec:
|
||||||
params:
|
params:
|
||||||
- name: url
|
- name: url
|
||||||
value: $(params.repo-url)
|
value: $(params.repo-url)
|
||||||
|
- name: commit
|
||||||
|
value: $(params.commit)
|
||||||
taskRef:
|
taskRef:
|
||||||
name: j7s-git-clone
|
name: j7s-git-clone
|
||||||
|
|
||||||
- name: cat-readme
|
- name: cat-readme
|
||||||
runAfter: ["fetch-repo"]
|
runAfter: ["fetch-repo"]
|
||||||
workspaces:
|
workspaces:
|
||||||
|
|
@ -39,3 +47,41 @@ spec:
|
||||||
script: |
|
script: |
|
||||||
set -x
|
set -x
|
||||||
cat $(workspaces.source.path)/README
|
cat $(workspaces.source.path)/README
|
||||||
|
|
||||||
|
finally:
|
||||||
|
- name: notify-gerrit-success
|
||||||
|
when:
|
||||||
|
- input: $(tasks.status)
|
||||||
|
operator: notin
|
||||||
|
values: ["Failed"]
|
||||||
|
- input: $(params.use-gerrit)
|
||||||
|
operator: in
|
||||||
|
values: ["true"]
|
||||||
|
params:
|
||||||
|
- name: commit
|
||||||
|
value: $(params.commit)
|
||||||
|
- name: build-id
|
||||||
|
value: $(context.pipelineRun.name)
|
||||||
|
workspaces:
|
||||||
|
- name: ssh-directory
|
||||||
|
workspace: git-credentials
|
||||||
|
taskRef:
|
||||||
|
name: j7s-gerrit-success
|
||||||
|
- name: notify-gerrit-failed
|
||||||
|
when:
|
||||||
|
- input: $(tasks.status)
|
||||||
|
operator: in
|
||||||
|
values: ["Failed"]
|
||||||
|
- input: $(params.use-gerrit)
|
||||||
|
operator: in
|
||||||
|
values: ["true"]
|
||||||
|
params:
|
||||||
|
- name: commit
|
||||||
|
value: $(params.commit)
|
||||||
|
- name: build-id
|
||||||
|
value: $(context.pipelineRun.name)
|
||||||
|
workspaces:
|
||||||
|
- name: ssh-directory
|
||||||
|
workspace: git-credentials
|
||||||
|
taskRef:
|
||||||
|
name: j7s-gerrit-fail
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
apiVersion: tekton.dev/v1beta1
|
apiVersion: tekton.dev/v1beta1
|
||||||
kind: PipelineRun
|
kind: PipelineRun
|
||||||
metadata:
|
metadata:
|
||||||
name: with-good-layout
|
name: with-good-layout-9
|
||||||
spec:
|
spec:
|
||||||
pipelineRef:
|
pipelineRef:
|
||||||
name: git-pipeline
|
name: git-pipeline
|
||||||
|
|
@ -20,3 +20,7 @@ spec:
|
||||||
params:
|
params:
|
||||||
- name: repo-url
|
- name: repo-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
|
||||||
|
value: master
|
||||||
|
- name: use-gerrit
|
||||||
|
value: false
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
apiVersion: tekton.dev/v1beta1
|
||||||
|
kind: Task
|
||||||
|
metadata:
|
||||||
|
name: j7s-gerrit-fail
|
||||||
|
spec:
|
||||||
|
workspaces:
|
||||||
|
- name: ssh-directory
|
||||||
|
params:
|
||||||
|
- name: commit
|
||||||
|
- name: build-id
|
||||||
|
steps:
|
||||||
|
- image: 192.168.1.128:8443/gitssh:latest
|
||||||
|
script: |
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
|
cp -r $(workspaces.ssh-directory.path) ~/.ssh
|
||||||
|
chmod 700 ~/.ssh
|
||||||
|
chmod -R 400 ~/.ssh/*
|
||||||
|
ssh -p 29418 tekton@gerrit.internal.jpace121.net gerrit review \
|
||||||
|
-m '"Build failed. ID: $(params.build-id)"' \
|
||||||
|
--verified -1 \
|
||||||
|
$(params.commit)
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
apiVersion: tekton.dev/v1beta1
|
||||||
|
kind: Task
|
||||||
|
metadata:
|
||||||
|
name: j7s-gerrit-success
|
||||||
|
spec:
|
||||||
|
workspaces:
|
||||||
|
- name: ssh-directory
|
||||||
|
params:
|
||||||
|
- name: commit
|
||||||
|
- name: build-id
|
||||||
|
steps:
|
||||||
|
- image: 192.168.1.128:8443/gitssh:latest
|
||||||
|
script: |
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
|
cp -r $(workspaces.ssh-directory.path) ~/.ssh
|
||||||
|
chmod 700 ~/.ssh
|
||||||
|
chmod -R 400 ~/.ssh/*
|
||||||
|
ssh -p 29418 tekton@gerrit.internal.jpace121.net gerrit review \
|
||||||
|
-m '"Build success. ID: $(params.build-id)"' \
|
||||||
|
--verified +1 \
|
||||||
|
$(params.commit)
|
||||||
|
|
@ -8,6 +8,7 @@ spec:
|
||||||
- name: ssh-directory
|
- name: ssh-directory
|
||||||
params:
|
params:
|
||||||
- name: url
|
- name: url
|
||||||
|
- name: commit
|
||||||
steps:
|
steps:
|
||||||
- image: 192.168.1.128:8443/gitssh:latest
|
- image: 192.168.1.128:8443/gitssh:latest
|
||||||
script: |
|
script: |
|
||||||
|
|
@ -15,4 +16,6 @@ spec:
|
||||||
cp -r $(workspaces.ssh-directory.path) ~/.ssh
|
cp -r $(workspaces.ssh-directory.path) ~/.ssh
|
||||||
chmod 700 ~/.ssh
|
chmod 700 ~/.ssh
|
||||||
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)
|
||||||
|
git checkout -f $(params.commit)
|
||||||
Loading…
Reference in New Issue