Add custom multibranch pipeline runner.
This commit is contained in:
parent
fb84fe1324
commit
3ed31d4bcd
|
|
@ -0,0 +1,41 @@
|
|||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: test-branch-pipeline-deployment
|
||||
namespace: j7s-ci
|
||||
labels:
|
||||
app: test-branch-pipeline
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: test-branch-pipeline
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: test-branch-pipeline
|
||||
spec:
|
||||
volumes:
|
||||
- name: ssh-volume
|
||||
secret:
|
||||
secretName: git-credentials
|
||||
containers:
|
||||
- name: branch-pipeline
|
||||
image: 192.168.1.149:8443/j7s_branch_trigger:0.2
|
||||
command: ["/bin/bash", "-c"]
|
||||
volumeMounts:
|
||||
- mountPath: /ssh-volume
|
||||
name: ssh-volume
|
||||
env:
|
||||
- name: J7S_REPO
|
||||
value: "ssh://git.jpace121.net:2222/tests/job-test"
|
||||
- name: J7S_URL
|
||||
value: http://el-test-pipeline-listener.j7s-ci.svc.cluster.local:8080
|
||||
args:
|
||||
- |
|
||||
cp -r /ssh-volume ~/.ssh
|
||||
chmod 700 ~/.ssh
|
||||
chmod -R 400 ~/.ssh/*
|
||||
|
||||
j7s_branch_trigger
|
||||
|
|
@ -12,6 +12,9 @@ spec:
|
|||
description: Shared data.
|
||||
- name: git-credentials
|
||||
description: tekton git credentials
|
||||
params:
|
||||
- name: hash
|
||||
default: HEAD
|
||||
tasks:
|
||||
- name: fetch-repo
|
||||
workspaces:
|
||||
|
|
@ -22,10 +25,10 @@ spec:
|
|||
params:
|
||||
- name: url
|
||||
value: ssh://git.jpace121.net:2222/tests/job-test
|
||||
- name: branch
|
||||
value: master
|
||||
- name: hash
|
||||
value: $(params.hash)
|
||||
taskRef:
|
||||
name: j7s-git-clone
|
||||
name: j7s-git-clone-hash
|
||||
- name: cat-readme
|
||||
runAfter: ["fetch-repo"]
|
||||
workspaces:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
apiVersion: tekton.dev/v1beta1
|
||||
kind: Task
|
||||
metadata:
|
||||
name: j7s-git-clone-hash
|
||||
namespace: j7s-ci
|
||||
spec:
|
||||
workspaces:
|
||||
- name: output
|
||||
- name: ssh-directory
|
||||
params:
|
||||
- name: url
|
||||
- name: hash
|
||||
steps:
|
||||
- image: 192.168.1.149:8443/gitssh:latest
|
||||
script: |
|
||||
set -x
|
||||
cp -r $(workspaces.ssh-directory.path) ~/.ssh
|
||||
chmod 700 ~/.ssh
|
||||
chmod -R 400 ~/.ssh/*
|
||||
|
||||
git clone $(params.url) $(workspaces.output.path)
|
||||
cd $(workspaces.output.path)
|
||||
git checkout $(params.hash)
|
||||
|
|
@ -23,8 +23,8 @@ metadata:
|
|||
namespace: j7s-ci
|
||||
spec:
|
||||
params:
|
||||
- name: pr-id
|
||||
value: $(body.pr-id)
|
||||
- name: hash
|
||||
value: $(body.hash)
|
||||
---
|
||||
apiVersion: triggers.tekton.dev/v1beta1
|
||||
kind: TriggerTemplate
|
||||
|
|
@ -33,7 +33,7 @@ metadata:
|
|||
namespace: j7s-ci
|
||||
spec:
|
||||
params:
|
||||
- name: pr-id
|
||||
- name: hash
|
||||
resourcetemplates:
|
||||
- apiVersion: tekton.dev/v1beta1
|
||||
kind: PipelineRun
|
||||
|
|
@ -41,10 +41,10 @@ spec:
|
|||
generateName: test-pipeline-
|
||||
spec:
|
||||
pipelineRef:
|
||||
name: test-pipeline
|
||||
name: test-report-pipeline
|
||||
params:
|
||||
- name: pr-id
|
||||
value: "$(tt.params.pr-id)"
|
||||
- name: hash
|
||||
value: "$(tt.params.hash)"
|
||||
workspaces:
|
||||
- name: shared-data
|
||||
volumeClaimTemplate:
|
||||
|
|
|
|||
Loading…
Reference in New Issue