@pixlcore/xyrun 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/main.js +15 -3
- package/package.json +1 -1
package/main.js
CHANGED
|
@@ -135,9 +135,13 @@ const app = {
|
|
|
135
135
|
var child_args = process.argv.slice(2);
|
|
136
136
|
var child_cmd = child_args.shift();
|
|
137
137
|
var child_opts = {
|
|
138
|
-
env: Object.assign( {}, process.env )
|
|
138
|
+
env: Object.assign( {}, process.env, job.secrets || {} )
|
|
139
139
|
};
|
|
140
140
|
|
|
141
|
+
child_opts.env['XYOPS'] = 'runner-' + pkg.version;
|
|
142
|
+
child_opts.env['JOB_ID'] = job.id;
|
|
143
|
+
child_opts.env['JOB_NOW'] = job.now;
|
|
144
|
+
|
|
141
145
|
if (!child_cmd && job.params && job.params.script) {
|
|
142
146
|
// no direct command specified, but user wants a "script" executed from the job params
|
|
143
147
|
var script_file = Path.join( job.cwd, 'xyops-script-temp-' + job.id + '.sh' );
|
|
@@ -173,8 +177,6 @@ const app = {
|
|
|
173
177
|
return;
|
|
174
178
|
}
|
|
175
179
|
|
|
176
|
-
console.log( "Running command: " + child_cmd, child_args );
|
|
177
|
-
|
|
178
180
|
// get uid / gid info for child env vars
|
|
179
181
|
if (!this.platform.windows) {
|
|
180
182
|
child_opts.uid = job.uid || process.getuid();
|
|
@@ -220,6 +222,16 @@ const app = {
|
|
|
220
222
|
child_opts.gid = parseInt( child_opts.gid );
|
|
221
223
|
}
|
|
222
224
|
|
|
225
|
+
// add plugin params as env vars, expand $INLINE vars
|
|
226
|
+
if (job.params) {
|
|
227
|
+
for (var key in job.params) {
|
|
228
|
+
child_opts.env[ key.replace(/\W+/g, '_') ] =
|
|
229
|
+
(''+job.params[key]).replace(/\$(\w+)/g, function(m_all, m_g1) {
|
|
230
|
+
return (m_g1 in child_opts.env) ? child_opts.env[m_g1] : '';
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
223
235
|
// windows additions
|
|
224
236
|
if (this.platform.windows) {
|
|
225
237
|
child_opts.windowsHide = true;
|