gitlab-ci (390B)
1 #!/bin/sh 2 3 help() { 4 echo "Usage: ${0##*/} JOBNAME1 [JOBNAME2,...,[JOBNAME N]]" 5 } 6 7 [ $# -lt 1 ] && (help && exit 1) 8 case "$1" in 9 -h|--help) 10 help 11 exit 0 12 ;; 13 *) 14 if [ "$(uname)" = "Linux" ]; then 15 # Run as sudo if not SU already 16 if ! [ "$(id -u)" = 0 ]; then 17 sudo "$0" "$@" 18 exit $? 19 fi 20 fi 21 ;; 22 esac 23 24 for jobname in "$@"; do 25 gitlab-runner exec docker "$jobname" 26 done