詹金斯工作流隐藏扁平文件夹



是否可以像处理jenkins归档一样,将一组隐藏的工件解压缩为扁平目录?

我希望它能隐藏3个文件夹,只有一个未隐藏,包含3个文件夹的所有内容,但我目前无法做到。

这是我的尝试:

echo("Workflow Starting...");
node {
  def imageNames = ["connector","registryloader","salepersistence","settlement","standalone","trackingloader"]  
  stage 'Building   
      checkout([$class: 'SubversionSCM', additionalCredentials: [], excludedCommitMessages: '', excludedRegions: '', excludedRevprop: '', excludedUsers: '', filterChangelog: false, ignoreDirPropChanges: false, includedRegions: '', locations: [[credentialsId: '36c9ca9f-de25-4022-b9eb-70ada8e793b8', depthOption: 'infinity', ignoreExternalsOption: true, local: '.', remote: 'http://10.64.111.28/svn/SampleProject/skl-br']], workspaceUpdater: [$class: 'UpdateUpdater']])
      withEnv(["PATH+MAVEN=${tool 'M3'}/bin"]) {
        bat "mvn clean install assembly:assembly versions:resolve-ranges -Dmaven.test.skip=false -DskipTests"
      }
      echo("Archiving")
      archive '**/target/*.tar.gz, conf/desenv/**/*'
      for(int i = 0; i < imageNames.size(); i++){
        String imageName = imageNames[i]
        echo("Stashing ${imageName}")
        stash excludes: '', includes: '**/sklbr-1.0.0-standalone.tar.gz, **/'+imageName+'/*, **/commonConfigs/*, **/scripts/*', name: ''+imageName+''
      }
  stage 'Creating Container'
      docker.withServer('tcp://localhost:2375')
      {
        for(int i = 0; i < imageNames.size(); i++){
          String imageName = imageNames[i]
          ws('sub-workspace ' + imageName) {
            echo("Creating ${imageName} container")
            //unarchive mapping: ['**/sklbr-1.0.0-standalone.tar.gz' : '.', '**/${imageName}/*' : '.', '**/commonConfigs/*' : '.', '**/scripts/*' : '.']
            unstash imageName
            echo("Unstashing ${imageName}")
            def newApp = docker.build "devops-docker-registry:5000/"+imageName+":${env.BUILD_NUMBER}-${env.SVN_REVISION}"
            echo("Building container with ${imageName}")
            newApp.push()
            echo("Pushing ${imageName} container")
          }
        }
      }
} 

我已经找到了一种使用shell脚本的方法,但这不是我想要的。。。

在这里,以防你需要

*Nix
sh 'find /${pwd()} -iname "*" -print0 | xargs -0 echo mv -t a'
Windows
bat 'for /r %f in (*) do @move "%f" .'

JENKINS-29780可能会有所帮助,但请记住,您可以将stash和/或unstash封装在dir中。

最新更新