diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4bcd2ef --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM nginx:alpine +COPY index.html /usr/share/nginx/html/index.html + diff --git a/index.html b/index.html new file mode 100644 index 0000000..e5ec9bc --- /dev/null +++ b/index.html @@ -0,0 +1 @@ +

test - 01

diff --git a/k8s/tekton/pipeline-build.yaml b/k8s/tekton/pipeline-build.yaml new file mode 100644 index 0000000..a13d45e --- /dev/null +++ b/k8s/tekton/pipeline-build.yaml @@ -0,0 +1,24 @@ +# pipeline-build.yaml +apiVersion: tekton.dev/v1 +kind: Pipeline +metadata: + name: nginx-build-pipeline + namespace: tekton-demo +spec: + params: + - name: GIT_URL + - name: GIT_REVISION + default: "main" + - name: IMAGE + tasks: + - name: build + taskRef: + name: build-and-push + params: + - name: GIT_URL + value: $(params.GIT_URL) + - name: GIT_REVISION + value: $(params.GIT_REVISION) + - name: IMAGE + value: $(params.IMAGE) + diff --git a/k8s/tekton/task-build.yaml b/k8s/tekton/task-build.yaml new file mode 100644 index 0000000..4c6d813 --- /dev/null +++ b/k8s/tekton/task-build.yaml @@ -0,0 +1,34 @@ +#task-build.yaml +apiVersion: tekton.dev/v1 +kind: Task +metadata: + name: build-and-push + namespace: tekton-demo +spec: + params: + - name: IMAGE + type: string + description: "Target image" + - name: GIT_URL + type: string + - name: GIT_REVISION + type: string + default: "main" + steps: + - name: git-clone + image: alpine/git + script: | + #!/bin/sh + git clone $(params.GIT_URL) source + cd source + git checkout $(params.GIT_REVISION) + + - name: build-image + image: gcr.io/kaniko-project/executor:latest + args: + - "--dockerfile=source/Dockerfile" + - "--context=source/" + - "--destination=$(params.IMAGE)" + - "--insecure" + - "--skip-tls-verify" + diff --git a/k8s/tekton/trigger.yaml b/k8s/tekton/trigger.yaml new file mode 100644 index 0000000..0f38ad6 --- /dev/null +++ b/k8s/tekton/trigger.yaml @@ -0,0 +1,54 @@ +# trigger.yaml +apiVersion: triggers.tekton.dev/v1beta1 +kind: TriggerTemplate +metadata: + name: nginx-build-template + namespace: tekton-demo +spec: + params: + - name: git-repo-url + - name: git-revision + resourcetemplates: + - apiVersion: tekton.dev/v1 + kind: PipelineRun + metadata: + generateName: nginx-build-run- + spec: + pipelineRef: + name: nginx-build-pipeline + params: + - name: GIT_URL + value: $(tt.params.git-repo-url) + - name: GIT_REVISION + value: $(tt.params.git-revision) + - name: IMAGE + value: harbor.icurfer.com/open/nginx-demo:latest + +--- +apiVersion: triggers.tekton.dev/v1beta1 +kind: TriggerBinding +metadata: + name: nginx-build-binding + namespace: tekton-demo +spec: + params: + - name: git-repo-url + value: $(body.repository.clone_url) + - name: git-revision + value: $(body.ref) + +--- +apiVersion: triggers.tekton.dev/v1beta1 +kind: EventListener +metadata: + name: nginx-build-listener + namespace: tekton-demo +spec: + serviceAccountName: tekton-triggers-sa + triggers: + - name: nginx-build-trigger + bindings: + - ref: nginx-build-binding + template: + ref: nginx-build-template + diff --git a/hello-pipeline.yaml b/sample-hello/hello-pipeline.yaml similarity index 100% rename from hello-pipeline.yaml rename to sample-hello/hello-pipeline.yaml diff --git a/hello-pipelinerun.yaml b/sample-hello/hello-pipelinerun.yaml similarity index 100% rename from hello-pipelinerun.yaml rename to sample-hello/hello-pipelinerun.yaml diff --git a/hello-task.yaml b/sample-hello/hello-task.yaml similarity index 100% rename from hello-task.yaml rename to sample-hello/hello-task.yaml diff --git a/tmp b/tmp new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/tmp @@ -0,0 +1 @@ +1