question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Jenkins CI - npx nx affected --target=build throws as error

See original GitHub issue

Expected 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.

  1. Source repo available at https://git.symbiotics.co.za/mike.love/NXPoC.git
  2. Checkout locally, build via npm install & npm run build => successful nx build
  3. 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:

[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:closed
  • Created 4 years ago
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
maxisamcommented, Aug 10, 2021

I think this is worth to mention in the document.

2reactions
SanthoshKumar-Prodaptcommented, Mar 25, 2021

@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. Screenshot 2021-03-25 at 23 24 56

Read more comments on GitHub >

github_iconTop Results From Across the Web

A brand new website interface for an even better experience!
Jenkins CI - npx nx affected --target=build throws as error.
Read more >
Using nx run-many shows: Another process, with id ..., is ...
Our CI server is running all builds in docker containers using Ubuntu. We are storing and sharing the computation caching across all build ......
Read more >
nrwl-nx/community - Gitter
Hi, I am trying to run npx nx affected --target=build --base=origin/develop to see if I can get this working in my CI process....
Read more >
Setting up Jenkins - Nx
CHANGE_TARGET} --target=test --parallel=3 --ci --code-coverage" sh "npx nx affected --base origin/${env.CHANGE_TARGET} --target=build --parallel=3" ...
Read more >
Getting Started with Monorepo with Nx Nrwl - Rupesh Tiwari
The potential solution to this problem is Monorepo. You can put all of your JavaScript projects regardless of framework (angular, vue.js, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found