Initial Commit.

This commit is contained in:
2023-01-09 07:33:28 +02:00
parent e5cc8207e8
commit 5d06e769fb
6 changed files with 168 additions and 1 deletions

35
template/Jenkinsfile vendored Normal file
View File

@@ -0,0 +1,35 @@
#!groovy
pipeline {
agent {
kubernetes {
defaultContainer 'jnlp'
yaml """
apiVersion: v1
kind: Pod
metadata:
name: {{k3sApp}}-"""+env.BRANCH_NAME+"""-build
spec:
serviceAccountName: jenkins-admin
containers:
- name: deploy
image: 192.168.195.195:30000/nginx:latest
command: ["tail"]
args: ["-f", "/dev/null"]
restartPolicy: Never
"""
}
}
stages {
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'
}
}
}
}
}