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:
parent
11bf9b45c7
commit
b63144cb0d
11 changed files with 30 additions and 50 deletions
|
@ -7,8 +7,8 @@ jobs:
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
container:
|
container:
|
||||||
image: code.forgejo.org/oci/debian:bookworm
|
image: code.forgejo.org/oci/debian:bookworm
|
||||||
options: "--volume /srv/example-cron-volume:/srv/example-cron-volume"
|
options: "--volume /srv/example:/srv/example"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- run: |
|
- run: |
|
||||||
touch /srv/example-cron-volume/DONE
|
touch /srv/example/cron-volume/DONE
|
||||||
|
|
|
@ -16,7 +16,7 @@ forgejo-curl.sh api_json --data '{"new_branch_name":"zzzz"}' $api/repos/root/exa
|
||||||
verify_ref
|
verify_ref
|
||||||
|
|
||||||
# cron runs once per minute, give it three minutes max before declaring failure
|
# cron runs once per minute, give it three minutes max before declaring failure
|
||||||
if ! RETRY_DELAYS="30 30 30 30 30 30" forgejo.sh retry test -f /srv/example-cron-volume/DONE ; then
|
if ! RETRY_DELAYS="30 30 30 30 30 30" forgejo.sh retry test -f /srv/example/cron-volume/DONE ; then
|
||||||
cat $FORGEJO_RUNNER_LOGS
|
cat $FORGEJO_RUNNER_LOGS
|
||||||
false
|
false
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
|
|
||||||
log:
|
|
||||||
level: info
|
|
||||||
|
|
||||||
runner:
|
|
||||||
file: .runner
|
|
||||||
capacity: 1
|
|
||||||
env_file: .env
|
|
||||||
timeout: 3h
|
|
||||||
insecure: false
|
|
||||||
fetch_timeout: 5s
|
|
||||||
fetch_interval: 2s
|
|
||||||
labels: ["docker:docker://code.forgejo.org/oci/node:16-bullseye"]
|
|
||||||
|
|
||||||
cache:
|
|
||||||
enabled: false
|
|
||||||
dir: ""
|
|
||||||
host: ""
|
|
||||||
port: 0
|
|
||||||
|
|
||||||
container:
|
|
||||||
network: ""
|
|
||||||
privileged: false
|
|
||||||
options:
|
|
||||||
workdir_parent:
|
|
||||||
valid_volumes: ["/srv/example-cron-volume"]
|
|
||||||
docker_host: ""
|
|
||||||
|
|
||||||
host:
|
|
||||||
workdir_parent:
|
|
|
@ -1,3 +1 @@
|
||||||
rm -fr /srv/example-cron-volume
|
mkdir -p /srv/example/cron-volume
|
||||||
mkdir -p /srv/example-cron-volume
|
|
||||||
FORGEJO_RUNNER_CONFIG=$EXAMPLE_DIR/runner-config.yaml forgejo-runner.sh reload
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
forgejo-runner.sh reload
|
|
|
@ -10,7 +10,7 @@ jobs:
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
container:
|
container:
|
||||||
image: code.forgejo.org/oci/node:20-bookworm
|
image: code.forgejo.org/oci/node:20-bookworm
|
||||||
options: "--volume /srv/example-pull-request:/srv/example-pull-request"
|
options: "--volume /srv/example:/srv/example"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: setup
|
- name: setup
|
||||||
|
@ -115,7 +115,7 @@ jobs:
|
||||||
|
|
||||||
- name: save event
|
- name: save event
|
||||||
run: |
|
run: |
|
||||||
d=/srv/example-pull-request/${{ github.event.pull_request.head.repo.owner.username }}/$GITHUB_EVENT_NAME/${{ github.event.action }}
|
d=/srv/example/pull-request/${{ github.event.pull_request.head.repo.owner.username }}/$GITHUB_EVENT_NAME/${{ github.event.action }}
|
||||||
mkdir -p $d
|
mkdir -p $d
|
||||||
cat > $d/event <<'EOF'
|
cat > $d/event <<'EOF'
|
||||||
${{ toJSON(github.event) }}
|
${{ toJSON(github.event) }}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
api=$url/api/v1
|
api=$url/api/v1
|
||||||
export d=/srv/example-pull-request
|
export d=/srv/example/pull-request
|
||||||
|
|
||||||
PROOF='some proof'
|
PROOF='some proof'
|
||||||
|
|
||||||
function setup() {
|
function setup() {
|
||||||
|
mkdir -p $d
|
||||||
|
|
||||||
forgejo-test-helper.sh push_workflow actions/example-$example $url root example-$example setup-forgejo $token
|
forgejo-test-helper.sh push_workflow actions/example-$example $url root example-$example setup-forgejo $token
|
||||||
|
|
||||||
forgejo-curl.sh api_json --data-raw '{"username":"fork-org"}' $api/orgs
|
forgejo-curl.sh api_json --data-raw '{"username":"fork-org"}' $api/orgs
|
||||||
|
|
|
@ -1,8 +1,2 @@
|
||||||
if test $(id -u) != 0 ; then
|
mkdir -p /srv/example/pull-request
|
||||||
SUDO=sudo
|
|
||||||
fi
|
|
||||||
|
|
||||||
$SUDO rm -fr /srv/example-pull-request/{root,fork-org}
|
|
||||||
rm -fr /srv/example-pull-request
|
|
||||||
mkdir -p /srv/example-pull-request
|
|
||||||
FORGEJO_RUNNER_CONFIG=$EXAMPLE_DIR/runner-config.yaml forgejo-runner.sh reload
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
forgejo-runner.sh reload
|
|
|
@ -2,11 +2,13 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
SELF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
function run() {
|
function run() {
|
||||||
local example=$1
|
local example=$1
|
||||||
|
|
||||||
export example
|
export example
|
||||||
export EXAMPLE_DIR=$(pwd)/actions/example-$example
|
export EXAMPLE_DIR=$SELF_DIR/example-$example
|
||||||
|
|
||||||
if test -f $EXAMPLE_DIR/setup.sh ; then
|
if test -f $EXAMPLE_DIR/setup.sh ; then
|
||||||
echo "============================ SETUP example-$example ==================="
|
echo "============================ SETUP example-$example ==================="
|
||||||
|
@ -39,9 +41,24 @@ function examples_v1_22() {
|
||||||
examples_v1_21
|
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() {
|
function setup() {
|
||||||
local binary=$1
|
local binary=$1
|
||||||
forgejo-binary.sh setup root admin1234 $binary
|
forgejo-binary.sh setup root admin1234 $binary
|
||||||
|
cleanup_example_volume
|
||||||
|
export FORGEJO_RUNNER_CONFIG=$SELF_DIR/runner-config.yaml
|
||||||
forgejo-runner.sh setup
|
forgejo-runner.sh setup
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,6 +107,7 @@ function main() {
|
||||||
false
|
false
|
||||||
fi
|
fi
|
||||||
echo "======================== END example-$example ==================="
|
echo "======================== END example-$example ==================="
|
||||||
|
cleanup_example_volume
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ container:
|
||||||
privileged: false
|
privileged: false
|
||||||
options:
|
options:
|
||||||
workdir_parent:
|
workdir_parent:
|
||||||
valid_volumes: ["/srv/example-pull-request"]
|
valid_volumes: ["/srv/example"]
|
||||||
docker_host: ""
|
docker_host: ""
|
||||||
|
|
||||||
host:
|
host:
|
Loading…
Add table
Reference in a new issue