var request = require(\'sync-request\');
const hostName = \'http://your.gitlab.hostname\';
const projectId = \'your.project.id\';
const privateToken = \'your.private.token\';
function readPipelineVariable(varName) {
var res = request(
\'GET\',
`${hostName}/api/v3/projects/${projectId}/variables`,
{
headers: {
\'Content-Type\': \'application/json\',
\'Private-Token\': privateToken
}
}
);
var json = JSON.parse(res.getBody(\'utf8\'));
for (var x = 0; x < json.length; x++) {
if (json[x].key == varName) {
console.log(varName + \': \' + json[x].value);
return json[x].value;
}
}
}
module.exports = {
readPipelineVariable: readPipelineVariable
};