Is anyone using Jenkins …

2 minute read

Is anyone using Jenkins? I have been having trouble getting the affected scripts to work because it can’t find the base branch. I think it has to do with how jenkins checks out defaultly. Has anyone gotten this to work?

Responses:

I remember we helped someone else out with this a while ago, if I remember correctly it was because jenkins does a shallow clone of the repo. I believe there are settings that will allow you to change how jenkins clones the repository

I believe you have to run ‘git fetch’ to get the base branch on Jenkins

Thanks

did git fetch work? it was a few months ago when jay and i help someone else with Jenkins

Haven’t had a chance yet, I will take a look but that was what I was figuring. I will update the thread with my findings.

no worries, sounds good

git fetch didn’t work for me, I was hoping I could find a way to configure jenkins to just work but currently the only solution I have found that works is to set the –base flag

nx affected:apps --base=remotes/origin/master

  • do you know if the default base can be set in the nx.json I did a little bit of a source dive a while back to see if there was some undocumented property but if it is there I must have missed it

ahhh - here is the feat req https://github.com/nrwl/nx/issues/1791

haha i have been thinking about implementing that feature myself!

  • Awesome! This is what I have been looking for, I have been monitoring that feature request for Jenkins, Azure

I hope to have some time to get this implemented internally as we can’t continue to add more apps and libraries until we can only build the affected code

nx affected --target=release will execute any tasks defined in angular.json named release

You can use the run-commands builder to easily launch a terminal command as a task. API: https://nx.dev/web/api/workspace/builders/run-commands Walkthrough: https://connect.nrwl.io/app/cookbook/1BarpEG6zfxCv4evBvJSWi

Man…. wish I didn’t have a sprint full of other things I am supposed to get done :slightly_smiling_face:

#devlife lol

that is PERFECT! I just added the following to my angular.json and it just works

"architect": { "release":{ "builder": "@nrwl/workspace:run-commands", "options": { "commands": [ { "command": "npx semantic-release --extends=./apps/member-portal-webui/release.config.js" } ] } }

As a note for someone else who might read this. This is using the semantic-release-plus -https://www.npmjs.com/package/semantic-release-plus a fork of semantic-release that allows filtering by commit path

  • would the nx team be interested in this type a feature to add a schematic to add semantic-releasing to apps and publishable libraries?

I’m not speaking for everyone else, but I’m interested. I would love to manage my open source libraries with Nx and semantic release plus is on my list of things to check out

Sounds good, I will take your example Jenkins repo fork it and add the semantic-release-plus stuff to a couple apps and libraries.

Also, I have some feedback on the Jenkins example repo what would be the best way to communicate that?

you could open an issue on that repo. I didn’t create the repo itself, so I wouldn’t be the best person to talk about why its configured the way it is

Thanks, will do.

Updated: