2020年2月10日 星期一

[ 常見問題 ] How do I get the name of the pipeline from inside the jenkinsfile

Source From Here
Question
env.JOB_NAME Is the pipeline name suffixed with the branch name. (Check Using Environment Variables)

So env.JOB_NAME will be _

How can I just get the pipeline name and store it in a var in the environment{} block at the top of my jenkinsfile to use through the file?

I don't want to resort to scripted pipeline just the declarative.

How-To
According to Global Variable Reference, we have:
JOB_BASE_NAME
Short Name of the project of this build stripping off folder paths, such as "foo" for "bar/foo".

which can give you the name of pipeline.

沒有留言:

張貼留言

[Git 常見問題] error: The following untracked working tree files would be overwritten by merge

  Source From  Here 方案1: // x -----删除忽略文件已经对 git 来说不识别的文件 // d -----删除未被添加到 git 的路径中的文件 // f -----强制运行 #   git clean -d -fx 方案2: 今天在服务器上  gi...