I already used the following declarative script as a part of my cleanup script, now I should convert it to the scripted pipeline, how I can convert the post to the scripted pipeline?
stages {
stage ('Cleanup Feature Releases') {
agent any
steps {
script {
envParameters = Utils.getEnvParameters("${TARGET_ENV}")
withKubeConfig([credentialsId: envParameters.K8S_TOKEN,
serverUrl: envParameters.K8S_API_SERVER,
contextName: CONTEXT_NAME
]) {
sh "Running on ${params.OVERRIDE_NAMESPACE}"
}
}
}
post {
failure {
cleanUpNotification("FAILURE", params.DRY_RUN)
}
aborted {
cleanUpNotification("ABORTED", params.DRY_RUN)
}
success {
cleanUpNotification("SUCCESS", params.DRY_RUN)
}
}
}
}
Go to Source
Author: Mkash