在Jenkins声明式管道中执行AWS s3 cp时,命令以退出代码1终止

时间:2019-04-30 02:07:37

标签: amazon-web-services jenkins amazon-s3 kubernetes kubectl

我正尝试通过Jenkins从我的Kubernetes Pod将文件上传到AWS S3 Bucket,并获得public Path writeToFile() { final Path tempFilePath; try { tempFilePath = Files.createTempFile(Paths.get(""), "sorting_test_", ".txt"); } catch (IOException e ) { throw new MyRuntimeException( "Cannot create sorting_test temp file", e ); } try (final FileWriter fw = new FileWriter(tempFilePath.toFile())) { try(final BufferedWriter bw = new BufferedWriter(fw)) { for (List<Integer> arr : arrays) { // Convert array ints to strings, join it to single string and write bw.write(arr.stream() .map(String::valueOf) .collect(Collectors.joining(" "))); bw.newLine(); } } return tempFilePath; } catch (IOException e) { throw new MyRuntimeException( "Cannot write to " + tempFilePath, e ); } } 。成功的命令将终止。

我尝试在Pod上手动运行命令,它的工作原理非常好。

这是我在jenkins声明式管道上的代码:

command terminated with exit code 1

这是日志:

sh (script: "kubectl exec -i ${MONGODB_POD_NAME} -n ${ENVIRONMENT} -- bash -c 'aws s3 sync /dump/${AUTOMATION_DUMP_DIRECTORY} s3://${S3_BUCKET}/${ENVIRONMENT}/${AUTOMATION_DUMP_DIRECTORY} --debug'")

0 个答案:

没有答案