我想引用/指定(语法)分支,该分支设置为 Jenkins 共享库的环境变量,它将在 docker 容器期间提供。例如:
@Library(['my-shared-library', BRANCH_NAME])
尝试使用 ${BRANCH_NAME} ${env.BRANCH_NAME}
我将在 docker-compose.yml 中提供 BRANCH_NAME 作为环境变量
我也想在 org.jenkinsci.plugins.workflow.libs.GlobalLibraries.xml 中获得 env 变量
就像我将 PIPELINE_VERSION 设置为 env 变量
<?xml version='1.1' encoding='UTF-8'?>
<org.jenkinsci.plugins.workflow.libs.GlobalLibraries plugin="workflow-cps-global-lib@2.15">
<libraries>
<org.jenkinsci.plugins.workflow.libs.LibraryConfiguration>
<name>XXXXXXXXXXXX</name>
<retriever class="org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever">
<scm class="jenkins.plugins.git.GitSCMSource" plugin="git@3.12.0">
<id>XXXXXXXXXXXXXXXXXXXXXXXX</id>
<remote>XXXXXXXXXXXXXXXXXXX</remote>
<credentialsId>jXXXXXXXXXXXXXXXXXXXX</credentialsId>
<traits>
<jenkins.plugins.git.traits.BranchDiscoveryTrait/>
</traits>
</scm>
</retriever>
<defaultVersion>${PIPELINE_RELEASE_VERSION}</defaultVersion>
<implicit>true</implicit>
<allowVersionOverride>true</allowVersionOverride>
<includeInChangesets>false</includeInChangesets>
</org.jenkinsci.plugins.workflow.libs.LibraryConfiguration>
</libraries>
</org.jenkinsci.plugins.workflow.libs.GlobalLibraries>
谢谢, Kusuma