podman/contrib/cirrus/success.sh
Ed Santiago 295c531ece cirrus lib.sh: refactor req_env_var()
Existing code was not working due to a bash gotcha ('exit'
from a pipeline). It also had unnecessary duplication.

New version is safer; also includes unit tests run under localunit.

Existing invocations of req_env_var replaced via:

   $ [ edit setup_environment.sh, move one closing quote to its own line ]
   $ perl -ni -e 's/(?<=req_env_var )"(\S+)\s+\$\1"/$1/; if (/req_env_var "$/ .. /^\s*"/) { chomp; s/(?<=\S)\s.*//; if (/^\s*"/) { print "\n" } else { unless (/req_env_var/) { s/^\s+//; print " ";} print;} } else { print }' $(ack -l req_env_var)
   $ [ hand-massage an incorrect instance of '@' in lib.sh:ircmsg() ]

Signed-off-by: Ed Santiago <santiago@redhat.com>
2019-05-02 08:14:59 -06:00

18 lines
375 B
Bash
Executable file

#!/bin/bash
set -e
source $(dirname $0)/lib.sh
req_env_var CIRRUS_BRANCH CIRRUS_BUILD_ID
REF=$(basename $CIRRUS_BRANCH) # PR number or branch named
URL="https://cirrus-ci.com/build/$CIRRUS_BUILD_ID"
if [[ "$CIRRUS_BRANCH" =~ "pull" ]]
then
ircmsg "Cirrus-CI testing successful for PR #$REF: $URL"
else
ircmsg "Cirrus-CI testing branch $REF successful: $URL"
fi