convert declarative pipeline stage to scripted pipeline

17 views
Skip to first unread message

Majid

unread,
Sep 1, 2020, 7:59:32 PM9/1/20
to Jenkins Users

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)
           }
        }
    }
Reply all
Reply to author
Forward
0 new messages