Files
crossword/Jenkinsfile
T
plparkandClaude Opus 5 65588c339c Add static crossword site with nginx image and k8s manifests
- site/index.html: Russian literature crossword page
- Dockerfile + nginx conf serving on 8080 with /healthz
- k8s Deployment + NodePort Service (31380) in plpark-int-ns
- Jenkinsfile: build/push to gitea registry, apply to rancher

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-07 16:01:48 +09:00

69 lines
2.3 KiB
Groovy

pipeline {
agent any
environment {
REGISTRY = 'gitea.plpark.ectech.co.kr'
IMAGE_NAME = "${REGISTRY}/plpark/crossword"
IMAGE_TAG = "${env.BUILD_NUMBER}"
NAMESPACE = 'plpark-int-ns'
}
options {
buildDiscarder(logRotator(numToKeepStr: '20'))
}
stages {
stage('Checkout') {
steps {
git branch: 'main',
url: 'https://gitea.plpark.ectech.co.kr/plpark/crossword.git',
credentialsId: 'gitea-registry'
}
}
stage('Build & Push Image') {
steps {
withEnv(["PATH+DOCKER=/dockerbin"]) {
withCredentials([usernamePassword(
credentialsId: 'gitea-registry',
usernameVariable: 'REG_USER',
passwordVariable: 'REG_PASS')]) {
sh '''
set -e
echo "$REG_PASS" | docker login "$REGISTRY" -u "$REG_USER" --password-stdin
docker build -t "$IMAGE_NAME:$IMAGE_TAG" -t "$IMAGE_NAME:latest" .
docker push "$IMAGE_NAME:$IMAGE_TAG"
docker push "$IMAGE_NAME:latest"
'''
}
}
}
}
stage('Deploy to Rancher') {
steps {
withEnv(["PATH+DOCKER=/dockerbin"]) {
withCredentials([file(credentialsId: 'rancher-kubeconfig', variable: 'KUBECONFIG_FILE')]) {
sh '''
set -e
export KUBECONFIG="$KUBECONFIG_FILE"
sed "s|__IMAGE__|$IMAGE_NAME:$IMAGE_TAG|g" k8s/deployment.yaml > /tmp/crossword-deploy.yaml
kubectl apply -f /tmp/crossword-deploy.yaml
kubectl -n "$NAMESPACE" rollout status deployment/crossword --timeout=180s
'''
}
}
}
}
}
post {
success {
echo "Deployed ${IMAGE_NAME}:${IMAGE_TAG} -> http://192.168.0.216:31380 (https://crossword.plpark.ectech.co.kr)"
}
always {
sh 'rm -f /tmp/crossword-deploy.yaml || true'
}
}
}