diff --git a/.DS_Store b/.DS_Store index 3f62f69..8b323c7 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/manifests/full-pipeline.yaml b/manifests/full-pipeline.yaml new file mode 100644 index 0000000..073f03c --- /dev/null +++ b/manifests/full-pipeline.yaml @@ -0,0 +1,197 @@ +--- +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 diff --git a/manifests/pipeline-run.yaml b/manifests/pipeline-run.yaml new file mode 100644 index 0000000..f9368fa --- /dev/null +++ b/manifests/pipeline-run.yaml @@ -0,0 +1,14 @@ +apiVersion: tekton.dev/v1alpha1 +kind: PipelineRun +metadata: + name: application-pipeline-run + namespace: tekton-pipeline-istio-project-1 +spec: + serviceAccountName: service-acc + pipelineRef: + name: application-pipeline + resources: + - name: git-source + resourceRef: + name: git + diff --git a/manifests/resources/git.yaml b/manifests/resources/git.yaml index e9cebd3..221303f 100644 --- a/manifests/resources/git.yaml +++ b/manifests/resources/git.yaml @@ -3,6 +3,7 @@ apiVersion: tekton.dev/v1alpha1 kind: PipelineResource metadata: name: git + namespace: tekton-pipeline-istio-project-1 spec: type: git params: diff --git a/manifests/resources/namespace.yaml b/manifests/resources/namespace.yaml new file mode 100644 index 0000000..c61132f --- /dev/null +++ b/manifests/resources/namespace.yaml @@ -0,0 +1,7 @@ +--- +apiVersion: v1 +kind: Namespace +metadata: + name: tekton-pipeline-istio-project-1 + labels: + istio-injection: enabled #zorgt voor auto sidecar injection \ No newline at end of file