diff --git a/kind/cluster/kustomization.yaml b/kind/cluster/kustomization.yaml index b911933..5883b14 100644 --- a/kind/cluster/kustomization.yaml +++ b/kind/cluster/kustomization.yaml @@ -9,5 +9,9 @@ resources: - https://forge.cadoles.com/CadolesKube/c-kustom//base/metallb?ref=develop - https://forge.cadoles.com/CadolesKube/c-kustom//base/nginx?ref=develop - https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml +- https://storage.googleapis.com/tekton-releases/triggers/latest/release.yaml +- https://storage.googleapis.com/tekton-releases/triggers/latest/interceptors.yaml +- https://storage.googleapis.com/tekton-releases/operator/latest/release.yaml +- https://raw.githubusercontent.com/tektoncd/operator/main/config/crs/kubernetes/config/all/operator_v1alpha1_config_cr.yaml - https://storage.googleapis.com/tekton-releases/dashboard/latest/release.yaml diff --git a/kustomization/base/tekton/event/pipeline-symfonyapp-listener.yaml b/kustomization/base/tekton/event/pipeline-symfonyapp-listener.yaml new file mode 100644 index 0000000..db2bffd --- /dev/null +++ b/kustomization/base/tekton/event/pipeline-symfonyapp-listener.yaml @@ -0,0 +1,12 @@ +apiVersion: triggers.tekton.dev/v1beta1 +kind: EventListener +metadata: + name: pipeline-symfonyapp-listener +spec: + serviceAccountName: tekton-robot + triggers: + - name: pipeline-symfonyapp-trigger + bindings: + - ref: pipeline-symfonyapp-binding + template: + ref: pipeline-symfonyapp-template diff --git a/kustomization/base/tekton/kustomization.yaml b/kustomization/base/tekton/kustomization.yaml index 8ea4e2b..50724dd 100644 --- a/kustomization/base/tekton/kustomization.yaml +++ b/kustomization/base/tekton/kustomization.yaml @@ -5,8 +5,14 @@ resources: - namespace/namespace.yaml - secret/secret.yaml - serviceaccount/service-account.yaml +- serviceaccount/rbac.yaml - https://raw.githubusercontent.com/tektoncd/catalog/main/task/git-clone/0.9/git-clone.yaml - https://api.hub.tekton.dev/v1/resource/tekton/task/kaniko/0.6/raw - https://api.hub.tekton.dev/v1/resource/tekton/task/trivy-scanner/0.2/raw - task/symfonyapp/ - pipeline/pipeline-symfonyapp.yaml +- trigger/pipeline-symfonyapp-binding.yaml +- trigger/pipeline-symfonyapp-template.yaml +- event/pipeline-symfonyapp-listener.yaml + + diff --git a/kustomization/base/tekton/pipeline/pipeline-symfonyapp.yaml b/kustomization/base/tekton/pipeline/pipeline-symfonyapp.yaml index 23fc169..0ebbfff 100644 --- a/kustomization/base/tekton/pipeline/pipeline-symfonyapp.yaml +++ b/kustomization/base/tekton/pipeline/pipeline-symfonyapp.yaml @@ -1,12 +1,12 @@ apiVersion: tekton.dev/v1beta1 kind: Pipeline metadata: - name: symfonyapp + name: pipeline-symfonyapp spec: description: | This pipeline clones a git repo, then echoes the README file to the stout. params: - - name: repo-url + - name: url type: string description: The git repo URL to clone from. - name: revision @@ -42,7 +42,7 @@ spec: workspace: shared-data params: - name: url - value: $(params.repo-url) + value: $(params.url) - name: revision value: $(params.revision) - name: submodules diff --git a/kustomization/base/tekton/pipeline/pipelinerun.yaml b/kustomization/base/tekton/pipeline/pipelinerun.yaml index 6c36ab6..9d4507c 100644 --- a/kustomization/base/tekton/pipeline/pipelinerun.yaml +++ b/kustomization/base/tekton/pipeline/pipelinerun.yaml @@ -26,7 +26,7 @@ spec: secret: secretName: regcred params: - - name: repo-url + - name: url value: https://forge.cadoles.com/CNOUS/mse.git - name: revision value: issue-2977 diff --git a/kustomization/base/tekton/serviceaccount/rbac.yaml b/kustomization/base/tekton/serviceaccount/rbac.yaml new file mode 100644 index 0000000..7d861b4 --- /dev/null +++ b/kustomization/base/tekton/serviceaccount/rbac.yaml @@ -0,0 +1,29 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: tekton-robot +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: triggers-example-eventlistener-binding +subjects: +- kind: ServiceAccount + name: tekton-robot +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: tekton-triggers-eventlistener-roles +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: triggers-example-eventlistener-clusterbinding +subjects: +- kind: ServiceAccount + name: tekton-robot + namespace: default +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: tekton-triggers-eventlistener-clusterroles diff --git a/kustomization/base/tekton/trigger/pipeline-symfonyapp-binding.yaml b/kustomization/base/tekton/trigger/pipeline-symfonyapp-binding.yaml new file mode 100644 index 0000000..3f7dcd6 --- /dev/null +++ b/kustomization/base/tekton/trigger/pipeline-symfonyapp-binding.yaml @@ -0,0 +1,62 @@ +apiVersion: triggers.tekton.dev/v1beta1 +kind: TriggerBinding +metadata: + name: pipeline-symfonyapp-binding +spec: + params: + - name: secret + value: $(body.secret) + - name: ref + value: $(body.secret) + - name: before + value: $(body.before) + - name: after + value: $(body.after) + - name: compare_url + value: $(body.compare_url) + - name: repository.id + value: $(body.repository.id) + - name: repository.name + value: $(body.repository.name) + - name: repository.fullname + value: $(body.repository.full_name) + - name: repository.owner.id + value: $(body.repository.owner.id) + - name: repository_owner.username + value: $(body.repository.owner.username) + - name: repository_owner.full_name + value: $(body.repository.owner.full_name) + - name: repository.html_url + value: $(body.repository.html_url) + - name: repository.clone_url + value: $(body.repository.clone_url) + - name: repository.ssh_url + value: $(body.repository.ssh_url) + - name: repository.default_branch + value: $(body.repository.default_branch) + - name: pusher.id + value: $(body.pusher.id) + - name: pusher.username + value: $(body.pusher.username) + - name: pusher.full_name + value: $(body.pusher.full_name) + - name: sender.id + value: $(body.sender.id) + - name: sender.username + value: $(body.sender.username) + - name: sender.full_name + value: $(body.sender.full_name) + - name: commits.id + value: $(body.commits[0].id) + - name: commits.message + value: $(body.commits[0].message) + - name: commits.url + value: $(body.commits[0].url) + - name: commits.author.name + value: $(body.commits[0].author.name) + - name: commits.author.email + value: $(body.commits[0].author.email) + - name: commits.author.username + value: $(body.commits[0].author.username) + - name: commits.timestamp + value: $(body.commits[0].timestamp) diff --git a/kustomization/base/tekton/trigger/pipeline-symfonyapp-template.yaml b/kustomization/base/tekton/trigger/pipeline-symfonyapp-template.yaml new file mode 100644 index 0000000..4b08e9d --- /dev/null +++ b/kustomization/base/tekton/trigger/pipeline-symfonyapp-template.yaml @@ -0,0 +1,69 @@ +apiVersion: triggers.tekton.dev/v1beta1 +kind: TriggerTemplate +metadata: + name: pipeline-symfonyapp-template +spec: + params: + - name: secret + - name: ref + - name: before + - name: after + - name: compare_url + - name: repository.id + - name: repository.name + - name: repository.full_name + - name: repository.owner.id + - name: repository_owner.username + - name: repository_owner.full_name + - name: repository.html_url + - name: repository.clone_url + - name: repository.ssh_url + - name: repository.default_branch + - name: pusher.id + - name: pusher.username + - name: pusher.full_name + - name: sender.id + - name: sender.username + - name: sender.full_name + - name: commits.id + - name: commits.message + - name: commits.url + - name: commits.author.name + - name: commits.author.email + - name: commits.author.username + - name: commits.timestamp + resourcetemplates: + - apiVersion: tekton.dev/v1beta1 + kind: PipelineRun + metadata: + generateName: symfonyapp-run- + namespace: tekton + spec: + serviceAccountName: build-bot + pipelineRef: + name: pipeline-symfonyapp + podTemplate: + securityContext: + fsGroup: 65532 + workspaces: + - name: shared-data + volumeClaimTemplate: + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + - name: config + configmap: + name: config-php-cs-fixer + - name: docker-credentials + secret: + secretName: regcred + params: + - name: url + value: $(tt.params.repository.html_url) + - name: revision + value: $(tt.params.ref) + - name: destination + value: sprint-8