# Execute pkg Without hab setup in jenkins slave?

**URL:** <https://discourse.chef.io/t/execute-pkg-without-hab-setup-in-jenkins-slave/18893>\
**Category:** Habitat Help\
**Created:** [December 1, 2018, 3:43pm UTC](https://discourse.chef.io/t/execute-pkg-without-hab-setup-in-jenkins-slave/18893 "2018-12-01T15:43:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![manojbison](https://avatars.discourse-cdn.com/v4/letter/m/c6cbf5/32.png) [@manojbison](https://discourse.chef.io/u/manojbison)\
**Post date:** [December 1, 2018, 3:43pm UTC](https://discourse.chef.io/t/execute-pkg-without-hab-setup-in-jenkins-slave/18893/1 "2018-12-01T15:43:46Z")

</div>

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?
```

---

<div class="post-metadata">

**Author:** ![js2](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/js2/32/3337_2.png) [@js2](https://discourse.chef.io/u/js2)\
**Post date:** [December 3, 2018, 3:39am UTC](https://discourse.chef.io/t/execute-pkg-without-hab-setup-in-jenkins-slave/18893/2 "2018-12-03T03:39:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![manojbison](https://avatars.discourse-cdn.com/v4/letter/m/c6cbf5/32.png) [@manojbison](https://discourse.chef.io/u/manojbison)\
**Post date:** [December 3, 2018, 4:31am UTC](https://discourse.chef.io/t/execute-pkg-without-hab-setup-in-jenkins-slave/18893/3 "2018-12-03T04:31:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![js2](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/js2/32/3337_2.png) [@js2](https://discourse.chef.io/u/js2)\
**Post date:** [December 3, 2018, 6:04am UTC](https://discourse.chef.io/t/execute-pkg-without-hab-setup-in-jenkins-slave/18893/4 "2018-12-03T06:04:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![manojbison](https://avatars.discourse-cdn.com/v4/letter/m/c6cbf5/32.png) [@manojbison](https://discourse.chef.io/u/manojbison)\
**Post date:** [December 4, 2018, 6:10pm UTC](https://discourse.chef.io/t/execute-pkg-without-hab-setup-in-jenkins-slave/18893/5 "2018-12-04T18:10:07Z")

</div>

pipeline {  
agent {  
label “win”  
}  
environment {  
HAB\_NOCOLORING = true  
HAB\_BLDR\_URL = ‘[https://bldr.habitat.sh/](https://bldr.habitat.sh/)’  
HAB\_ORIGIN = ‘skylerto’  
HAB\_AUTH\_TOKEN=‘something’  
}

```
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

```auto

```

---

<div class="post-metadata">

**Author:** ![eeyun1](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/eeyun1/32/2658_2.png) [@eeyun1](https://discourse.chef.io/u/eeyun1)\
**Post date:** [December 5, 2018, 3:45pm UTC](https://discourse.chef.io/t/execute-pkg-without-hab-setup-in-jenkins-slave/18893/6 "2018-12-05T15:45:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![manojbison](https://avatars.discourse-cdn.com/v4/letter/m/c6cbf5/32.png) [@manojbison](https://discourse.chef.io/u/manojbison)\
**Post date:** [December 10, 2018, 6:26pm UTC](https://discourse.chef.io/t/execute-pkg-without-hab-setup-in-jenkins-slave/18893/7 "2018-12-10T18:26:51Z")

</div>

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