Использование потоков для ускорения развертывания - PullRequest
0 голосов
/ 21 апреля 2020

Я пытаюсь использовать темы внутри своего плагина. Мне нужно развернуть 5 файлов в Artifactory одновременно, чтобы сэкономить время.

    baseDir.eachFile {
      def Thread thread = new Thread(){
        public void run(){
          def InputStream fileAsInputStream = new File (it.getAbsolutePath()).newInputStream()
          def File fileRepoPath = new File (baseDirInRepo, it.getName())

          if(!deployRepoMetadata(item.repoPath.repoKey, fileRepoPath, fileAsInputStream)) {
            throw new Exception ("Can't deploy " + fileRepoPath + " for package " + item.name)
          }
        }
      }
      thread.start()
    }
def boolean deployRepoMetadata(String repoKey, File deployPath, InputStream binary) {

    def String targetRepoKey = repoKey
    def String targetPath = deployPath

    def RepoPath deployRepoPath = RepoPathFactory.create(targetRepoKey, targetPath)
    repositories.deploy(deployRepoPath, binary)
}

Но у меня есть следующая ошибка:

User _system_ is not permitted to deploy 

Как мне справиться с этой ошибкой?

...