From 1387673274ecbefa6b0c10c9510f9c2ac1ffebee Mon Sep 17 00:00:00 2001 From: Ilya Radchenko Date: Thu, 21 Jul 2016 16:44:46 -0400 Subject: [PATCH] Add default ENVs that persist to plugin context See https://github.com/Strider-CD/strider/issues/892 Commit and PR still need to be implemented. --- lib/job.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/job.js b/lib/job.js index 3cb20d5..1364a46 100644 --- a/lib/job.js +++ b/lib/job.js @@ -43,6 +43,18 @@ function Job(job, provider, plugins, config) { pty: false, env: {} }, config); + + // Setup default ENVs to be used in plugin contexts + this.config.env = _.extend(this.config.env, { + STRIDER: true, + STRIDER_TRIGGER: job.trigger.type || 'manual', + STRIDER_COMMIT: '', + STRIDER_PR: '', + STRIDER_BRANCH: job.ref.branch, + STRIDER_SLUG: job.project.name, + STRIDER_BUILD: jobId, + STRIDER_BUILD_URL: job.project.display_url + '/job/' + jobId + }); if (this.config.pty) { debug('PTY has been disabled due to a bug in node core');