Execute pkg Without hab setup in jenkins slave?


Hi guys,

I have to build habitat package in one of my jenkins windows slave. I have my own orgin in habitat builder. How to build a pkg in jenkins slave without hab cli setup in slave but by using my habitat builder url and origin

I have used with habitat executer but i cannot connect to habitat builder origin

Is hab cli setup is mandatory to do in all nodes? When i change my origin again i have to do hab cli setup in all nodes?


I believe what you need is an HAB_AUTH_TOKEN for the origin and these environment variables at runtime HAB_ORIGIN and HAB_BLDR_URL on the slave/follower node. I think that is all you really need to build and upload a pkg to an origin.


Can you please elaborate and provide me with some useful command to achieve this and please explain about the origin keys, secret key

Thank you in advance


The properties being set by the hab cli setup are just setting some values. You can either grab those values from a toml file that is located typically in the users base home/profile directory. In the %USERPROFILE%/.hab/etc/cli.toml. If you prefer not to use that you can just set environment with the appropriate values as part of the script that is run to build the package. For the other values you are going use set HAB_BLDR_URL or $env:HAB_BLDR_URL = 'ADDRESS OF BUILDER'

Set Environment Variables

In an expression use this syntax: $env:VariableName = ‘new-value’

For example, to append “finance” to the value of the TEAMS environment variable:

$env:TEAMS = $env:TEAMS + “finance”

You can also change environment variables with Set-Item, Remove-Item, and Copy-Item.

Set-Item -path env:TEAMS -value ($env:TEAMS + ‘finance’)

Note the use of parentheses.


pipeline {
agent {
label “win”
environment {
HAB_BLDR_URL = ‘https://bldr.habitat.sh/
HAB_ORIGIN = ‘skylerto’

stages {
    stage('scm') {
        steps {
            git url: 'https://github.com/skylerto/nexus-habitat.git', branch: 'master'
    stage('build') {
        steps {
            habitat task: 'build', directory: '.', origin: env.HAB_ORIGIN,bldrUrl: env.HAB_BLDR_URL,authToken: env.HAB_AUTH_TOKEN
    stage('upload') {
        steps {
            withCredentials([string(credentialsId: 'depot-token', variable: 'HAB_AUTH_TOKEN')]) {
                habitat task: 'upload', directory: "${workspace}", authToken: env.HAB_AUTH_TOKEN


this is sample jenkins pipeline .if i give like this it will work with hab builder directly without hab cli setup on win agent ? or i have to do any changes


I haven’t worked in a Jenkins pipeline for a while and thus i can’t speak to your actual code but, the environment variables as set up would be correct theoretically. If you’ve generated your HAB_AUTH_TOKEN that should be all that you need for AuthN and AuthZ.


Am using on premises builder that one dont have default studio in it. I need jenkins library to download keys