How to download privately listed package using chef habitat cookbook?

chef

#1

I have built a package that I uploaded to a private organisation.

When trying to make use of the habitat cookbook https://github.com/chef-cookbooks/habitat and try to install that package using hab_package, the chef run fails with No candidate version available for myorigin/mypackage

I was not able to resolve this issue, however I very much suspect that this is related to a missing token, to authorise the download from the private organisation. If I publish the package as public, then everything works.

I tried to set the token using a statement like this before the hab_package statement:
ENV['HAB_AUTH_TOKEN'] = '_mytoken'
however that did not change anything.

Does anyone currently use chef to setup the supervisor deploying a private package and know how that should be done?


#2

after some more digging, I think the answer is this is not (yet) supported by the cookbook.
Setting the system property probably does not work because the hab command might be executed as another user (not 100% sure here though)

So to work around that I guess there are three options:

  • setup the hab user manually and provide the necessary configs (cli.toml should probably be enough)
  • use the execute resource to install hab packages and provide the token here
  • fix it in the cookbook. (which should probably not be too difficult, but yet I would like to get some feedback here first, as I am certainly no chef expert)

#3

@jtimberman do you or the other maintainers of the hab cookbook have any suggestions on this one? I haven’t attempted/tested this myself. I might get some time this week to take a look and see what makes sense but if any of yall know off the top of your head that would be :+1:


#4

Hmm, looks like @jtimberman hasn’t been active here for quite some time. Should I open an issue over at the repo?


#5

Might be a good idea. The hab dev team doesn’t maintain that cookbook. I did reach out to joshua this morning to see if he had any ideas. But, opening an issue there might be more direct.


#6

Great thanks. seems to be the best place for now :slight_smile: https://github.com/chef-cookbooks/habitat/issues/102