Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tyuki39/846018 to your computer and use it in GitHub Desktop.
Save tyuki39/846018 to your computer and use it in GitHub Desktop.
Jenkinsでプロジェクト固有の環境変数を取得する方法
// プラクティスとして良いかどうかは別として、他のプロジェクト固有の環境変数を得る方法
// 以下は groovy plugin の Execute system Groovy script の中で使用して
// TEST プロジェクトの WORKSPACE 環境変数の情報を得る例
def jobname = "TEST"
def envname = "WORKSPACE"
def job = hudson.model.Hudson.instance.getItem(jobname)
def envVars= job.lastBuild.properties.get("envVars")
println envVars[envname]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment