Compare commits

...

11 Commits

Author SHA1 Message Date
92a45d7d14 remove trigger test 2025-08-06 11:33:40 +09:00
820da6acb1 test 2025-08-05 15:06:28 +09:00
b941f2dcb0 tag test 2025-08-05 00:54:37 +09:00
cb0ee48bd1 tag test 2025-08-05 00:53:35 +09:00
391d705142 tag test 2025-08-05 00:51:04 +09:00
4e6ad9f276 tag test 2025-08-05 00:45:53 +09:00
61e5636f5a tag test 2025-08-05 00:44:05 +09:00
77e8f2f792 update 2025-08-05 00:38:45 +09:00
3e496fa339 update 2025-08-05 00:30:41 +09:00
59f141302f update 2025-08-05 00:24:26 +09:00
8016f3b0ef test 2025-08-05 00:15:25 +09:00
10 changed files with 164 additions and 56 deletions

59
dp_np.yaml Normal file
View File

@ -0,0 +1,59 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: tekton-demo-deployment
namespace: tekton-demo
spec:
replicas: 1
selector:
matchLabels:
app: tekton-demo
template:
metadata:
labels:
app: tekton-demo
spec:
containers:
- name: tekton-demo
image: harbor.icurfer.com/open/tekton-demo@sha256:87a0df2bc8c27c0eca46387a11f99b0d71df50d6da3ded3c45c57d0d59368c83
imagePullPolicy: Always
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: tekton-demo-service
namespace: tekton-demo
spec:
type: NodePort
selector:
app: tekton-demo
ports:
- protocol: TCP
port: 80
targetPort: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
name: tekton-demo-ing
namespace: tekton-demo
spec:
ingressClassName: nginx
rules:
- host: demo.tk8s.test
http:
paths:
- backend:
service:
name: tekton-demo-service
port:
number: 80
path: /
pathType: Prefix
tls:
- hosts:
- demo.tk8s.test
secretName: ssl-common

View File

@ -1,11 +1,62 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<title>Tekton Demo</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tekton Demo-</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, sans-serif;
background: linear-gradient(135deg, #e0f7fa, #e1f5fe);
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
color: #333;
}
.container {
text-align: center;
background: white;
padding: 40px 60px;
border-radius: 12px;
box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
max-width: 500px;
width: 90%;
}
h1 {
font-size: 2rem;
color: #007acc;
margin-bottom: 15px;
}
p {
font-size: 1.1rem;
margin-bottom: 25px;
}
.btn {
display: inline-block;
padding: 12px 25px;
background-color: #007acc;
color: white;
text-decoration: none;
border-radius: 6px;
transition: background-color 0.3s;
}
.btn:hover {
background-color: #005fa3;
}
.emoji {
font-size: 3rem;
}
</style>
</head>
<body>
<div class="container">
<div class="emoji">🚀</div>
<h1>✅ Hello Tekton CI/CD!</h1>
<p>This page is built automatically using Tekton Pipeline.</p>
<p>Your application has been successfully built and deployed using Tekton Pipeline.</p>
<a href="#" class="btn">Learn More</a>
</div>
</body>
</html>

View File

@ -6,8 +6,8 @@ metadata:
namespace: tekton-demo
secrets:
- name: harbor-dockerconfig # Harbor 인증용 Secret
imagePullSecrets:
- name: harbor-dockerconfig # Docker 인증 정보 사용
# imagePullSecrets:
# - name: harbor-dockerconfig # Docker 인증 정보 사용
---
# Tekton 파이프라인 실행 및 리소스 접근 권한(Role)

View File

@ -36,46 +36,8 @@ spec:
git checkout $(params.git-revision)
echo "==== [INFO] Git checkout 완료 ===="
# 2. Secret 파일 config.json 으로 변환
# - name: prepare-docker-config
# image: alpine
# script: |
# #!/bin/sh
# set -e
# echo "==== [INFO] Docker config 파일 준비 ===="
# ls -al /workspace/docker-config
# if [ -f /workspace/docker-config/.dockerconfigjson ]; then
# cat /workspace/docker-config/.dockerconfigjson
# else
# echo "[ERROR] Docker config 파일(.dockerconfigjson) 없음"
# fi
# - name: prepare-docker-config
# image: stedolan/jq
# script: |
# #!/bin/sh
# set -e
# echo "==== [INFO] Docker config 파일 준비 ===="
# ls -al /workspace/docker-config
# # 임시 쓰기 가능 경로 생성
# mkdir -p /workspace/tmp-config
# if [ -f /workspace/docker-config/.dockerconfigjson ]; then
# echo "[INFO] dockerconfigjson 내용 읽기"
# cat /workspace/docker-config/.dockerconfigjson | jq . > /workspace/tmp-config/config.json
# echo "[INFO] config.json 변환 완료"
# else
# echo "[ERROR] Docker config 파일(.dockerconfigjson) 없음"
# fi
# 3. Debugging - Check mounted secret before build
# - name: debug-sleep
# image: alpine
# script: |
# #!/bin/sh
# echo "==== [DEBUG] Pod에 접속 가능 상태로 대기 중... ===="
# sleep 180
# 4. Kaniko Build & Push
# Kaniko Build & Push
- name: build-and-push
image: gcr.io/kaniko-project/executor:latest
volumeMounts:
@ -83,9 +45,6 @@ spec:
mountPath: /kaniko/.docker/config.json
subPath: .dockerconfigjson
readOnly: true
# env:
# - name: DOCKER_CONFIG
# value: /workspace/docker-config
args:
- --dockerfile=/workspace/source/Dockerfile
- --context=/workspace/source

View File

@ -7,7 +7,7 @@ metadata:
spec:
workspaces:
- name: docker-config
params:
params: # 변수 선언부
- name: git-url
type: string
- name: git-revision

View File

@ -9,4 +9,6 @@ spec:
- name: git-url
value: $(body.repository.clone_url)
- name: git-revision
value: $(body.ref)
value: $(body.head_commit.id)
- name: commit-sha
value: $(body.head_commit.id)

View File

@ -5,9 +5,10 @@ metadata:
name: docker-build-template
namespace: tekton-demo
spec:
params:
params: # 변수선언
- name: git-url
- name: git-revision
- name: commit-sha
resourcetemplates:
- apiVersion: tekton.dev/v1beta1
kind: PipelineRun
@ -17,13 +18,13 @@ spec:
serviceAccountName: tekton-build-sa
pipelineRef:
name: docker-build-pipeline
params:
params: # 변수 할당
- name: git-url
value: $(tt.params.git-url)
- name: git-revision
value: $(tt.params.git-revision)
- name: image-url
value: harbor.icurfer.com/open/tekton-demo:latest
value: harbor.icurfer.com/open/tekton-demo:$(tt.params.commit-sha)
workspaces:
- name: docker-config
secret:

View File

@ -8,7 +8,13 @@ spec:
serviceAccountName: tekton-build-sa
triggers:
- name: gitea-trigger
interceptors:
- cel:
filter: "header.match('X-Gitea-Event', 'push')"
overlays:
- key: shortsha
expression: "body.head_commit.id.truncate(7)"
bindings:
- ref: docker-build-binding # ✅ 수정
- ref: docker-build-binding
template:
ref: docker-build-template # ✅ 수정
ref: docker-build-template

15
sample-build/apply.py Normal file
View File

@ -0,0 +1,15 @@
#!/usr/bin/python3
import os
import sys
import subprocess
yaml_list = [
"02-task-build.yaml",
"05-pipeline-build.yaml",
"06-trigger-binding.yaml",
"07-trigger-template.yaml",
]
for yaml_file in yaml_list:
os.system(f"kubectl apply -f {yaml_file}")

15
sample-build/delete.py Normal file
View File

@ -0,0 +1,15 @@
#!/usr/bin/python3
import os
import sys
import subprocess
yaml_list = [
"02-task-build.yaml",
"05-pipeline-build.yaml",
"06-trigger-binding.yaml",
"07-trigger-template.yaml",
]
for yaml_file in yaml_list:
os.system(f"kubectl delete -f {yaml_file}")