我曾两次被迫将 jenkins 服务器从一台服务器更改为另一台服务器。第一次,我将其从 Ubuntu 20.04 服务器移至 Ubuntu 21,没有任何问题;构建(多分支管道)运行良好。
但是现在我不得不再次将 jenkins 更改为另一台运行 Debian 10 的服务器,现在管道跳过了除结帐和发布(发送电子邮件)之外的所有步骤。
这是 Jenkinsfile:
pipeline {
agent any
environment {
GIT_BRANCH = "origin/${BRANCH_NAME}"
BRANCH_NAME = "${BRANCH_NAME}"
REGISTRY_CREDENTIALS = credentials('REDACTED')
REGISTRY= "my.remote.regsitry"
}
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 my.remote.registry
'''
}
}
stage ('Push') {
steps {
sh '''#!/bin/bash
cd ci
echo "Logging in the $REGISTRY registry as $REGISTRY_CREDENTIALS_USR ..."
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 dockdev.epiclabs.io
if [ -e alias.sh ] ; then
. ./gitinfo.sh
./alias.sh "$TAG" "$BRANCH" my.remote.registry
./push.sh --tag "$BRANCH" my.remote.registry
fi
'''
}
}
stage ('Deploy') {
steps {
sh '''#!/bin/bash
cd ci
./deploy.sh "192.168.10.254/cid" my.remote.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'
}
}
}
管道在前两台服务器中运行良好(部署它应该会失败,这不是我所说的问题:)):
没有反映任何错误的日志。我不知道还能去哪里查找。