mirror of
https://github.com/bvanroll/stage-infra.git
synced 2025-08-28 19:42:43 +00:00
temp commit die ga falen
This commit is contained in:
21
Tekton/conditions/is-equal.yaml
Normal file
21
Tekton/conditions/is-equal.yaml
Normal 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
|
@@ -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:
|
||||
|
@@ -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
|
||||
|
27
Tekton/runs/task/webhook-backend.yaml
Normal file
27
Tekton/runs/task/webhook-backend.yaml
Normal 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
|
27
Tekton/runs/task/webhook-frontend.yaml
Normal file
27
Tekton/runs/task/webhook-frontend.yaml
Normal 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
|
@@ -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
|
27
Tekton/runs/task/webhook-mirror.yaml
Normal file
27
Tekton/runs/task/webhook-mirror.yaml
Normal 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
|
@@ -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
|
@@ -12,7 +12,6 @@ spec:
|
||||
- name: github-trigger-binding
|
||||
template:
|
||||
name: github-trigger-template
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
|
@@ -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.)"
|
@@ -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:
|
||||
|
Reference in New Issue
Block a user