meta data for this page
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| git:gitlab:runner:shell [2022/01/05 18:05] – created niziak | git:gitlab:runner:shell [2022/01/24 13:25] (current) – niziak | ||
|---|---|---|---|
| Line 22: | Line 22: | ||
| * [[https:// | * [[https:// | ||
| + | Solution: | ||
| + | * Using bash wrapper script plus replace current shell with new process using '' | ||
| + | <file yaml .gitlab-ci.yml> | ||
| + | build: | ||
| + | stage: build | ||
| + | script: | ||
| + | - exec tools/ | ||
| + | - exec tools/ | ||
| + | </ | ||
| + | |||
| + | <file bash tools/ | ||
| + | #!/bin/bash | ||
| + | #_term() { | ||
| + | # echo "$0 caught SIGTERM signal!" | ||
| + | # trap - SIGTERM | ||
| + | # kill -TERM $child $$ | ||
| + | #} | ||
| + | |||
| + | launch_job() { | ||
| + | PARENT=$1 | ||
| + | shift | ||
| + | " | ||
| + | CHILD=$! | ||
| + | trap "trap - SIGTERM; kill -TERM $CHILD $$" SIGTERM | ||
| + | |||
| + | while sleep 1; do | ||
| + | if [ ! -e / | ||
| + | echo " | ||
| + | kill -TERM $CHILD | ||
| + | exit | ||
| + | fi | ||
| + | |||
| + | if [ ! -e / | ||
| + | wait $CHILD | ||
| + | trap - SIGTERM | ||
| + | exit $? | ||
| + | fi | ||
| + | done | ||
| + | } | ||
| + | |||
| + | #trap _term SIGTERM | ||
| + | #launch_job $$ " | ||
| + | #echo "$0 Waiting for $! to finish" | ||
| + | #wait $! | ||
| + | |||
| + | launch_job $PPID " | ||
| + | </ | ||