Help with getting hab pkg builds to happen in jenkins kubernetes pipelines

OK, I have the same issue. I have a jenkins kubernetes pipeline which works except when I need to build a new habitat package.

I have attempted this 2 ways. The 1st way is not using the habitat/default-image which I just learned about. It’s slower cause it has to download the hab studio stuff which is does successfully. Once the build starts with the plan. It looks like all is going well and I get the following error. Keep in mind the package exists and the issue is only here. ✓ Installed core/zlib/1.2.11/20190115003728
✓ Installed core/hab-backline/0.88.0/20191009212049
★ Install of core/hab-backline/0.88.0/20191009212049 complete with 40 new packages installed.
» Binlinking hab from core/hab into /hab/studios/home–jenkins–agent–workspace–ce-hab-build/hab/bin
★ Binlinked hab from core/hab/0.88.0/20191009204957 to /hab/studios/home–jenkins–agent–workspace–ce-hab-build/hab/bin/hab
» Binlinking bash from core/bash into /hab/studios/home–jenkins–agent–workspace–ce-hab-build/bin
★ Binlinked bash from core/bash/4.4.19/20190115012619 to /hab/studios/home–jenkins–agent–workspace–ce-hab-build/bin/bash
» Binlinking sh from core/bash into /hab/studios/home–jenkins–agent–workspace–ce-hab-build/bin
★ Binlinked sh from core/bash/4.4.19/20190115012619 to /hab/studios/home–jenkins–agent–workspace–ce-hab-build/bin/sh
hab-studio: Building ‘.’ in Studio at /hab/studios/home–jenkins–agent–workspace–ce-hab-build (default)
hab-studio: Exported: HAB_AUTH_TOKEN=[redacted]
hab-studio: Exported: HAB_ORIGIN=cortevents
hab-studio: Exported: HAB_BLDR_URL=https://bldr.cort.com
hab-studio: Exported: HAB_NOCOLORING=true
Script started, file is /src/results/logs/Magento-EE.2019-11-15-150956.log
: Loading /src/plan.sh
Magento-EE: Plan loaded
Magento-EE: Validating plan metadata
Magento-EE: Using HAB_BIN=/hab/pkgs/core/hab/0.88.0/20191009204957/bin/hab for installs, signing, and hashing
Magento-EE: hab-plan-build setup
Magento-EE: Writing pre_build file
Magento-EE: Resolving build dependencies
Magento-EE: Resolving run dependencies
» Installing core/coreutils
:cloud: Determining latest version of core/coreutils in the ‘stable’ channel
✗✗✗
✗✗✗ https://bldr.cort.com/v1/depot/channels/core/stable/pkgs/coreutils/latest?target=x86_64-linux: error trying to connect: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed:s3_clnt.c:1269: (self signed certificate in certificate chain)
✗✗✗
Magento-EE: Resolved dependency ‘core/coreutils’ to /hab/pkgs/core/coreutils/8.30/20190115012313
» Installing core/freetype
:cloud: Determining latest version of core/freetype in the ‘stable’ channel
✗✗✗
✗✗✗ https://bldr.cort.com/v1/depot/channels/core/stable/pkgs/freetype/latest?target=x86_64-linux: error trying to connect: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed:s3_clnt.c:1269: (self signed certificate in certificate chain)
✗✗✗
Magento-EE: WARN: Could not find a suitable installed package for ‘core/freetype’
Magento-EE: ERROR: Resolving ‘core/freetype’ failed, should this be built first?
Magento-EE: Build time: 0m1s
Magento-EE: Exiting on error
Script done, file is /src/results/logs/Magento-EE.2019-11-15-150956.log
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // podTemplate
[Pipeline] End of Pipeline
java.io.IOException: Failed to execute build
at org.jenkinsci.plugins.habitat.HabitatExecutor.perform(HabitatExecutor.java:496)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE

Now using the habitat/default-studio

once the build command is references the pipeline just sits. It will eventually fail starting the build never started. It’s like it just hangs
[Pipeline] }
[Pipeline] // container
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (build)
[Pipeline] container
[Pipeline] {
[Pipeline] sh
process apparently never started in /home/jenkins/agent/workspace/cortevents-habitat-build@tmp/durable-e8f9c259
(running Jenkins temporarily with -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true might make the problem clearer)
[Pipeline] }
[Pipeline] // container
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // podTemplate
[Pipeline] End of Pipeline
ERROR: script returned exit code -2
Finished: FAILURE

pipeline example
stage(‘build’) {
steps {
container(‘hab-studio-ce’) {
//sh ‘id’
//sh ‘ls -la’
//sh 'hab origin key download HAB_ORIGIN' //echo 'Running habitat build' sh 'build /src/workspace/cortevents-habitat-build/' //habitat task: 'build', directory: '.', origin: "{env.HAB_ORIGIN}", docker: false
}
}

I believe you best bet is the environment variable.

export SSL_CERT_FILE=/path/to/cert
build /path/to/plan.sh

I have tried that rember this is runner inside a container in my kubernetes cluster. I can run the same container on my local and it’s works. not sure why I am getting ssl

hab-studio: Running ‘export SSL_CERT_FILE=.hab/cache/ssl/cert.pem && build .’ in Studio at /hab/studios/home–jenkins–agent–workspace–ce-hab-build (default)

: Loading /src/plan.sh
Magento-EE: Plan loaded
Magento-EE: Validating plan metadata
Magento-EE: Using HAB_BIN=/hab/pkgs/core/hab/0.88.0/20191009204957/bin/hab for installs, signing, and hashing
Magento-EE: hab-plan-build setup
Magento-EE: Writing pre_build file
mkdir: created directory ‘/src/results’
Magento-EE: Resolving build dependencies
Magento-EE: Resolving run dependencies
» Installing core/coreutils
:cloud: Determining latest version of core/coreutils in the ‘stable’ channel
✗✗✗
✗✗✗ https://bldr.cort.com/v1/depot/channels/core/stable/pkgs/coreutils/latest?target=x86_64-linux: error trying to connect: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed:s3_clnt.c:1269: (self signed certificate in certificate chain)
✗✗✗
Magento-EE: Resolved dependency ‘core/coreutils’ to /hab/pkgs/core/coreutils/8.30/20190115012313
» Installing core/freetype
:cloud: Determining latest version of core/freetype in the ‘stable’ channel
✗✗✗
✗✗✗ https://bldr.cort.com/v1/depot/channels/core/stable/pkgs/freetype/latest?target=x86_64-linux: error trying to connect: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed:s3_clnt.c:1269: (self signed certificate in certificate chain)
✗✗✗
Magento-EE: WARN: Could not find a suitable installed package for ‘core/freetype’
Magento-EE: ERROR: Resolving ‘core/freetype’ failed, should this be built first?
Magento-EE: Build time: 0m0s
Magento-EE: Exiting on error
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] }

[Pipeline] // podTemplate
[Pipeline] End of Pipeline
ERROR: script returned exit code 1
Finished: FAILURE