ni / niveristand-custom-device-build-tools

Tools for automating builds of NI VeriStand custom devices.
MIT License
18 stars 28 forks source link

Pull build tools from repo specified in Jenkins #33

Open mbilyk opened 5 years ago

mbilyk commented 5 years ago

Currently, when you use Jenkins to pull in the build tools as a library, it pulls from the location specified as the repo in the Jenkins configuration. However, in the cloneBuildTools.groovy step it pulls the build tools from the organization that the repo going through the buildpipeline is from.

As an example, if I am trying to use Jenkins for CI on my repo called ExampleRepo located in ExampleOrg but I want to use the build tools from another organization called SeperateOrg then Jenkins will correctly pull the build tools from SeperateOrg but niveristand-custom-device-build-tools will pull the tools from ExampleOrg/niveristand-custom-device-build-tools if it exists (otherwise it throws and error)

As far as I can tell, this is because the code in niveristand-custom-device-build-tools/vars/cloneBuildTools.groovy get the organization containing the repo passing through the pipeline and uses that to clone the build tools.

It would be great if the build tools cloned from the same org specified in the Jenkins configuration.

mbilyk commented 5 years ago

The worked around is to fork the build tools into the org under test.

buckd commented 5 years ago

This would be nice. I looked into this awhile back and Jenkins doesn't give us a way to determine where the library was loaded from. The only variable I've found is library.vs-build-tools.version=master, where master is the branch the library is loaded from.

I have found no way to determine the URL of the loaded library.

mbilyk commented 5 years ago

I tried using Jenkins.instance.getAllItems and other methods from the link below to get the information. But I couldn't find anything conclusive. It also added a security threat to add that into the code, so it doesn't seem to be a good solution.

https://support.cloudbees.com/hc/en-us/articles/226941767-Groovy-to-list-all-jobs