Jenkins CI - npx nx affected --target=build throws as error
See original GitHub issueExpected Behavior
Build should execute on Jenkins with same source as executes on local environment
Current Behavior
Source checked into git, Jenkins multi branch pipeline executes
Build stage fails with error:
- npx nx affected --target=build – master HEAD fatal: Not a valid object name affected Command failed: git merge-base affected master fatal: Not a valid object name affected
Steps to Reproduce
Please provide detailed steps for reproducing the issue.
- Source repo available at https://git.symbiotics.co.za/mike.love/NXPoC.git
- Checkout locally, build via npm install & npm run build => successful nx build
- Run as Jenkinsmulti pipeline build
Context
Please provide any relevant information about your setup:
- version of Nx used (Please run
nx report
at the root of your workspace and copy the results here if you are using Nx 8.6.1 or greater) - 3rd-party libraries and their versions
- and most importantly - a use-case that fails
A minimal reproduction scenario allows us to quickly confirm a bug (or point out coding problem) as well as confirm that we are fixing the right problem.
Failure Logs
Extract of log file included below:
- printenv JENKINS_HOME=/var/lib/jenkins MAIL=/var/mail/ubuntu SSH_CLIENT=10.33.11.191 35228 22 USER=ubuntu RUN_CHANGES_DISPLAY_URL=https://tools.symbiotics.co.za/jenkins/job/Symbiotics/job/ResearchAndDevelopment/job/Mike-NXPoC/job/master/1/display/redirect?page=changes NODE_LABELS=AWSCLI-1.14 EC2 (us-east-1) - Ubuntu slave - general purpose (i-010bf32acc1726c8d) HUDSON_URL=https://tools.symbiotics.co.za/jenkins/ GIT_COMMIT=822981fd6da97e2d71e35656d41c5b4c32f6bdea SHLVL=1 HOME=/home/ubuntu BUILD_URL=https://tools.symbiotics.co.za/jenkins/job/Symbiotics/job/ResearchAndDevelopment/job/Mike-NXPoC/job/master/1/ HUDSON_COOKIE=d35a3660-b7a9-47c5-b8b3-4b5d45c3f71d JENKINS_SERVER_COOKIE=durable-e8c8bc3e63db0bf107f0b2bd92c8d9d3 JBOSS_HOME=/opt/wildfly-8.2.0.Final WORKSPACE=/var/lib/jenkins/workspace/AndDevelopment_Mike-NXPoC_master LOGNAME=ubuntu NODE_NAME=EC2 (us-east-1) - Ubuntu slave - general purpose (i-010bf32acc1726c8d) _=/usr/bin/java STAGE_NAME=Env Setup EXECUTOR_NUMBER=1 GIT_BRANCH=master XDG_SESSION_ID=3 BUILD_DISPLAY_NAME=#1 HUDSON_HOME=/var/lib/jenkins JOB_BASE_NAME=master PATH=/var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS_12.14.1/bin:/var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS_12.14.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/ubuntu/android-sdk-linux/tools:/home/ubuntu/android-sdk-linux/platform-tools BUILD_ID=1 XDG_RUNTIME_DIR=/run/user/1000 DISPLAY=:0.0 BUILD_TAG=jenkins-Symbiotics-ResearchAndDevelopment-Mike-NXPoC-master-1 LANG=en_US.UTF-8 NODEJS_HOME=/var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS_12.14.1 JENKINS_URL=https://tools.symbiotics.co.za/jenkins/ JOB_URL=https://tools.symbiotics.co.za/jenkins/job/Symbiotics/job/ResearchAndDevelopment/job/Mike-NXPoC/job/master/ GIT_URL=https://git.symbiotics.co.za/mike.love/NXPoC.git BUILD_NUMBER=1 JENKINS_NODE_COOKIE=3d497345-2c4f-4f76-ae5e-5938937842cd SHELL=/bin/bash RUN_DISPLAY_URL=https://tools.symbiotics.co.za/jenkins/job/Symbiotics/job/ResearchAndDevelopment/job/Mike-NXPoC/job/master/1/display/redirect HUDSON_SERVER_COOKIE=32f647d765b2b380 JOB_DISPLAY_URL=https://tools.symbiotics.co.za/jenkins/job/Symbiotics/job/ResearchAndDevelopment/job/Mike-NXPoC/job/master/display/redirect JOB_NAME=Symbiotics/ResearchAndDevelopment/Mike-NXPoC/master PWD=/var/lib/jenkins/workspace/AndDevelopment_Mike-NXPoC_master LC_ALL=en_US.UTF-8 ANDROID_HOME=/home/ubuntu/android-sdk-linux SSH_CONNECTION=10.33.11.191 35228 10.33.11.19 22 BRANCH_NAME=master [Pipeline] } [Pipeline] // script [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // stage [Pipeline] stage [Pipeline] { (Build) [Pipeline] tool [Pipeline] envVarsForTool [Pipeline] withEnv [Pipeline] { [Pipeline] nodejs [Pipeline] { [Pipeline] sh
- node -v v12.14.1
- npm -v 6.13.4
- npx nx affected --target=build – master HEAD fatal: Not a valid object name affected Command failed: git merge-base affected master fatal: Not a valid object name affected
[Pipeline] } [Pipeline] // nodejs [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // stage [Pipeline] stage [Pipeline] { (Declarative: Post Actions) [Pipeline] archive The archive step is deprecated, please use archiveArtifacts instead. [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // timeout [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline ERROR: script returned exit code 1 Finished: FAILURE
Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (5 by maintainers)
I think this is worth to mention in the document.
@vsavkin ,
Just a suggestion, I had the same issue with jenkins where the origin develop was not fetched as jenkins was doing shadow cloning, I resolved the issue by enabling advanced clone option in multibranch pipline and enable fetch tags. It helped me. I hope it helps you.