Add CI/CD setup
Some checks failed
moritz/project-x/pipeline/head There was a failure building this commit
Some checks failed
moritz/project-x/pipeline/head There was a failure building this commit
This commit is contained in:
63
Jenkinsfile
vendored
Normal file
63
Jenkinsfile
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
podTemplate(
|
||||
yaml: '''
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
spec:
|
||||
containers:
|
||||
- name: docker
|
||||
image: docker:24.0.7-cli
|
||||
command:
|
||||
- sleep
|
||||
args:
|
||||
- 99d
|
||||
resources:
|
||||
requests:
|
||||
cpu: "512m"
|
||||
memory: "1Gi"
|
||||
limits:
|
||||
memory: "1Gi"
|
||||
- name: helmfile
|
||||
image: ghcr.io/helmfile/helmfile:v0.158.1
|
||||
command:
|
||||
- sleep
|
||||
args:
|
||||
- 99d
|
||||
''') {
|
||||
node(POD_LABEL) {
|
||||
ansiColor('xterm') {
|
||||
stage('Checkout') {
|
||||
checkout scm
|
||||
}
|
||||
container('docker') {
|
||||
stage('build and push image') {
|
||||
withCredentials([file(credentialsId: 'harbor-docker-config', variable: 'DOCKER_CONFIG_FILE')]) {
|
||||
sh "mkdir .docker"
|
||||
sh "cp ${DOCKER_CONFIG_FILE} ${WORKSPACE}/.docker/config.json"
|
||||
withEnv(["DOCKER_CONFIG=${WORKSPACE}/.docker/"]) {
|
||||
|
||||
sh """
|
||||
docker buildx create --name buildkitd --driver remote tcp://buildkitd.buildkitd.svc.cluster.local:12345
|
||||
docker buildx use buildkitd
|
||||
docker buildx install
|
||||
docker build --push -t core.harbor.koebele-online.de/library/project-x:$BUILD_NUMBER .
|
||||
"""
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
container('helmfile') {
|
||||
withCredentials([usernamePassword(credentialsId: 'harbor-robot', passwordVariable: 'HARBOR_PASSWORD', usernameVariable: 'HARBOR_USER')]) {
|
||||
stage('helmfile lint') {
|
||||
sh 'helmfile lint'
|
||||
}
|
||||
if (env.BRANCH_NAME == "main") {
|
||||
stage('helmfile sync') {
|
||||
sh 'helmfile sync'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user