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

相关内容