Groovy,Closures&詹金斯。
我创建了种子作业:
def Job1 = 'FromTemplate-testJob'
job {
name Job1
steps {
shell( "echo Hello > out5.txt" )
shell( "/c echo custard > op4.txt")
}
}
按预期成功创建包含2个shell命令的子作业:
echo Hello > out5.txt
/c echo custard > op4.txt
但是,运行时,此创建的作业显然可以使用以下输出成功运行:
Started by user anonymous
Building in workspace C:\Program Files (x86)\Jenkins\jobs\FromTemplate-testJob\workspace
[workspace] $ C:\Windows\system32\cmd.exe -xe C:\Windows\TEMP\hudson3852539874278383422.sh
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Program Files (x86)\Jenkins\jobs\FromTemplate-testJob\workspace>[workspace] $ C:\Windows\system32\cmd.exe -xe C:\Windows\TEMP\hudson1697067517687695305.sh
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Program Files (x86)\Jenkins\jobs\FromTemplate-testJob\workspace>Finished: SUCCESS
但是,任何输出文件都不会在任何地方创建。 shell可执行文件定义为:
C:\Windows\system32\cmd.exe
我不明白什么?