RogerG

Members
  • Content count

    2
  • Joined

  • Last visited

Community Reputation

0 Neutral

About RogerG

  • Rank
    Newbie
  1. I have figured out that actually, I was not using that properly in the Pipeline. I am stuck with another problem, copying files from Workspace on Windows def deployartifact() { echo "Deploy artifacts ..." stage('Deploy') { node { def sourceFilePath = 'outputs\\release\\file.tar' def destinationFilePath = '\\\\server.net\\d\$\\Share' echo "Sourcefilepath is ${sourceFilePath} and Destinationpath is ${destinationFilePath}" bat 'copy %WORKSPACE%\\${sourceFilePath} ${destinationFilePath}' } } } File is not getting copied because of the WORKSPACE, I tried env.WORKSPACE also. Thanks in advance
  2. Hi list, I am trying to use this script to copy a file from one directory to another def publish() { echo "Publish artifacts ..." String sourceFilePath = "%WORKSPACE%\\app\\build\\outputs\\newrelease.tar" String destinationFilePath = "\\app.xxx.net\\d\$\\Share" // bat 'copy ${sourceFilePath} ${destinationFilePath}' (new AntBuilder()).copy(file: sourceFilePath, tofile: destinationFilePath) } I am getting the following error even after approving from "in process script approvals" : org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use new groovy.util.AntBuilder at org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.StaticWhitelist.rejectNew(StaticWhitelist.java:184) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onNewInstance(SandboxInterceptor.java:148) def pipeline () { buildStage() pubish() } If I use bat 'copy ${sourceFilePath} ${destinationFilePath}' I am getting following error: org.jenkinsci.plugins.workflow.steps.MissingContextVariableException: Required context class hudson.FilePath is missing Thanks in advance