Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

Commit

Permalink
Do not quote env vars on Linux
Browse files Browse the repository at this point in the history
Docker uses them literally.
  • Loading branch information
gaborcsardi committed Nov 20, 2018
1 parent 9998c77 commit e12de37
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/builder.js
Expand Up @@ -42,13 +42,14 @@ function add_jenkins_job(conn, job, callback) {

function build_jenkins_job(conn, job, callback) {
var job_name = jenkins_job_name(job);
var env_vars = flatten_env_vars(job.envVars, job.ostype !== "Linux");
var parameters = {
'package': job.package,
'filename': job.filename,
'url': job.url,
'image': job.image || "",
'checkArgs': job.checkArgs || "",
'envVars': flatten_env_vars(job.envVars) || "",
'envVars': env_vars || "",
'rversion': job.rversion || "r-release",
'startPingUrl': job.builder + '/build/in-progress/' + job_name,
'endPingUrl': job.builder + '/build',
Expand All @@ -66,13 +67,18 @@ function build_jenkins_job(conn, job, callback) {
)
}

function flatten_env_vars(x) {
function flatten_env_vars(x, should_quote) {
if (x === null || x === undefined || x === "") return(null);
return Object.keys(x)
.map(function(key) {
var k = String(key);
var v = String(x[key]);
return quote([k]) + "=" + quote([v]); })
if (should_quote) {
return quote([k]) + "=" + quote([v]);
} else {
return k + "=" + v;
}
})
.join("\n");
}

Expand Down

0 comments on commit e12de37

Please sign in to comment.