Hi guys I m trying to s…

2 minute read

Hi guys, I’m trying to setup a CI/CD workflow for our Nx Repository and I have an issue when I want to get the builds of each of my apps. If I run nx affected:build --prod --with-deps locally, everything works fine and my dist folder gets filled correctly (some apps are retrieved from nx-cloud cache and others are built) but when the command is ran on CircleCI, the content of my dist folder only contains the nxdeps.json. Do you have an idea of what could cause such a problem ?

[UPDATE] - I the following log : NX No projects with "build" that are configured for "production" were run

Responses:

if you print nx affected:apps on CI what shows up? It could be an issue with CI shallow cloning, I have seen others run into that in th epast

I’ll try that right away

Cool let me know what it outputs!

What is your base branch on CI?

The master branch

That should be fine as nx will default to master but master might not be available due to a shallow clone or something.

Here is the result I get : > rosa@0.0.2 nx /root/rosa > nx "affected:apps" When I run it locally (from a feature branch), it shows the list of all my apps.

Are you running affected apps inside quotes?

No I don’t, the nx "affected:apps" log also appear locally

ah gotcha ok, what CI are you using?

CircleCi

ah then its not a shallow clone issue, we use circle and it works fine for us.

I used the following steps to make sur that the command was running well : ``` - run: name: DEBUG npm run nx affected:apps command: npm run nx affected:apps > output.txt

  - run:
      name: cat output
      command: cat output.txt```

May I ask how did you configure your CircleCI workflow so that it uses NxCloud ? Is there something specific that you need add before the tasksRunnerOptions attribute in your nx.json ?

Are you merging to master when running on CI?

Need to make sure your nx cloud auth token is either in an env variable or is in your nx.json

The workflow starts when there is a new commit on an open PR that should merge on master.

Ok, and you are not getting anything built in the first folder on the PR?

Then it should be fine. Thank you for your help

yes, the dist folder only contains the nxdeps.json while I would expect to have my apps folder like when I run the same command in local

Ok, my idea for what might be wrong seems to be invalid. I don’t have any experience with nxcloud yet… Probably have to run that past our security office. Good luck

Updated: