Skip to main content

Jenkins Dev Pipeline

developWhen pushing a branch, Jenkins automatically builds and K8sdevDeploy to the namespace.

Jenkins Access

itemvalue
URLCompany Jenkins server (VPN required)
viewInfoLineage
Job listinfolineage-platform-api, infolineage-platform-worker, infolineage-platform-frontend
Credentialsharbor(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 bundled 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'),
]
)
Containerroleimage
javaGradle Buildeclipse-temurin:25-jre (API), eclipse-temurin:25 (Worker)
dockerImage Build & Harbor Pushdocker:20.10
kubectlK8s Deploymentlachlanevenson/k8s-kubectl

API Job isnodeSelector: 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 files that have been changed.

SKIP_BUILD condition

JobSKIP_BUILD=true (skip)
APIbackend/infolineage-apiandbackend/infolineage-commonNo changes
Workerbackend/infolineage-workerandbackend/infolineage-commonNo changes
Frontendfrontend/No changes

SKIP_BUILD=trueIt skips Gradle Build and Docker Build.K8s Deploy is always runningIt is possible.

Step 3: Gradle Build (API / Worker)

./gradlew :infolineage-api:bootJar \
-x test \
--build-cache \
-Dorg.gradle.jvmargs="--enable-preview -Xmx1g"

--build-cacheYou can use 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

Image tags are 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 SpecifierBuilds targeting a specific branch by modifying __PH_0__.

*/develop          # Default
*/feature/api-* # Feature branch pattern

Manual BuildBuild with Parameters→ You 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.

# Symptoms
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 __PH_0__, SKIP_BUILD judgment fails. Jenkinsfile is|| git diff --name-only HEADfalls back.