Skip to content

Instantly share code, notes, and snippets.

@andgineer
Last active July 18, 2021 04:43
Show Gist options
  • Save andgineer/aee9022fad89cb8b87e931c8b7de7321 to your computer and use it in GitHub Desktop.
Save andgineer/aee9022fad89cb8b87e931c8b7de7321 to your computer and use it in GitHub Desktop.
Jenkins groovy function. Loads into Jenkins env from lines "key=value" in `text` https://sorokin.engineer/posts/en/jenkins_load_env_vars_with_expanding.html
private void loadVarsFromText(String text) {
text.split('\n').each { envLine ->
def (key, value) = envLine.tokenize('=')
env."${key}" = "${value}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment