def call(String projectName, Map config) { pipeline { agent { kubernetes { yaml k8sPodTemplate(config.namespace ?: 'default', config.useCustomDocker, config.pullAlways) } } 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']) } } } stage('Check dependent Pipeline Status') { steps { script { if (config.checkDependencyPipeline) { getJobStatus(config.dependencyPipeline) } } } } stage('Build and Deploy') { steps { script { buildAndDeploy(projectName, config.releaseName, config.helmChart, config.helmRepo, config.version, config.useCustomDocker, config.useInsecureRegistry, config.port) } } } } post { success { echo "Build for '${projectName}' was successful!" } failure { echo "Build for '${projectName}' failed!" } } } }