Just exploring Habitat and trying to get an on-premise builder working.
Installed on-premise habitat builder sucessfully
Integrated OAUTH with BitBucket successfully
So, I read somewhere that auto-build on commit of repo was not supported for any repositories other than GitHub.
So, I wanted to build a Bamboo pipeline to test the workflow of code commit -> build/package -> upload to builder/depot -> and auto-update a running application using bitbucket as a source control repository.
So trying to build my package with hab studio build and it fails with the following:
» Binlinking sh from core/bash into /hab/studios/src/bin
★ Binlinked sh from core/bash/4.3.42/20170513213519 to /hab/studios/src/bin/sh
hab-studio: Building '' in Studio at /hab/studios/src (default)
hab-studio: Exported: HAB_AUTH_TOKEN=[redacted]
hab-studio: Exported: HAB_ORIGIN=[redacted]
hab-studio: Exported: HAB_BLDR_URL=[redacted]
Usage: record <SESSION> [CMD [ARG ..]]
Any ideas what is wrong? Seems like hab studio build has issues.
How do you build habitat packages from an external script? Does anyone have any samples that you are willing to share?
Now the next step, how do you upload a package when you are not in studio? IT cant find the dependent packages when not in studio.
✓ Signed artifact with myorigin-20180611050039.pub
» Uploading public origin key myorigin-20180611050039.pub
80 B / 80 B | [===========================================================================] 100.00 % 123 B/s
→ Using existing public origin key myorigin-20180611050039.pub
» Uploading ./results/myorigin-sample-node-app-1.1.7-20180614065656-x86_64-linux.hart
∵ Missing artifact core-bash-4.3.42-20170513213519-x86_64-linux.hart. It was not found in ./results
∵ Missing artifact core-bash-4.3.42-20170513213519-x86_64-linux.hart. It was not found in ./results
∵ Missing artifact core-bash-4.3.42-20170513213519-x86_64-linux.hart. It was not found in ./results
∵ Missing artifact core-bash-4.3.42-20170513213519-x86_64-linux.hart. It was not found in ./results
∵ Missing artifact core-bash-4.3.42-20170513213519-x86_64-linux.hart. It was not found in ./results
✗✗✗
✗✗✗ Upload failed: We tried 5 times but could not upload core/bash/4.3.42/20170513213519. Giving up.
✗✗✗
I think you’ll need to ensure that the dependent packages are already on your builder instance.
A new builder installation has no core packages on it
To do this, you can (from a hab-sup that is linked to your builder) simply install the required packages. This will do an initial sync of the package you want to install, and all its dependencies.
Got it. I kicked off the build on my workstation/bamboo instance rather than the builder instance. I have loaded the core packages already on the instance so they are there. I guess the build will need to run on the bldr instance itself?
If I run it from command line or build ok. If I exit studio and try and run hab packageu upload it fails. If I run hab package upload from within studio it works
I wonder whether the environment variables are not honoured when not in studio. I’m away from my machine now but will try explicitly setting url from command line and see if that makes a difference
There are environment variables that do get carried into the studio but I can’t recall if it’s all of them or not. If you’re using an on-prem builder the envvar you need is HAB_BLDR_URL . For a quick reference of our supported envvars you can check this page out https://www.habitat.sh/docs/reference/#environment-variables
This does not seem to work when outside of studio. Only when I run hab studio enter am I able to upload an artifact.
When outside the studio, I get errors about missing core packages (∵ Missing artifact core-bash-4.3.42-20170513213519-x86_64-linux.hart. It was not found in ./results), however these are in my hab cache in $HOME/.hab/cache folder.
If I enter the studio hab studio enter, and then run hab pkg upload, then it works ok.
How are people building and uploading packages from an external script (in a pipeline)? Or are people just using the SaaS builder and integrating with GitHub for automated builds?