@@ -31,35 +31,60 @@ test:
3131 stage('prepare') {
3232 steps {
3333 installOtelCli()
34+ installHermit()
3435 }
3536 }
3637 stage('make build') {
3738 steps {
3839 withEnv(["PATH+OTEL=\${OTEL_LOCATION}" ]) {
39- sh(label: 'make build', script: "OTEL_EXPORTER_OTLP_ENDPOINT=\${env.OTEL_EXPORTER_OTLP_ENDPOINT.replaceAll('http://', '')} make build" )
40+ runWithHermit(){
41+ sh(label: 'make build', script: "OTEL_EXPORTER_OTLP_ENDPOINT=\${env.OTEL_EXPORTER_OTLP_ENDPOINT.replaceAll('http://', '')} make build" )
42+ }
4043 }
4144 }
4245 }
4346 stage('make test') {
4447 steps {
4548 withEnv(["PATH+OTEL=\${OTEL_LOCATION}" ]) {
46- sh(label: 'make test', script: "OTEL_EXPORTER_OTLP_ENDPOINT=\${env.OTEL_EXPORTER_OTLP_ENDPOINT.replaceAll('http://', '')} make test" )
49+ runWithHermit(){
50+ sh(label: 'make test', script: "OTEL_EXPORTER_OTLP_ENDPOINT=\${env.OTEL_EXPORTER_OTLP_ENDPOINT.replaceAll('http://', '')} make test" )
51+ }
4752 }
4853 }
4954 }
5055 }
5156}
5257
58+ def runWithHermit(Closure body){
59+ hermitEnvVars = sh(returnStdout: true, script: './hermit/bin/hermit env --raw').trim()
60+ withEnv(hermitEnvVars.split('\\n').toList()) {
61+ body()
62+ }
63+ }
64+
5365def installOtelCli() {
5466 def os = 'Linux'
5567 if (sh(script: 'uname -a | grep -i Darwin', returnStatus: true) == 0 ) {
5668 os = 'Darwin'
5769 }
5870 dir("\${OTEL_LOCATION}" ) {
5971 sh(label: 'fetch otel-cli',
60- script: "wget -q 'https://github.com/equinix-labs/otel-cli/releases/download/v0.0.18/otel-cli-0.0.18-\${os}-x86_64.tar.gz' -O otel-cli.tar.gz && tar -xf otel-cli.tar.gz" )
72+ script: "curl -sSfL -o otel-cli.tar.gz 'https://github.com/equinix-labs/otel-cli/releases/download/v0.0.18/otel-cli-0.0.18-\${os}-x86_64.tar.gz' && tar -xf otel-cli.tar.gz" )
6173 }
6274}
75+
76+ def installHermit() {
77+ sh(label: 'installHermit',
78+ script: 'curl -fsSL https://github.com/cashapp/hermit/releases/download/stable/install.sh | /bin/bash')
79+ sh(label: 'install tools',
80+ script: '''
81+ mkdir -p hermit
82+ cd hermit
83+ ~/bin/hermit init
84+ eval \$(./bin/hermit env --raw)
85+ hermit install make
86+ ''')
87+ }
6388"" "
6489
6590pipelineJob(NAME) {
0 commit comments