Search code examples
jenkinsarchiveartifacts

Archiving only aspx pages in Jenkins Artifacts


I have a Jenkins installation, wherein post successful build i archive the artifacts, so that in the Post build action, i can deploy the artifacts to my production website. However i do not find any option to only archive the aspx pages, like mostly we get when we publish the website.

However i see a File Pattern field in the Archive Artifacts plugin, however i am not sure, what pattern i can use so that Jenkins would provide me a published copy of the build (artifacts).

Could anyone please provide me file patterns i can use to get the Published copy, or is there any other way i can get the published copy to release on production in Jenkins


Solution

  • In a pipeline job you can use this:

    stage('archive') {
        logFiles = findFiles(glob: '**/*.aspx')
        if (logFiles.length > 0){
            archiveArtifacts artifacts: '**/*.aspx', fingerprint: true
        } else {
            print ('no artifacts to archive')
        }
    }
    

    If you are not using a pipeline job, you probably can use the Ant pattern **/*.aspx on the job configuration