Add vars/jenkinsPipelineSkeleton.groovy
This commit is contained in:
44
vars/jenkinsPipelineSkeleton.groovy
Normal file
44
vars/jenkinsPipelineSkeleton.groovy
Normal file
@@ -0,0 +1,44 @@
|
||||
def call(String projectName, Map config) {
|
||||
pipeline {
|
||||
agent {
|
||||
kubernetes {
|
||||
yaml k8sPodTemplate(config.namespace ?: 'default', config.useCustomDocker, config.imagePullPolicy)
|
||||
}
|
||||
}
|
||||
stages {
|
||||
stage('Retrieve Environment Variables') {
|
||||
steps {
|
||||
script {
|
||||
retrieveEnvVars('maven', ['NEXUS_URL', 'NEXUS_PASS'])
|
||||
retrieveEnvVars('helm', ['KUBERNETES_API', 'KUBERNETES_TOKEN', 'NEXUS_URL'])
|
||||
retrieveEnvVars(config.dockerTool ?: 'docker', ['NEXUS_DOCKER_URL', 'NEXUS_DOCKER_PASS'])
|
||||
}
|
||||
}
|
||||
}
|
||||
if (config.checkDependencyPipeline) {
|
||||
stage('Check dependent Pipeline Status') {
|
||||
steps {
|
||||
script {
|
||||
getJobStatus(config.dependencyPipeline)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build and Deploy') {
|
||||
steps {
|
||||
script {
|
||||
buildAndDeploy(projectName, config.helmChart, config.helmRepo, config.version, config.useCustomDocker, config.port)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
success {
|
||||
echo "Build for '${projectName}' was successful!"
|
||||
}
|
||||
failure {
|
||||
echo "Build for '${projectName}' failed!"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user