How to use the Shared Workspace plugin in a Jenkins pipeline?



  • I want to use the https://plugins.jenkins.io/shared-workspace/ plugin, so I set up the following key/value pair in my Manage Jenkins -> Configure System -> Workspace Sharing

    Name: sandbox-workspace
    Repository URL: git@bitbucket.org:mycompany/myrepo.git
    

    Now I want to share the above workspace between two separate pipeline jobs Job1 and Job2, where Job1 triggers Job2 so they're guaranteed to never run concurrently. Each job may/can run on different nodes. What is the pipeline syntax for using the above shared workspace?



  • Considering that plugin hasn't been updated in 7 years, it almost certainly doesn't have Pipeline support - Pipelines were likely either nonexistent or not widely used last time that plugin received an update.

    You can still try to use it in a Pipeline job. Jenkins has a https://www.jenkins.io/doc/book/pipeline/getting-started/#snippet-generator to automatically generate Pipeline code using Freestyle job steps in the web UI. However there is no guarantee that the Pipeline code output by this tool will work identically to the equivalent Freestyle configuration.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2