Sto cercando di ottenere l'attuale area di lavoro del mio Jenkins Build utilizzando uno script di pipeline Groovy.Come recuperare lo spazio di lavoro corrente usando lo script Jenkins Pipeline Groovy?
node('master') {
// PULL IN ENVIRONMENT VARIABLES
// Jenkins makes these variables available for each job it runs
def buildNumber = env.BUILD_NUMBER
def workspace = env.WORKSPACE
def buildUrl = env.BUILD_URL
// PRINT ENVIRONMENT TO JOB
echo "workspace directory is ${workspace}"
echo "build URL is ${env.BUILD_URL}"
}
Esso restituisce
[Pipeline] Allocate node : Start
Running on master in /Users/Shared/Jenkins/Home/jobs/test/workspace
[Pipeline] node {
[Pipeline] echo
workspace directory is null
[Pipeline] echo
build URL is http://localhost:8080/job/test/5/
[Pipeline] } //node
[Pipeline] Allocate node : End
[Pipeline] End of Pipeline
Finished: SUCCESS
https://issues.jenkins-ci.org/plugins/servlet/mobile#issue/JENKINS-33511 –
Possibile duplicato di [Ottieni percorso assoluto per la directory dell'area di lavoro nel plug-in Jenkins Pipeline] (http://stackoverflow.com)/questions/36934028/get-absolute-path-to-workspace-directory-in-jenkins-pipeline-plugin) –