Openshift pipleline fails with error: # is already in progress (Running)

Viewed 2721

My openshift jenkins pipeline is failing at the last step while rolling out. Manual build in Openshift is working fine. It is creating the pods and terminating the others. Seams like when using pipeline , it was not able to terminate previous running pods.

when I terminated the running pod manually , then start pipe line it was working fine.

However the similar pipe line is working fine on our test env.

... previous stages

stage('PROD: Deploying image') {
              when {
                expression {
                  openshift.withCluster() {
                    openshift.withProject(PROD_PROJECTSPACE) {
                      return !openshift.selector('dc', "${APPLICATION_NAME}").exists()
                    }
                  }
                }
              }
              steps {
                script {
                  openshift.withCluster() {
                    openshift.withProject(PROD_PROJECTSPACE) {
                      openshift.newApp("${APPLICATION_NAME}:latest --allow-missing-imagestream-tags").narrow('svc').expose("--port=3013");
                      def dc = openshift.selector("dc", "${APPLICATION_NAME}");
                        while (dc.object().spec.replicas != dc.object().status.availableReplicas) {
                          sleep 10
                        }
                        openshift.set("triggers", "dc/${APPLICATION_NAME}", "--manual")
                      }
                    }
                }
              }
            }

Failing in this stage

stage('PROD: Rollout') {
              steps {
                script {
                  openshift.withCluster() {
                    openshift.withProject(PROD_PROJECTSPACE) {
                      openshift.selector("dc", "${APPLICATION_NAME}").rollout().latest();
                    }
                  }
                }
              }

Here is the error

ERROR: rollout:latest returned an error;
{reference={}, err=error: #15 is already in progress (Running)., verb=rollout, cmd=oc --server=https://172.30.0.1:443 --certificate-authority=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt --namespace=global-prod --token=XXXXX rollout latest deploymentconfig/global-events , out=, status=1}

Finished: FAILURE  

Could you point me something , any help would be helpful

1 Answers

Just like in your comments. This can work, remove all triggers:

oc set triggers dc/${APPLICATION_NAME} --remove-all
Related