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:
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:
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?