createHudsonJobForBug.sh now uses the new CopyTemplate for Github Actions integration

This commit is contained in:
Axel Uhl committed 2024-05-23 00:51:19 +02:00
1 parent 7003d4bd91
commit caa277c3e4
1 file changed
+41 -34
+41 -34
View File
@@ -1,30 +1,15 @@
#!/bin/bash #!/bin/bash
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
echo "$0 [-t -r ] <bugid>" echo "$0 <bugid>"
echo "" echo ""
echo "-t Disable tests"
echo "-r Build release"
echo echo
echo "Constructs a Hudson job for the given bugid" echo "Constructs a Hudson job for the given bugid"
echo "Example: $0 -r 4221" echo "Example: $0 4221"
echo "Builds a Hudson job for bug branch bug4221, linking to the Bugzilla bug and building a release" echo "Builds a Hudson job for bug branch bug4221, linking to the Bugzilla bug and copying a release"
echo "from Github to https://releases.sapsailing.com if the Github Actions Workflow built one"
exit 2 exit 2
fi fi
options='tr'
while getopts $options option
do
case $option in
t) SKIP_TESTS=1;;
r) BUILD_RELEASE=1;;
\?) echo "Invalid option"
exit 4;;
esac
done
shift $((OPTIND-1))
BUG_ID="$1" BUG_ID="$1"
CONFIGFILE=$(mktemp mylocalconfigXXXX.xml) CONFIGFILE=$(mktemp mylocalconfigXXXX.xml)
@@ -42,25 +27,47 @@ curl -s -X GET $COPY_TEMPLATE_CONFIG_URL -u "$USERNAME:$PASSWORD" -o "$CONFIGFIL
# On macosx is gnu-sed needed # On macosx is gnu-sed needed
if [[ "$OSTYPE" == *"$OS_FOR_GSED"* ]]; then if [[ "$OSTYPE" == *"$OS_FOR_GSED"* ]]; then
echo "Using gsed" echo "Using gsed"
gsed -i'' -e 's|<description>..*</description>|<description>This is the build job for \&lt;a href=\&quot;'$BUGZILLA_BASE'/show_bug.cgi?id='$BUG_ID'\&quot;\&gt;Bug '$BUG_ID'\&lt;/a\&gt;</description>|' -e 's|<disabled>true</disabled>|<disabled>false</disabled>|' "$CONFIGFILE" gsed -i'' -e 's|<description>..*</description>|<description>This is the CI job for \&lt;a href=\&quot;'$BUGZILLA_BASE'/show_bug.cgi?id='$BUG_ID'\&quot;\&gt;Bug '$BUG_ID'\&lt;/a\&gt;</description>|' -e 's|<disabled>true</disabled>|<disabled>false</disabled>|' "$CONFIGFILE"
else else
sed -i -e 's|<description>..*</description>|<description>This is the build job for \&lt;a href=\&quot;'$BUGZILLA_BASE'/show_bug.cgi?id='$BUG_ID'\&quot;\&gt;Bug '$BUG_ID'\&lt;/a\&gt;</description>|' -e 's|<disabled>true</disabled>|<disabled>false</disabled>|' "$CONFIGFILE" sed -i -e 's|<description>..*</description>|<description>This is the CI job for \&lt;a href=\&quot;'$BUGZILLA_BASE'/show_bug.cgi?id='$BUG_ID'\&quot;\&gt;Bug '$BUG_ID'\&lt;/a\&gt;</description>|' -e 's|<disabled>true</disabled>|<disabled>false</disabled>|' "$CONFIGFILE"
fi fi
if [ "$SKIP_TESTS" = "1" ]; then # On macosx is gnu-sed needed
if [[ "$OSTYPE" == *"$OS_FOR_GSED"* ]]; then if [[ "$OSTYPE" == *"$OS_FOR_GSED"* ]]; then
gsed -i'' -e 's|<command>\([^<]*\)build *</command>|<command>\1-t build</command>|' "$CONFIGFILE" echo "Using gsed"
else gsed -i'' -n -e ':loop
sed -i -e 's|<command>\([^<]*\)build *</command>|<command>\1-t build</command>|' "$CONFIGFILE" /<command>/b InCommand
fi p
fi $b
if [ "$BUILD_RELEASE" = "1" ]; then N
if [[ "$OSTYPE" == *"$OS_FOR_GSED"* ]]; then D
gsed -i'' -e 's|<command>\([^<]*\)</command>|<command>\1 \&amp;\&amp; PATH=/usr/local/bin:${PATH} configuration/buildAndUpdateProduct.sh -n bug'$BUG_ID' -w trac@sapsailing.com -u release</command>|' "$CONFIGFILE" b loop
else :InCommand
sed -i -e 's|<command>\([^<]*\)</command>|<command>\1 \&amp;\&amp; PATH=/usr/local/bin:${PATH} configuration/buildAndUpdateProduct.sh -n bug'$BUG_ID' -w trac@sapsailing.com -u release</command>|' "$CONFIGFILE" s/BRANCH/'bug${BUG_ID}'/g
fi /<\/command>/p
/<\/command>/b End
N
b InCommand
:End
' "$CONFIGFILE"
else
sed -i -n -e ':loop
/<command>/b InCommand
p
$b
N
D
b loop
:InCommand
s/BRANCH/'bug${BUG_ID}'/g
/<\/command>/p
/<\/command>/b End
N
b InCommand
:End
' "$CONFIGFILE"
fi fi
if [[ "$OSTYPE" == *"$OS_FOR_GSED"* ]]; then if [[ "$OSTYPE" == *"$OS_FOR_GSED"* ]]; then
gsed -i'' -e '/<branches>$/{ gsed -i'' -e '/<branches>$/{
N N