Howto - Upload package output from a CI/CD build to private builder


#1

I ran into a a small problem hooking my on-premise builder to our CI server.
When uploading the new package hab pkg upload -u https://your-server results/$pkg_artifact it would fail because a lot of the dependencies for my package might not yet be present in the builder. Missing artifact core/something and was not found in the results

TLDR; Upload from the habitat artifact cache instead hab pkg upload -u https://yourserver /hab/cache/artifacts/$pkg_artifact

I’m curious, bored or both:

Habitat has this feature where it will look in the folder where the .hart is you are uploading for any potential dependencies. This is so that you can build multiple plans within a dependency graph and then upload them all together.

Because I have jenkins and builder running the same server this is helpful. To build a package I do hab studio build . from a jenkins job. This reuses the /hab/cache/artifacts directory between studios and puts my .hart file there after it is built. So instead of uploading from my results folder I upload from here and then any dependencies (or transitive dependencies) will have been cached here by habitat and are available to upload.

My upload command is source results/last_build.env && hab pkg upload -u https://yourcompany -z $TOKEN /hab/cache/artifacts/$pkg_artifact


Cannot download packages from on-prem builder