always allow workflows to mount /srv/example

because it is generally useful to store informations about how the
workflow ran
This commit is contained in:
Earl Warren 2024-01-05 18:11:19 +01:00
parent 11bf9b45c7
commit b63144cb0d
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
11 changed files with 30 additions and 50 deletions

View file

@ -2,11 +2,13 @@
set -e
SELF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
function run() {
local example=$1
export example
export EXAMPLE_DIR=$(pwd)/actions/example-$example
export EXAMPLE_DIR=$SELF_DIR/example-$example
if test -f $EXAMPLE_DIR/setup.sh ; then
echo "============================ SETUP example-$example ==================="
@ -39,9 +41,24 @@ function examples_v1_22() {
examples_v1_21
}
function cleanup_example_volume() {
if ! test -d /srv/example ; then
mkdir -p /srv/example
return
fi
if test $(id -u) != 0 ; then
SUDO=sudo
fi
$SUDO rm -fr /srv/example/*
}
function setup() {
local binary=$1
forgejo-binary.sh setup root admin1234 $binary
cleanup_example_volume
export FORGEJO_RUNNER_CONFIG=$SELF_DIR/runner-config.yaml
forgejo-runner.sh setup
}
@ -90,6 +107,7 @@ function main() {
false
fi
echo "======================== END example-$example ==================="
cleanup_example_volume
done
}