temp commit die ga falen

This commit is contained in:
2020-03-16 13:04:01 +01:00
parent defdbaa3ab
commit c7474c0132
11 changed files with 120 additions and 9 deletions

View File

@@ -0,0 +1,21 @@
apiVersion: tekton.dev/v1alpha1
kind: Condition
metadata:
name: is-equal
spec:
params:
- name: left
type: string
- name: right
type: string
check:
image: alpine
script: |
#!/bin/sh
if [ $(params.left) = $(params.right) ]; then
echo "$(params.left) == $(params.right)"
exit 0
else
echo "$(params.left) != $(params.right)"
exit 1
fi

View File

@@ -28,6 +28,13 @@ spec:
- name: build-and-push
taskRef:
name: build-and-push
conditions:
- conditionRef: "file-exists"
params:
- name: "left"
value: "stage-infra"
- name: "right"
value: "$(inputs.params.git-repo-name)"
runAfter:
- clone
workspaces:

View File

@@ -3,7 +3,6 @@ apiVersion: v1
kind: Secret
metadata:
name: github-secret
namespace: tekton-pipeline-istio-project-1
stringData:
token: GITHUBSECRETTOKEN
token: SECRETSTRING
secret: random-string-data

View File

@@ -0,0 +1,27 @@
---
# https://medium.com/@nikhilthomas1/cloud-native-cicd-on-openshift-with-openshift-pipelines-tektoncd-pipelines-part-3-github-1db6dd8e8ca7
apiVersion: tekton.dev/v1alpha1
kind: TaskRun
metadata:
name: create-repo-webhook-backend
spec:
taskRef:
name: create-webhook
inputs:
params:
- name: GitHubOrg
value: "beppevanrolleghem"
- name: GitHubUser
value: "beppevanrolleghem"
- name: GitHubRepo
value: "stage-backend"
- name: GitHubSecretName
value: webhook-secret
- name: GitHubAccessTokenKey
value: token
- name: GitHubSecretStringKey
value: secret
- name: ExternalDomain
value: "104.155.67.175:8080"
timeout: 1000s
serviceAccountName: service-acc

View File

@@ -0,0 +1,27 @@
---
# https://medium.com/@nikhilthomas1/cloud-native-cicd-on-openshift-with-openshift-pipelines-tektoncd-pipelines-part-3-github-1db6dd8e8ca7
apiVersion: tekton.dev/v1alpha1
kind: TaskRun
metadata:
name: create-repo-webhook-frontend
spec:
taskRef:
name: create-webhook
inputs:
params:
- name: GitHubOrg
value: "beppevanrolleghem"
- name: GitHubUser
value: "beppevanrolleghem"
- name: GitHubRepo
value: "stage-frontend"
- name: GitHubSecretName
value: webhook-secret
- name: GitHubAccessTokenKey
value: token
- name: GitHubSecretStringKey
value: secret
- name: ExternalDomain
value: "104.155.67.175:8080"
timeout: 1000s
serviceAccountName: service-acc

View File

@@ -3,7 +3,7 @@
apiVersion: tekton.dev/v1alpha1
kind: TaskRun
metadata:
name: create-repo-webhook
name: create-repo-webhook-infra
spec:
taskRef:
name: create-webhook
@@ -14,7 +14,7 @@ spec:
- name: GitHubUser
value: "beppevanrolleghem"
- name: GitHubRepo
value: "cicdTest"
value: "stage-infra"
- name: GitHubSecretName
value: webhook-secret
- name: GitHubAccessTokenKey
@@ -22,6 +22,6 @@ spec:
- name: GitHubSecretStringKey
value: secret
- name: ExternalDomain
value: "ingress.llocal.host"
value: "104.155.67.175:8080"
timeout: 1000s
serviceAccountName: service-acc

View File

@@ -0,0 +1,27 @@
---
# https://medium.com/@nikhilthomas1/cloud-native-cicd-on-openshift-with-openshift-pipelines-tektoncd-pipelines-part-3-github-1db6dd8e8ca7
apiVersion: tekton.dev/v1alpha1
kind: TaskRun
metadata:
name: create-repo-webhook-mirror
spec:
taskRef:
name: create-webhook
inputs:
params:
- name: GitHubOrg
value: "beppevanrolleghem"
- name: GitHubUser
value: "beppevanrolleghem"
- name: GitHubRepo
value: "stage-mirror-service"
- name: GitHubSecretName
value: webhook-secret
- name: GitHubAccessTokenKey
value: token
- name: GitHubSecretStringKey
value: secret
- name: ExternalDomain
value: "104.155.67.175:8080"
timeout: 1000s
serviceAccountName: service-acc

View File

@@ -44,7 +44,7 @@ spec:
set -e
echo "Create Webhook"
if [ $(inputs.params.GitHubDomain) = "github.com" ];then
curl -v -d "{\"name\": \"web\",\"active\": true,\"events\": $(inputs.params.WebhookEvents),\"config\": {\"url\": \"https://$(inputs.params.ExternalDomain)\",\"content_type\": \"json\",\"insecure_ssl\": \"1\" ,\"secret\": \"$(cat /var/secret/$(inputs.params.GitHubSecretStringKey))\"}}" -X POST -u $(inputs.params.GitHubUser):$(cat /var/secret/$(inputs.params.GitHubAccessTokenKey)) -L https://api.github.com/repos/$(inputs.params.GitHubOrg)/$(inputs.params.GitHubRepo)/hooks
curl -v -d "{\"name\": \"web\",\"active\": true,\"events\": $(inputs.params.WebhookEvents),\"config\": {\"url\": \"https://$(inputs.params.ExternalDomain)\",\"content_type\": \"json\",\"insecure_ssl\": \"0\" ,\"secret\": \"$(cat /var/secret/$(inputs.params.GitHubSecretStringKey))\"}}" -X POST -u $(inputs.params.GitHubUser):$(cat /var/secret/$(inputs.params.GitHubAccessTokenKey)) -L https://api.github.com/repos/$(inputs.params.GitHubOrg)/$(inputs.params.GitHubRepo)/hooks
else
curl -d "{\"name\": \"web\",\"active\": true,\"events\": $(inputs.params.WebhookEvents),\"config\": {\"url\": \"https://$(inputs.params.ExternalDomain)/\",\"content_type\": \"json\",\"insecure_ssl\": \"1\" ,\"secret\": \"$(cat /var/secret/$(inputs.params.GitHubSecretStringKey))\"}}" -X POST -u $(inputs.params.GitHubUser):$(cat /var/secret/$(inputs.params.GitHubAccessTokenKey)) -L https://$(inputs.params.GitHubDomain)/api/v3/repos/$(inputs.params.GitHubOrg)/$(inputs.params.GitHubRepo)/hooks
fi

View File

@@ -12,7 +12,6 @@ spec:
- name: github-trigger-binding
template:
name: github-trigger-template
---
apiVersion: v1
kind: Service

View File

@@ -10,4 +10,6 @@ spec:
- name: gitrepositoryurl
value: $(body.repository.clone_url)
- name: gitreponame
value: $(body.repository.name)
value: $(body.repository.name)
- name: pipelinename
value: "pipeline for commit $(body.)"

View File

@@ -12,11 +12,13 @@ spec:
description: The git repository url
- name: gitreponame
description: the name of the git repository
- name: pipelinename
description: name the pipelinerun will have
resourcetemplates:
- apiVersion: tekton.dev/v1alpha1
kind: PipelineRun
metadata:
name: application-pipeline-run
name: $(inputs.params.pipelinename)
spec:
serviceAccountName: service-acc
pipelineRef: