Helix Swarm - “swarm.job”中的語法錯誤

Helix Swarm - “swarm.job”中的語法錯誤

我正在嘗試在 Helix Core 2017.1 伺服器上為 Helix Swarm 2018.2 伺服器設定 swarm-triggers(兩者都在使用 docker-compose 編排的單獨 docker 容器中),但當我嘗試將結果透過管道傳輸到時,出現上述swarm-trigger.pl -o錯誤p4 triggers -i

# both with and without config file -c fails
/root/swarm-trigger.pl -c /root/swarm-trigger.conf -o > /root/generated_triggers.txt
# Tried both with and without the %quote% parts, stripped out using sed.
#sed -i -e 's/%quote//g' -e 's/%%/%/g' /root/generated_triggers.txt         
sed '/^\s*#/d' -i /root/generated_triggers.txt                                                                   
cat /root/generated_triggers.txt | p4 triggers -i 

我原來的管道命令也失敗並出現相同的錯誤:

/root/swarm-trigger.pl -c /root/swarm-trigger.conf -o | sed -e 's/%quote//g' -e 's/%%/%/g' | sed '/^\s*#/d' | p4 triggers -i
/root/swarm-trigger.pl -c /root/swarm-trigger.conf -o | sed '/^\s*#/d' | p4 triggers -i

所以docker-compose錯誤日誌:

perforce    | + sed '/^\s*#/d'
perforce    | + /root/swarm-trigger.pl -c /root/swarm-trigger.conf -o
perforce    | + p4 triggers -i
perforce    | Error in triggers specification.
perforce    | Error detected at line 1.
perforce    | Syntax error in 'swarm.job'.
perforce    | /run.sh exited 1

這是一個失敗的文件p4 triggers -i

[root@9877302137d8 /]# cat /root/generated_triggers.txt 
swarm.job        form-commit    job    "%quote%/root/swarm-trigger.pl%quote% -c %quote%/root/swarm-trigger.conf%quote% -t job           -v %formname%"
swarm.user       form-commit    user   "%quote%/root/swarm-trigger.pl%quote% -c %quote%/root/swarm-trigger.conf%quote% -t user          -v %formname%"
swarm.userdel    form-delete    user   "%quote%/root/swarm-trigger.pl%quote% -c %quote%/root/swarm-trigger.conf%quote% -t userdel       -v %formname%"
swarm.group      form-commit    group  "%quote%/root/swarm-trigger.pl%quote% -c %quote%/root/swarm-trigger.conf%quote% -t group         -v %formname%"
swarm.groupdel   form-delete    group  "%quote%/root/swarm-trigger.pl%quote% -c %quote%/root/swarm-trigger.conf%quote% -t groupdel      -v %formname%"
swarm.changesave form-save      change "%quote%/root/swarm-trigger.pl%quote% -c %quote%/root/swarm-trigger.conf%quote% -t changesave    -v %formname%"
swarm.shelve     shelve-commit  //...  "%quote%/root/swarm-trigger.pl%quote% -c %quote%/root/swarm-trigger.conf%quote% -t shelve        -v %change%"
swarm.commit     change-commit  //...  "%quote%/root/swarm-trigger.pl%quote% -c %quote%/root/swarm-trigger.conf%quote% -t commit        -v %change%"
swarm.shelvedel  shelve-delete  //...  "%quote%/root/swarm-trigger.pl%quote% -c %quote%/root/swarm-trigger.conf%quote% -t shelvedel     -v %change% -w %client% -u %user% -d %quote%%clientcwd%%quote% -a %quote%%argsQuoted%%quote% -s %quote%%serverVersion%%quote%"

我將其與生產 Helix Core 伺服器的結果進行了比較,我看到的唯一區別是我沒有將 swarm-trigger.pl 放入倉庫。但是,根據您的說明,這沒有問題(請參閱步驟6b

答案1

問題是我沒有在串流的內容前面添加p4 triggers -i僅包含 的行Triggers:,如下所示:

/root/swarm-trigger.pl -c /root/swarm-trigger.conf -o | sed '/^\s*#/d' | awk '{print "Triggers:" $0;}' | p4 triggers -i

不可能簡單地附加到 Perforce 觸發器,因此必須執行以下操作:

p4 triggers -o > tmp
/root/swarm-trigger.pl -c /root/swarm-trigger.conf -o | sed '/^\s*#/d' >> tmp
p4 triggers -i < tmp

相關內容