构建nodejs项目遇到问题,如图

拉取代码后,执行静态分析时候,目录下没有代码
jenkins的日志如图


各个阶段是在不同的nodejs容器中执行
agent {
node {
label 'nodejs'
}
}
stages {
stage('Checkout SCM') {
agent {
node {
label 'nodejs'
}
}
steps {
git(url: 'http://xx.xx.xx.xx:xx/xx/xx.git', credentialsId: 'gitlab-account', branch: 'master', changelog: true, poll: false)
}
}
stage('Code Analysis') {
agent {
node {
label 'nodejs'
}
}
steps {
container('nodejs') {
withCredentials([string(credentialsId : 'sonar-token' ,variable : 'SONAR_TOKEN' ,)]) {
withSonarQubeEnv('sonar') {
sh '''sonar-scanner \\
-Dsonar.projectKey=rdl-admin-backend \\
-Dsonar.sources=. \\
-Dsonar.host.url=http://xx.xx.xx.xx:xxxxx \\
-Dsonar.login=$SONAR_TOKEN'''
}
sh '''pwd
ls -lrt'''
}
timeout(unit: 'HOURS', activity: true, time: 1) {
waitForQualityGate 'true'
}
}
}
}
stage('Unit Test') {
agent {
node {
label 'nodejs'
}
}
steps {
container('nodejs') {
sh '''npm config set registry https://registry.npm.taobao.org
npm install
npm run test'''
}
}
}
stage('build & push') {
agent {
node {
label 'nodejs'
}
}
steps {
container('nodejs') {
withCredentials([usernamePassword(credentialsId : 'robot-rdl' ,passwordVariable : 'DOCKER_PASSWORD' ,usernameVariable : 'DOCKER_USERNAME' ,)]) {
sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin'
sh 'docker build -f Dockerfile -t $REGISTRY/$NAMESPACE/$APP_NAME:$BUILD_NUMBER .'
sh 'docker push $REGISTRY/$NAMESPACE/$APP_NAME:$BUILD_NUMBER'
}
}
}
}
}
}