我正在尝试为gitlab ci/cd制作一个yml文件,因为maven的模板不起作用,所以我尝试了在线教程(https://www.youtube.com/watch?v=Jav4vbUrqII)。yml的构建部分可以工作,但测试部分不能工作,因为它没有被识别为命令。我认为管道正在使用powershell(我在windows上(。
额外上下文:我第一次遵循教程时,在这之前我遇到了另外两个问题。第一个是stages config should be a string of arrays
,所以我把它改成了字符串数组。
第二个是'touch' is not recognized as a name of a cmdlet, function, script file, or operable program
,所以我把touch
改成了new-item
,因为这是我在网上找到的替代品。
但现在我似乎找不到test
的替代品。
yml文件:
stages: ["build", "test"]
build:
stage: build
script:
- echo "Building..."
- mkdir build
- new-item build/info.txt
artifacts:
paths:
- build/
test:
stage: test
script:
- echo "Testing..."
- test -f "build/info.txt"
Powershell中的Windows等价物是
Test-Path "build/info.txt" -PathType leaf