{"id":24956195,"url":"https://github.com/jenkinsci/envinject-plugin","last_synced_at":"2026-04-26T10:02:11.263Z","repository":{"id":546866,"uuid":"2059304","full_name":"jenkinsci/envinject-plugin","owner":"jenkinsci","description":"This plugin makes it possible to setup a custom environment for your jobs","archived":false,"fork":false,"pushed_at":"2026-01-01T09:01:03.000Z","size":1429,"stargazers_count":90,"open_issues_count":127,"forks_count":111,"subscribers_count":99,"default_branch":"master","last_synced_at":"2026-01-23T09:05:14.514Z","etag":null,"topics":["adopt-this-plugin","environment","environment-variables","jenkins","jenkins-plugin"],"latest_commit_sha":null,"homepage":"https://plugins.jenkins.io/envinject","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jenkinsci.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"community_bridge":"jenkins","custom":["https://www.jenkins.io/donate/#why-donate"]}},"created_at":"2011-07-16T20:09:41.000Z","updated_at":"2025-12-31T19:25:32.000Z","dependencies_parsed_at":"2025-01-22T19:32:34.424Z","dependency_job_id":"5e884796-5f42-4e91-99ad-c87f71e622e4","html_url":"https://github.com/jenkinsci/envinject-plugin","commit_stats":null,"previous_names":[],"tags_count":155,"template":false,"template_full_name":null,"purl":"pkg:github/jenkinsci/envinject-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fenvinject-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fenvinject-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fenvinject-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fenvinject-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jenkinsci","download_url":"https://codeload.github.com/jenkinsci/envinject-plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fenvinject-plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32292958,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T09:34:17.070Z","status":"ssl_error","status_checked_at":"2026-04-26T09:34:00.993Z","response_time":129,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adopt-this-plugin","environment","environment-variables","jenkins","jenkins-plugin"],"created_at":"2025-02-03T06:27:57.521Z","updated_at":"2026-04-26T10:02:11.242Z","avatar_url":"https://github.com/jenkinsci.png","language":"Java","funding_links":["https://funding.communitybridge.org/projects/jenkins","https://www.jenkins.io/donate/#why-donate"],"categories":[],"sub_categories":[],"readme":"# EnvInject Plugin for Jenkins\n\n[![Jenkins Plugin](https://img.shields.io/jenkins/plugin/v/envinject.svg)](https://plugins.jenkins.io/envinject)\n[![GitHub release](https://img.shields.io/github/release/jenkinsci/envinject-plugin.svg?label=changelog)](https://github.com/jenkinsci/envinject-plugin/releases/latest)\n[![Jenkins Plugin Installs](https://img.shields.io/jenkins/plugin/i/envinject.svg?color=blue)](https://plugins.jenkins.io/envinject)\n[![Crowdin](https://badges.crowdin.net/e/1e527e5f51ea7c0403a0f74a5d7f09e5/localized.svg)](https://jenkins.crowdin.com/envinject-plugin)\n\nThis plugin makes it possible to setup a custom environment for your jobs.\n\nFeatures:\n* Removes inherited environment variables by the Jenkins Java process\n* Injects environment variables at node (controller/agent) startup\n* Executes a setup script before or/and after a SCM checkout for a run\n* Injects environment variables before or/and after a SCM checkout for a run\n* Injects environment variables as a build step for a run\n* Securely injects password values for a run\n* Exports environment variables at the end of the build in order to display the set of environment variables used for each build\n\n## Use cases\n\n-   To remove inherited environment variables (`PATH`, `ANT_HOME`, ...) at\n    node level (controller/agent), available by default for a job run.\n-   To inject variables in the first step of the job (before the SCM checkout)\n-   To inject variables based on user parameter values\n-   To execute an initialization script before a SCM checkout.\n-   To execute an initialization script after a SCM checkout\n-   To inject variables as a build step obtained from a file filled in\n    by a previous build step\n-   To know environment variables used for a build\n-   To inject build cause as environment variable for a build\n-   To inject environment variables from the evaluation of a Groovy\n    script (powered by [Script Security Plugin](https://wiki.jenkins.io/display/JENKINS/Script+Security+Plugin))\n-   To export environment variables as a metadata in your binary\n    repository\n\n## Configuration\n\n### At node (controller and agent) level\n\n![](docs/images/a0fe189750e157d60b0a0f6ef844ca9221a1269d.png \"Jenkins \u003e EnvInject Plugin \u003e EnvInject_node.png\")\n\n### At job level\n\n#### Set up a clean environment\n\n![](docs/images/561833e712b15bbcf3008bf7a34b468608f6c35b.png \"Jenkins \u003e EnvInject Plugin \u003e EnvInject_Prepare.png\")\n\n#### Inject variables after a SCM checkout\n\n![](docs/images/f6ac7022302083d1e8359babf478bacc1c70f926.png \"Jenkins \u003e EnvInject Plugin \u003e EnvInject_BuildWrapper.png\")\n\n#### Inject variables as a build step\n\n![](docs/images/0e0feead5d341176a406f68395e6f9df8b09a390.png \"Jenkins \u003e EnvInject Plugin \u003e EnvInject_buildStep.png\")\n\n## Advanced use-cases\n\n### Variables Traceability\n\nEach build captures environment variables and stores them in an environment file called 'injectedEnvVars.txt' located in\n`$JENKINS\\_HOME/jobs/\\\u003cyour\\_job\\\u003e/builds/\\\u003cyour\\_build\\\u003e`.\nFor an old build, you can display injected environment variables through the right UI menu on the build page.\n\nYou can also get build environment variables by the following HTTP GET URL:\n`\\\u003cjenkins\\_url\\\u003e/job/\\\u003cjob\\_name\\\u003e/\\\u003cbuild\\_number\\\u003e/injectedEnvVars/export`.\nXML, JSON and TXT format are supported.\n\nFor example:\n\n-   `curl -X GET -H\"Accept:text/plain\" \u003cjenkins_url\u003e/job/\u003cjob_name\u003e/lastBuild/injectedEnvVars/export`\n-   `curl -X GET -H\"Accept:application/xml\" \u003cjenkins_url\u003e/job/\u003cjob_name\u003e/18/injectedEnvVars/export`\n-   `curl -X GET -H\"Accept:application/json\" \u003cjenkins_url\u003e/job/\u003cjob_name\u003e/18/injectedEnvVars/export`\n\n### Build Causes\n\nThis plugin also exposes the cause of the current build as an environment variable.\nA build can be triggered by multiple causes at the same time e.g. an SCM Change could have occurred at the same time as a user triggers the build manually.\n\nThe build cause is exposed as a comma separated list:\n\n```\nBUILD_CAUSE=USERIDCAUSE, SCMTRIGGER, UPSTREAMTRIGGER, MANUALTRIGGER\n```\n\nIn addition, each cause is exposed as a single environment variable too:\n\n```\nBUILD_CAUSE_USERIDCAUSE=true\nBUILD_CAUSE_SCMTRIGGER=true\nBUILD_CAUSE_UPSTREAMTRIGGER=true\nBUILD_CAUSE_MANUALTRIGGER=true\n```\n\n## Examples\n\n### Append to PATH on Windows\n\n![](docs/images/ca90953a80d9748b1f558ddcb4e7fb27354dd1b2.png \"Jenkins \u003e EnvInject Plugin \u003e EnvInject_Path.png\")\n\nThis screenshot is from an older version of EnvInject. Starting with EnvInject 1.93, any backslashes (such as Windows directory separators) in environment variables should be escaped (doubled).\nSee [JENKINS-31573](https://issues.jenkins-ci.org/browse/JENKINS-31573)\n\n### Gerrit Trigger plugin with parameterized Build branch name\n\n-   Check \"**This build is parameterized**\"\n    -   Name: `GERRIT_BRANCH`\n    -   Default Value: `master`\n-   Check \"**Prepare an environment for the run**\"\n    -   **Evaluated Groovy script**:\n\n```groovy\nif (!binding.variables.containsKey('GERRIT_REFSPEC')) {\n    return [GERRIT_REFSPEC: \"refs/heads/$GERRIT_BRANCH\"]\n}\n```\n\n## Additional features provided by other plugins\n\n[Shared Objects Plugin](https://plugins.jenkins.io/shared-objects) contributes to EnvInject plugin that enables you to populate shared objects as environment variables.\n\n## Extensibility with other plugins\n\nEnvInject captures build environment variables populated by plugins providing environment variables through Jenkins extension points\n(such as BuildWrappers, EnvironmentContributions and so on).\nEnvironment variables injected by the EnvInject plugin are available in Jenkins triggers\n(for example in all [XTrigger plugin](https://plugins.jenkins.io/xtrigger) typologies, injected environment variable can be used).\nInjected environment variables with the EnvInject plugin are captured by the [BuildContext capture plugin](https://plugins.jenkins.io/buildcontext-capture).\n\n## Comparison with other plugins\n\nThis plugin is an alternative to [Setenv\nPlugin](https://wiki.jenkins.io/display/JENKINS/Setenv+Plugin) and\n[Envfile Plugin](https://plugins.jenkins.io/envfile) plugins which are currently deprecated.\n\n* Note 1: The EnvInject plugin automatically migrates the Jobs configuration from these plugins.\nThe setenv and/or the envfile plugins can be deleted from your plugin list.\n* Note 2: Controller and agents are managed.\n\n## Known limitations\n\n## Jenkins Pipeline compatibility\n\nEven though it is possible to set up the EnvInject Job Property and\nbuild step in Pipeline, the plugin does not provide full compatibility\nwith [Jenkins Pipeline](https://jenkins.io/doc/book/pipeline/).\n\nSupported use-cases:\n\n-   Injection of EnvVars defined in the \"Properties Content\" field of\n    the Job Property\n    -   These EnvVars are being injected to the script environment and will be inaccessible via the \"env\" Pipeline global variable\n    -   Please note there is also a known compatibility issue with [Durable Task Plugin](https://plugins.jenkins.io/durable-task) 1.13\n\nAll other use-cases of the plugin may work incorrectly in Jenkins Pipeline.\nPlease\nsee [JENKINS-42614](https://issues.jenkins-ci.org/browse/JENKINS-42614) for more information about unsupported use-cases.\nThere is no short-term plan to fix the compatibility issues though any pull requests to the plugin will be appreciated.\n\n### Mask Passwords Plugin compatibility\n\nMask Passwords plugin is able to mask password elements.\nHowever, technically, this plugin provides its own class.\nAnd we don't want to have a hard dependency from the EnvInject plugin to any other plugin.\n\nTherefore, EnvInject can't retrieve information from the MaskPassword plugin.\nHowever, EnvInject provides all MaskPassword's features.\n\n### Tool Environment Plugin compatibility\n\nEnvInject can't use exported environment variables provided by the [Tool Environment](https://plugins.jenkins.io/toolenv) plugin.\nInstead, we suggest to use the [SharedObjects Plugin](https://plugins.jenkins.io/shared-objects).\nIt covers Tool Env plugin features and provides a good integration with EnvInject.\n\n### Other limitations\n\n-   As into regular shell scripts, you are not able to use the \".\" character for environment variable names\n-   Only previous environment variables are available for polling.\n\nSome plugins provide polling mechanisms (such as SCM plugins, XTrigger plugins, ...) and you want to use injected environment variables in form fields of these plugins.\nUnfortunately, injected environment variables are processed only at build time therefore after the build is scheduled.\nTherefore, we can't access environment variables configured within the job.\nHowever, previous injected environment variables (from the previous build) are retrievable\n(implemented for example in the XTtrigger plugins).\nFor the other plugins, authors are free to add the [EnvInject API](https://plugins.jenkins.io/envinject-api) dependency in their plugins in order to provide the ability to use environment variables given the EnvInject plugin.\n\n## Changelog\n\nSee [GitHub Releases](https://github.com/jenkinsci/envinject-plugin/releases) for recent releases.\nChangelogs for EnvInject 2.1.6 and older releases are available on the [Old Changelog](./docs/CHANGELOG_OLD.md) page.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenkinsci%2Fenvinject-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjenkinsci%2Fenvinject-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenkinsci%2Fenvinject-plugin/lists"}