stage('Publish') {
steps {
bat 'dotnet publish -c Release'
}
post {
always {
archiveArtifacts artifacts: """/bin/publish/**""", excludes: """/bin/publish/Tests/**""", """/bin/publish/coverage/**""", fingerprint: true
}
}
}
For this I am getting error as:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 57: Arguments to "archiveArtifacts" must be explicitly named. @ line 57, column 21.
archiveArtifacts artifacts: """/bin/publish/**""", excludes: """/bin/publish/Tests/**""", """/bin/publish/coverage/**""", fingerprint: true
^
1 error
at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1085)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:133)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:127)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:557)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:518)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:290)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Finished: FAILURE
You can skip stages in declarative pipelines using when , so the following should work. stages { stage('Deploy') { when { equals expected: true, actual: Deploy } steps { // ... } } } If it should be totally invisible in the review pipeline, then use scripted pipelines and wrap the stage with an if statement.
By default, Jenkins archives artifacts generated by the build. These artifacts are stored in the JENKINS_HOME directory with all other elements such as job configuration files.
If you know the name of the 2nd job and make sure that both runs of same node, then you can give path to 2nd job to archive the artifacts like */. jar (From same job) /home/jenkins/workspace/<JOB_NAME>/**/*. jar (For different build job). just use comma , as stated in answer to seperate different file sets.
archiveArtifacts : Archive the artifacts. Archives the build artifacts (for example, distribution zip files or jar files) so that they can be downloaded later. Archived files will be accessible from the Jenkins webpage.
The third argument to archiveArtifacts
isn't named. I.e. in your call:
archiveArtifacts artifacts: """/bin/publish/**""", excludes: """/bin/publish/Tests/**""", """/bin/publish/coverage/**""", fingerprint: true
You have the part , """/bin/publish/coverage/**""",
which isn't named. I'm guessing that you want this to be part of the exclude argument, in that case you should comma separate the two exclude patterns within the first exclude pattern string, like this:
archiveArtifacts artifacts: """/bin/publish/**""", excludes: """/bin/publish/Tests/**, /bin/publish/coverage/**""", fingerprint: true
Also as @Fidel pointed out, you don't need to use triple quoted strings, so you could do:
archiveArtifacts artifacts: "/bin/publish/**", excludes: "/bin/publish/Tests/**, /bin/publish/coverage/**", fingerprint: true
or using single quotes:
archiveArtifacts artifacts: '/bin/publish/**', excludes: '/bin/publish/Tests/**, /bin/publish/coverage/**', fingerprint: true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With