Jenkins Dev Pipeline
developWhen pushing a branch, Jenkins automatically builds and K8sdevDeploying to the namespace.
Accessing Jenkins
| item | value |
|---|---|
| URL | Company Jenkins Server (VPN Required) |
| view | InfoLineage |
| Job List | infolineage-platform-api, infolineage-platform-worker, infolineage-platform-frontend |
| Credentials | harbor(Harbor Registry Login) |
Location of Jenkinsfile
infra/jenkins/
├── Jenkinsfile.api
├── Jenkinsfile.worker
└── Jenkinsfile.frontend
In the Pipeline settings of each JobSCM→ Specify the path to the Jenkinsfile.
podTemplate pattern
All Jenkinsfiles use the Kubernetes podTemplate. Multiple containers are grouped in the build Pod and executed step by step.
podTemplate(
label: label,
containers: [
containerTemplate(name: 'java', image: 'eclipse-temurin:25-jre', ...),
containerTemplate(name: 'docker', image: 'docker:20.10', privileged: true, ...),
containerTemplate(name: 'kubectl', image: 'lachlanevenson/k8s-kubectl', ...),
],
volumes: [
hostPathVolume(hostPath: '/var/run/docker.sock', mountPath: '/var/run/docker.sock'),
]
)
| Container | role | image |
|---|---|---|
java | Gradle Build | eclipse-temurin:25-jre (API), eclipse-temurin:25 (Worker) |
docker | Image Build & Harbor Push | docker:20.10 |
kubectl | K8s Deployment | lachlanevenson/k8s-kubectl |
API Job is
nodeSelector: jenkins.kubernetes.io/dedicated=trueis specified additionally.
Pipeline Stage
Step 1: Git Pull
stage('Git Pull') {
checkout scm
}
Step 2: Check Changed Paths
git diff HEAD~1 HEADCheck the list of changed files.
SKIP_BUILD condition
| Job | SKIP_BUILD=true (Skip) |
|---|---|
| API | backend/infolineage-apiandbackend/infolineage-commonNo changes |
| Worker | backend/infolineage-workerandbackend/infolineage-commonNo changes |
| Frontend | frontend/No changes |
SKIP_BUILD=trueThis skips Gradle Build and Docker Build.K8s Deploy always runsIt works.
Step 3: Gradle Build (API / Worker)
./gradlew :infolineage-api:bootJar \
-x test \
--build-cache \
-Dorg.gradle.jvmargs="--enable-preview -Xmx1g"
--build-cacheUse caching as an option to perform incremental builds. The frontend is handled with a Docker multi-stage build, so there is no separate Gradle step.
Step 4: Docker Build & Push
docker login scr.softcamp.co.kr -u $HARBOR_USR --password-stdin
# API / Worker
docker build -f backend/<module>/Dockerfile -t <IMAGE> backend/
# Frontend
docker build -f frontend/Dockerfile \
--build-arg VITE_USE_MOCKS=false \
--build-arg VITE_API_BASE_URL=/platform/api \
--build-arg VITE_AUTH_DISABLED=false \
--build-arg VITE_SHIELD_ID_BASE_URL=https://devlogin.softcamp.co.kr \
--build-arg VITE_CLIENT_NAME=InfoLineage \
-t <IMAGE> frontend/
docker push <IMAGE>
docker rmi <IMAGE> || true
The image tag is always:latestis used.
Step 5: K8s Deploy
# API / Worker
kubectl apply -f infra/k8s/dev/configmap.yaml -n dev
kubectl apply -f infra/k8s/dev/secret.yaml -n dev
kubectl apply -f infra/k8s/dev/<module>-service.yaml -n dev
kubectl apply -f infra/k8s/dev/<module>-deployment.yaml -n dev
kubectl rollout restart deployment/infolineage-platform-<module> -n dev
kubectl rollout status deployment/infolineage-platform-<module> -n dev --timeout=120s
Select Specific Branch Build
Jenkins Job Configuration →Branch SpecifierModify to build for a specific branch.
*/develop # 기본값
*/feature/api-* # feature 브랜치 패턴
During manual buildBuild with ParametersYou can specify the desired branch as input for Branch.
Troubleshooting
Failed to create Pod due to exceeding containerCap
Jenkins Kubernetes Plugin ConfigurationcontainerCapIf the value is low, the Pod creation will fail.
# 증상
ERROR: Error allocating a new node ... containerCap exceeded
solution: Jenkins Management → Clouds → Kubernetes → Increase Container Cap value (default 10 → above 50).
If the previous build Pod remains in Pending/Running status
# 정리
kubectl get pods -n jenkins | grep infolineage
kubectl delete pod <stuck-pod-name> -n jenkins
git diff HEAD~1 HEADFailure (First Commit)
If it is the first commit or a shallow cloneHEAD~1Cannot reference, SKIP_BUILD judgment fails. Jenkinsfile is|| git diff --name-only HEADfalls back.