I already used the following declarative cleanup pipeline for Jenkin, according to the feature of my code, I have to convert into the scripted pipeline, how I can convert it to the scripted pipeline?
stage ('Cleanup Feature Releases')
{
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)
}
}
}