Skip to content

Commit

Permalink
Bundle industrial_ci, if run from act
Browse files Browse the repository at this point in the history
  • Loading branch information
mathias-luedtke committed Oct 7, 2021
1 parent 78550bb commit 85eb938
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
7 changes: 6 additions & 1 deletion .github/action.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,9 @@ if [ "${ABICHECK_MERGE:-}" = "auto" ]; then
[ "$GITHUB_EVENT_NAME" != "pull_request" ] || ABICHECK_MERGE=true
fi

env "$@" bash "$DIR_THIS/../industrial_ci/src/ci_main.sh"
if [[ $ICI_SRC_PATH == /var/run/act/* ]]; then
export _BUNDLE_ICI=true
ici_warn "Detected act, bundling industrial_ci"
fi

env "$@" bash "$ICI_SRC_PATH/ci_main.sh"
11 changes: 10 additions & 1 deletion industrial_ci/src/isolation/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export DOCKER_COMMIT=${DOCKER_COMMIT:-}
export DOCKER_COMMIT_MSG=${DOCKER_COMMIT_MSG:-}
export DOCKER_CREDENTIALS=${DOCKER_CREDENTIALS-.docker .ssh .subversion}
export DOCKER_PULL=${DOCKER_PULL:-true}
export _BUNDLE_ICI=${_BUNDLE_ICI:-false}

# ici_forward_mount VARNAME/FILE rw/ro [PATH]
function ici_forward_mount() {
Expand Down Expand Up @@ -84,7 +85,11 @@ function ici_isolate() {
fi

ici_forward_mount TARGET_REPO_PATH ro
ici_forward_mount ICI_SRC_PATH ro
if [ "$_BUNDLE_ICI" = true ]; then
ici_forward_variable ICI_SRC_PATH
else
ici_forward_mount ICI_SRC_PATH ro
fi
ici_forward_mount BASEDIR rw
ici_forward_mount CCACHE_DIR rw
ici_forward_mount SSH_AUTH_SOCK rw # forward ssh agent into docker container
Expand Down Expand Up @@ -155,6 +160,10 @@ function ici_run_cmd_in_docker() {
docker_cp "$d" "$cid:${docker_query[*]:2}/" "${docker_query[0]}" "${docker_query[1]}"
done

if [ "$_BUNDLE_ICI" = true ]; then
tar -c -f - "$ICI_SRC_PATH" | docker cp - "$cid:/"
fi

trap '>/dev/null ici_label ici_quiet docker kill --signal=SIGTERM $cid && >/dev/null docker wait $cid' INT
( trap '' INT && ici_label docker start -a "$cid" > >(sed 's/\r$//') ) &
local ret=0
Expand Down

0 comments on commit 85eb938

Please sign in to comment.