mirror of
https://github.com/bvanroll/cicdTest.git
synced 2025-08-29 12:02:47 +00:00
198 lines
4.4 KiB
YAML
198 lines
4.4 KiB
YAML
---
|
|
apiVersion: v1
|
|
kind: Namespace
|
|
metadata:
|
|
name: tekton-pipeline-istio-project-1
|
|
labels:
|
|
istio-injection: enabled #zorgt voor auto sidecar injection
|
|
---
|
|
apiVersion: v1
|
|
kind: ServiceAccount
|
|
metadata:
|
|
name: service-acc
|
|
namespace: tekton-pipeline-istio-project-1
|
|
secrets:
|
|
- name: regcred
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: ClusterRole
|
|
metadata:
|
|
name: allow-creation
|
|
rules:
|
|
- apiGroups:
|
|
- ""
|
|
resources:
|
|
- "*"
|
|
verbs:
|
|
- list
|
|
- watch
|
|
- get
|
|
- create
|
|
- update
|
|
- patch
|
|
- delete
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1beta1
|
|
kind: ClusterRoleBinding
|
|
metadata:
|
|
name: allow-creation-binding
|
|
roleRef:
|
|
apiGroup: rbac.authorization.k8s.io
|
|
kind: ClusterRole
|
|
name: allow-creation
|
|
subjects:
|
|
- kind: ServiceAccount
|
|
name: service-acc
|
|
namespace: tekton-pipeline-istio-project-1
|
|
---
|
|
apiVersion: tekton.dev/v1alpha1
|
|
kind: PipelineResource
|
|
metadata:
|
|
name: git
|
|
namespace: tekton-pipeline-istio-project-1
|
|
spec:
|
|
type: git
|
|
params:
|
|
- name: revision
|
|
value: master
|
|
- name: url
|
|
value: git://github.com/beppevanrolleghem/cicdTest
|
|
---
|
|
apiVersion: tekton.dev/v1alpha1
|
|
kind: Task
|
|
metadata:
|
|
name: build-and-push
|
|
namespace: tekton-pipeline-istio-project-1
|
|
spec:
|
|
inputs:
|
|
resources:
|
|
- name: git-source
|
|
type: git
|
|
params:
|
|
- name: pathToContext
|
|
description: The path to the build context, used by Kaniko - within the workspace
|
|
default: .
|
|
- name: pathToDockerfile
|
|
description: self explanitory
|
|
default: Dockerfile
|
|
- name: imageUrl
|
|
description: dockerhub url
|
|
steps:
|
|
- name: build-and-push
|
|
image: gcr.io/kaniko-project/executor
|
|
env:
|
|
- name: "DOCKER_CONFIG"
|
|
value: "/tekton/home/.docker/"
|
|
command:
|
|
- /kaniko/executor
|
|
args:
|
|
- "--dockerfile=dockerfile"
|
|
- "--destination=beppev/$(inputs.params.imageUrl):latest"
|
|
- "--context=$(inputs.resources.git-source.path)/$(inputs.params.pathToContext)/"
|
|
---
|
|
apiVersion: tekton.dev/v1alpha1
|
|
kind: Task
|
|
metadata:
|
|
name: deploy-application
|
|
namespace: tekton-pipeline-istio-project-1
|
|
spec:
|
|
inputs:
|
|
resources:
|
|
- name: git-source
|
|
type: git
|
|
params:
|
|
- name: pathToContext
|
|
description: The path to the build context, used by Kaniko - within the workspace
|
|
default: .
|
|
- name: pathToYamlFile
|
|
description: The path to the yaml file to deploy within the git source
|
|
default: deploy.yaml
|
|
steps:
|
|
- name: deploy-app
|
|
image: lachlanevenson/k8s-kubectl
|
|
command: ["kubectl"]
|
|
args:
|
|
- "apply"
|
|
- "-f"
|
|
- "$(inputs.resources.git-source.path)/deploy.yaml"
|
|
---
|
|
# TODO fix deze pipeline eerst
|
|
apiVersion: tekton.dev/v1alpha1
|
|
kind: Pipeline
|
|
metadata:
|
|
name: application-pipeline
|
|
namespace: tekton-pipeline-istio-project-1
|
|
spec:
|
|
resources:
|
|
- name: git-source
|
|
type: git
|
|
tasks:
|
|
- name: build-and-push-a
|
|
taskRef:
|
|
name: build-and-push
|
|
params:
|
|
- name: pathToContext
|
|
value: "serverA"
|
|
- name: imageUrl
|
|
value: "server-a"
|
|
resources:
|
|
inputs:
|
|
- name: git-source
|
|
resource: git-source
|
|
- name: build-and-push-b
|
|
taskRef:
|
|
name: build-and-push
|
|
runAfter:
|
|
- build-and-push-a
|
|
params:
|
|
- name: pathToContext
|
|
value: "serverB"
|
|
- name: imageUrl
|
|
value: "server-b"
|
|
resources:
|
|
inputs:
|
|
- name: git-source
|
|
resource: git-source
|
|
- name: build-and-push-c
|
|
taskRef:
|
|
name: build-and-push
|
|
runAfter:
|
|
- build-and-push-b
|
|
params:
|
|
- name: pathToContext
|
|
value: "serverC"
|
|
- name: imageUrl
|
|
value: "server-c"
|
|
resources:
|
|
inputs:
|
|
- name: git-source
|
|
resource: git-source
|
|
- name: build-and-push-d
|
|
taskRef:
|
|
name: build-and-push
|
|
runAfter:
|
|
- build-and-push-c
|
|
params:
|
|
- name: pathToContext
|
|
value: "serverD"
|
|
- name: imageUrl
|
|
value: "server-d"
|
|
resources:
|
|
inputs:
|
|
- name: git-source
|
|
resource: git-source
|
|
- name: deploy-application
|
|
taskRef:
|
|
name: deploy-application
|
|
runAfter:
|
|
- build-and-push-d
|
|
params:
|
|
- name: pathToContext
|
|
value: "."
|
|
- name: pathToYamlFile
|
|
value: "deploy.yaml"
|
|
resources:
|
|
inputs:
|
|
- name: git-source
|
|
resource: git-source
|