@pixlcore/xyrun 1.0.3 → 1.0.4

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.
Files changed (2) hide show
  1. package/main.js +15 -1
  2. 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' );
@@ -220,6 +224,16 @@ const app = {
220
224
  child_opts.gid = parseInt( child_opts.gid );
221
225
  }
222
226
 
227
+ // add plugin params as env vars, expand $INLINE vars
228
+ if (job.params) {
229
+ for (var key in job.params) {
230
+ child_opts.env[ key.replace(/\W+/g, '_') ] =
231
+ (''+job.params[key]).replace(/\$(\w+)/g, function(m_all, m_g1) {
232
+ return (m_g1 in child_opts.env) ? child_opts.env[m_g1] : '';
233
+ });
234
+ }
235
+ }
236
+
223
237
  // windows additions
224
238
  if (this.platform.windows) {
225
239
  child_opts.windowsHide = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixlcore/xyrun",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Remote job runner script for xyOps.",
5
5
  "author": "Joseph Huckaby <jhuckaby@pixlcore.com>",
6
6
  "homepage": "https://github.com/pixlcore/xyrun",