Bootstrapped from template.
Some checks failed
Home Cluster Builds/wedding-page/pipeline/head There was a failure building this commit

This commit is contained in:
2023-01-07 18:10:43 +02:00
parent d0689a1ae5
commit 8278950bf7
10 changed files with 124 additions and 121 deletions

68
cicd/Jenkinsfile vendored Normal file
View File

@@ -0,0 +1,68 @@
#!groovy
pipeline {
agent {
kubernetes {
defaultContainer 'jnlp'
yaml """
apiVersion: v1
kind: Pod
metadata:
name: wedding-fe-env.BRANCH_NAME-build
spec:
serviceAccountName: jenkins-admin
containers:
- name: kaniko
image: gcr.io/kaniko-project/executor:debug
command: ["tail"]
args: ["-f", "/dev/null"]
volumeMounts:
- name: kaniko-secret
mountPath: /kaniko/.docker
- name: deploy
image: 192.168.195.195:30000/nginx:latest
command: ["tail"]
args: ["-f", "/dev/null"]
restartPolicy: Never
volumes:
- name: kaniko-secret
secret:
secretName: dockercred
items:
- key: .dockerconfigjson
path: config.json
"""
}
}
stages {
stage('Build') {
steps {
sh 'echo "No build steps configured."'
}
}
stage('Test') {
steps {
sh 'echo "No test steps configured."'
}
}
stage('Docker Build and Push') {
steps {
container("kaniko") {
sh '''
/kaniko/executor --dockerfile `pwd`/cicd/env.BRANCH_NAME/Dockerfile --context `pwd` --destination 192.168.195.195:30000/wedding-fe:env.BRANCH_NAME
'''
}
}
}
stage('Kubernetes Deploy') {
steps {
container("deploy") {
sh 'curl -LO "https://storage.googleapis.com/kubernetes-release/release/v1.24.3/bin/linux/arm64/kubectl"'
sh 'chmod u+x ./kubectl'
sh 'sed -ie "s/{{replaceMe}}/`date +%s`/g" `pwd`/cicd/env.BRANCH_NAME/deployment.yaml'
sh './kubectl replace -f `pwd`/cicd/`env.BRANCH_NAME`/deployment.yaml'
}
}
}
}
}