Add vars/jenkinsPipelineSkeleton.groovy

This commit is contained in:
2025-05-27 17:40:09 +03:00
parent 3b2f4d3460
commit 70047dfef4

View 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!"
}
}
}
}