引用的Concourse CI Shell命令

时间:2018-11-20 20:03:53

标签: concourse

作为package.yml步骤的一部分,我们试图在Concourse CI run文件中复制多个jar文件:

run:
  path:
    args:
      - -exc
      - |
        ...
        cp project/target/*.jar build-output/.

但是Concourse在源文件中添加了单引号,因此它正在查找名为'project/target/*.jar'的文件,当然找不到它。

+ cp 'project/target/*.jar' build-output/.  
cp: can't stat 'project/target/*.jar'; no such file or directory  

我什至尝试在jar文件名周围用双引号引起来,希望它可以阻止Concourse更改它,但没什么区别。

我们想使用文件遍历,以便我们可以通用地使用它,这样我们就不必提前知道文件名。有什么办法可以使它起作用?

2 个答案:

答案 0 :(得分:0)

Bizarre。尝试指定外壳:

run:
  path: sh                <== missing `sh` or the shell you have available in the image
    args:
      - -exc
      - |
        ...
        cp project/target/*.jar build-output/    <== no `.`

嗯,实际上引号可能是误导性的,project/target下方没有任何内容:-)尝试

run:
  path: sh                <== missing `sh` or the shell you have available in the image
    args:
      - -exc
      - |
        ...
        # is anything here ?
        ls -1 project/target
        cp project/target/*.jar build-output/    <== no `.`

答案 1 :(得分:0)

set -x模式引用所有参数;这并不意味着它实际上引用了该参数。我认为您有一个红色的鲱鱼,但很高兴您能正常工作。