# Jenkins is only checking out and skipping the remaining stages from my Jenkinsfile

**URL:** <https://community.jenkins.io/t/jenkins-is-only-checking-out-and-skipping-the-remaining-stages-from-my-jenkinsfile/628>\
**Category:** Ask a question\
**Created:** [October 21, 2021, 5:40pm UTC](https://community.jenkins.io/t/jenkins-is-only-checking-out-and-skipping-the-remaining-stages-from-my-jenkinsfile/628 "2021-10-21T17:40:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ppicom](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/ppicom/32/469_2.png) [@ppicom](https://community.jenkins.io/u/ppicom)\
**Post date:** [October 21, 2021, 5:40pm UTC](https://community.jenkins.io/t/jenkins-is-only-checking-out-and-skipping-the-remaining-stages-from-my-jenkinsfile/628/1 "2021-10-21T17:40:13Z")

</div>

Hi!

This is driving me crazy. We are putting down our current Ubuntu 20.04 CI server that ran all builds, and installed Jenkins on a Debian 10. The same Jenkinsfile that worked perfectly on its predecessor it’s not working now.

Although the Jenkinsfile has 4 stages and a post actions, the server is only doing the first (checkout) and the post actions.

This is the Jenkinsfile:

```auto
pipeline {
    agent any
    environment {
        GIT_BRANCH = "origin/${BRANCH_NAME}"
        BRANCH_NAME = "${BRANCH_NAME}"
        REGISTRY_CREDENTIALS = credentials('REDACTED')
        REGISTRY= "REDACTED"
    }

    stages {
        stage ('Checkout') {
            steps {
                checkout scm
            }
        }

        stage ('Build') {
            steps {
                sh '''#!/bin/bash
                cd ci
                
                echo "BRANCH_NAME=$BRANCH_NAME"
                echo "GIT_BRANCH=$GIT_BRANCH"
                
                ./build.sh REDACTED
                '''
            }
        }

        stage ('Push') {
            steps {
                sh '''#!/bin/bash
                cd ci

                echo "Logging in the $REGISTRY registry as $REGISTRY_CREDENTIALS_PSW ..."

                if ( ! docker login -p "$REGISTRY_CREDENTIALS_PSW" -u "$REGISTRY_CREDENTIALS_USR" "$REGISTRY" ) ; then
                        echo "Could not login to ${REGISTRY}. Aborting..."
                        return 1;
                fi

                ./push.sh REGISTRY
                if [-e alias.sh] ; then
                    . ./gitinfo.sh
                    ./alias.sh "$TAG" "$BRANCH" REGISTRY
                    ./push.sh --tag "$BRANCH" REGISITRY
                fi
                '''
            }
        }

        stage ('Deploy') {
            steps {
                sh '''#!/bin/bash
                cd ci
                ./deploy.sh "192.168.10.254/cid" REGISTRY
                '''
            }
        }
    }

    post {  
         always {
            emailext attachLog: true,
            body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\n",
            subject: "CID Build ${currentBuild.currentResult}: Job ${env.JOB_NAME}",
            to: 'REDACTED'
        }
    }
}

```

And this is the log, where you can see that after checkout does nothing and build fails:

```auto
Branch indexing
 > git rev-parse --resolve-git-dir /var/lib/jenkins/caches/git-0e6e81d299f91559ab810b57e68d4bd2/.git # timeout=10
Setting origin to REDACTED
 > git config remote.origin.url REDACTED # timeout=10
Fetching origin...
Fetching upstream changes from origin
 > git --version # timeout=10
 > git --version # 'git version 2.20.1'
 > git config --get remote.origin.url # timeout=10
using GIT_SSH to set credentials 
 > git fetch --tags --force --progress -- origin +refs/heads/*:refs/remotes/origin/* # timeout=10
Seen branch in repository origin/master
Obtained Jenkinsfile from e59d9a215b4af7a61afbcf027fe0c2f59dc4845f
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /var/lib/jenkins/workspace/GH_master
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Declarative: Checkout SCM)
[Pipeline] checkout
The recommended git tool is: git
using credential REDACTED
Cloning the remote Git repository
Cloning with configured refspecs honoured and without tags
Cloning repository REDACTED
 > git init /var/lib/jenkins/workspace/GH_master # timeout=10
Fetching upstream changes from REDACTED
 > git --version # timeout=10
 > git --version # 'git version 2.20.1'
using GIT_SSH to set credentials 
 > git fetch --no-tags --force --progress -- REDACTED +refs/heads/*:refs/remotes/origin/* # timeout=10
 > git config remote.origin.url REDACTED # timeout=10
 > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
Avoid second fetch
Checking out Revision e59d9a215b4af7a61afbcf027fe0c2f59dc4845f (master)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f e59d9a215b4af7a61afbcf027fe0c2f59dc4845f # timeout=10
Commit message: "Merge branch 'hotfix/remove-static-offer-results'"
First time build. Skipping changelog.
[Pipeline] }
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] emailext
Sending email to: REDACTED
[Pipeline] }
[Pipeline] // stage
[Pipeline] End of Pipeline
ERROR: 52bd6302-9db7-437b-8183-741ea068b4d9
Finished: FAILURE

```

Why is now the server skipping all the build stages?

---

<div class="post-metadata">

**Author:** ![halkeye](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/halkeye/32/8_2.png) [@halkeye](https://community.jenkins.io/u/halkeye)\
**Post date:** [October 21, 2021, 6:19pm UTC](https://community.jenkins.io/t/jenkins-is-only-checking-out-and-skipping-the-remaining-stages-from-my-jenkinsfile/628/2 "2021-10-21T18:19:38Z")

</div>

> [@ppicom](#):
>
> `ERROR: 52bd6302-9db7-437b-8183-741ea068b4d9`

Something is failing.

My guess is the `checkout scm` because I don’t see the second stage started. You don’t need that step though, declarative pipelines (ones that start with `pipeline {`) automatically checkout code so your just doing double the work.

Its also possible its the environment variables, I’m not sure what `BRANCH_NAME` would be at the start of your job if your not using multibranch pipelines. It may fail when trying to parse the first sh statement then?

---

<div class="post-metadata">

**Author:** ![saper](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/saper/32/138_2.png) [@saper](https://community.jenkins.io/u/saper)\
**Post date:** [October 23, 2021, 10:26pm UTC](https://community.jenkins.io/t/jenkins-is-only-checking-out-and-skipping-the-remaining-stages-from-my-jenkinsfile/628/3 "2021-10-23T22:26:23Z")

</div>

The UUID error is unusual; can you have a look the log of the Jenkins controller (of the java process?)

---

<div class="post-metadata">

**Author:** ![ppicom](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/ppicom/32/469_2.png) [@ppicom](https://community.jenkins.io/u/ppicom)\
**Post date:** [November 6, 2021, 6:27am UTC](https://community.jenkins.io/t/jenkins-is-only-checking-out-and-skipping-the-remaining-stages-from-my-jenkinsfile/628/4 "2021-11-06T06:27:12Z")

</div>

I’m very sorry! I did not get any notifications of these responses. Thank you very much for responding.

The thing is that this file works well with the old servers. And there is no difference in the configurations, I’ve checked that it’s indeed a multibranch pipeline.

I’ll retry the build without the checkout step and see how that plays out 🙂

---

<div class="post-metadata">

**Author:** ![ppicom](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/ppicom/32/469_2.png) [@ppicom](https://community.jenkins.io/u/ppicom)\
**Post date:** [November 6, 2021, 6:27am UTC](https://community.jenkins.io/t/jenkins-is-only-checking-out-and-skipping-the-remaining-stages-from-my-jenkinsfile/628/5 "2021-11-06T06:27:45Z")

</div>

> [@saper](#):
>
> can you have a look the log of the Jenkins controller (of the java process?)

I’ not really sure how to do that, but I’ll try 😃

---

<div class="post-metadata">

**Author:** ![ppicom](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/ppicom/32/469_2.png) [@ppicom](https://community.jenkins.io/u/ppicom)\
**Post date:** [November 6, 2021, 6:53am UTC](https://community.jenkins.io/t/jenkins-is-only-checking-out-and-skipping-the-remaining-stages-from-my-jenkinsfile/628/6 "2021-11-06T06:53:35Z")

</div>

# Mistery solved

> [@ppicom](#):
>
> ERROR: 52bd6302-9db7-437b-8183-741ea068b4d9

This error it’s caused by the new server trying to use a credential ID that no longer exists. Once changed to the new one, the pipeline worked like charm 🙂

Thanks a lot

---

<div class="post-metadata">

**Author:** ![shadycuz](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/shadycuz/32/196_2.png) [@shadycuz](https://community.jenkins.io/u/shadycuz)\
**Post date:** [November 6, 2021, 1:52pm UTC](https://community.jenkins.io/t/jenkins-is-only-checking-out-and-skipping-the-remaining-stages-from-my-jenkinsfile/628/7 "2021-11-06T13:52:30Z")

</div>

Probably should report that to the issue tracker, could be a better error message.
