Compare commits
2 commits
main
...
forgejo-pr
Author | SHA1 | Date | |
---|---|---|---|
Earl Warren | 44f96d9a49 | ||
Earl Warren | 6c4f30bf29 |
|
@ -1,3 +0,0 @@
|
|||
root = true
|
||||
[*]
|
||||
tab_width: 8
|
|
@ -1,29 +0,0 @@
|
|||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: cache S3 binaries
|
||||
id: S3
|
||||
uses: https://code.forgejo.org/actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
/usr/local/bin/minio
|
||||
/usr/local/bin/mc
|
||||
/usr/local/bin/garage
|
||||
key: S3
|
||||
|
||||
- uses: https://code.forgejo.org/actions/setup-forgejo@v2
|
||||
with:
|
||||
install-only: true
|
||||
- run: forgejo-binary.sh ensure_user forgejo
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: forgejo-dev
|
||||
path: /srv/forgejo-binaries
|
||||
- name: chown/chmod /srv/forgejo-binaries
|
||||
run: |
|
||||
chmod +x /srv/forgejo-binaries/*
|
||||
chown -R forgejo /srv/forgejo-binaries
|
||||
- run: |
|
||||
script=$(pwd)/end-to-end.sh
|
||||
$script run dependencies
|
||||
$script clobber
|
|
@ -1,133 +0,0 @@
|
|||
#
|
||||
#
|
||||
# https://code.forgejo.org/forgejo/end-to-end/settings/actions
|
||||
#
|
||||
# secrets.CASCADE_DOCS_ORIGIN_TOKEN
|
||||
# https://code.forgejo.org/forgejo-ci scope write:issue, read:repository, read:user
|
||||
# vars.CASCADE_DOCS_DESTINATION_DOER
|
||||
# forgejo-cascading-pr (https://codeberg.org/forgejo-cascading-pr)
|
||||
# secrets.CASCADE_DOCS_DESTINATION_TOKEN
|
||||
# https://codeberg.org/forgejo-cascading-pr scope write:issue, write:repository, read:user
|
||||
# vars.CASCADE_DOCS_FORCE_VERSION
|
||||
# replace the generated documentation for a given version even if it has already
|
||||
# been generated (e.g. v7.0.0-test)
|
||||
#
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: 'docker.io/node:20-bookworm'
|
||||
steps:
|
||||
- uses: https://code.forgejo.org/actions/checkout@v4
|
||||
- uses: https://code.forgejo.org/actions/setup-go@v4
|
||||
with:
|
||||
go-version: "1.22"
|
||||
- name: lib/build.sh
|
||||
run: |
|
||||
set -x
|
||||
|
||||
#
|
||||
# SQLite needs gcc to be compiled
|
||||
#
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-get update -qq
|
||||
apt-get -q install -y -qq build-essential
|
||||
|
||||
d=/tmp/forgejo-binaries
|
||||
mkdir $d /tmp/forgejo-upload
|
||||
|
||||
for version in $(ls forgejo/sources) ; do
|
||||
forgejo=$d/forgejo-$version-dev
|
||||
lib/build.sh $version $d
|
||||
$forgejo --version
|
||||
mv $forgejo /tmp/forgejo-upload
|
||||
done
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: forgejo-dev
|
||||
path: /tmp/forgejo-upload
|
||||
|
||||
packages:
|
||||
needs: [build]
|
||||
runs-on: lxc-bookworm
|
||||
steps:
|
||||
- uses: https://code.forgejo.org/actions/checkout@v4
|
||||
- uses: ./.forgejo/prepare-end-to-end
|
||||
- run: su forgejo -c "./end-to-end.sh test_packages"
|
||||
- name: full logs
|
||||
if: always()
|
||||
run: su forgejo -c "./end-to-end.sh show_logs"
|
||||
|
||||
actions:
|
||||
needs: [build]
|
||||
runs-on: lxc-bookworm
|
||||
steps:
|
||||
- uses: https://code.forgejo.org/actions/checkout@v4
|
||||
- uses: ./.forgejo/prepare-end-to-end
|
||||
- run: su forgejo -c "./end-to-end.sh test_actions"
|
||||
- name: full logs
|
||||
if: always()
|
||||
run: su forgejo -c "./end-to-end.sh show_logs"
|
||||
|
||||
actions-docs:
|
||||
needs: [build]
|
||||
runs-on: lxc-bookworm
|
||||
if: github.ref == 'refs/heads/main'
|
||||
strategy:
|
||||
matrix:
|
||||
info:
|
||||
- version: "7.0"
|
||||
branch: next
|
||||
forgejo: https://codeberg.org
|
||||
owner: forgejo-experimental
|
||||
- version: "1.21"
|
||||
forgejo: https://codeberg.org
|
||||
owner: forgejo
|
||||
steps:
|
||||
- uses: https://code.forgejo.org/actions/checkout@v4
|
||||
- uses: ./.forgejo/prepare-end-to-end
|
||||
- name: set full-version
|
||||
id: full-version
|
||||
shell: bash
|
||||
run: |
|
||||
set -x
|
||||
full_version=$(./end-to-end.sh full_version ${{ matrix.info.version }} ${{ matrix.info.owner }})
|
||||
echo value="$full_version" >> $GITHUB_OUTPUT
|
||||
- run: su forgejo -c "./end-to-end.sh test_actions ${{ matrix.info.version }}"
|
||||
- name: update documentation
|
||||
uses: https://code.forgejo.org/actions/cascading-pr@v2.1
|
||||
with:
|
||||
origin-url: ${{ env.GITHUB_SERVER_URL }}
|
||||
origin-repo: ${{ github.repository }}
|
||||
origin-token: ${{ secrets.CASCADE_DOCS_ORIGIN_TOKEN }}
|
||||
origin-ref: refs/heads/main
|
||||
destination-url: https://codeberg.org
|
||||
destination-fork-repo: ${{ vars.CASCADE_DOCS_DESTINATION_DOER }}/docs
|
||||
destination-repo: forgejo/docs
|
||||
destination-branch: ${{ matrix.info.branch || format('v{0}', matrix.info.version) }}
|
||||
destination-token: ${{ secrets.CASCADE_DOCS_DESTINATION_TOKEN }}
|
||||
prefix: ${{ env.GITHUB_REPOSITORY }}-${{ matrix.info.version }}
|
||||
update: .forgejo/cascading-docs
|
||||
env:
|
||||
FORCE_VERSION: "${{ vars.CASCADE_DOCS_FORCE_VERSION }}"
|
||||
VERSION: "${{ steps.full-version.outputs.value }}"
|
||||
|
||||
upgrade:
|
||||
name: upgrade and storage
|
||||
needs: [build]
|
||||
runs-on: lxc-bookworm
|
||||
steps:
|
||||
- uses: https://code.forgejo.org/actions/checkout@v4
|
||||
- uses: ./.forgejo/prepare-end-to-end
|
||||
- run: su forgejo -c "./end-to-end.sh test_upgrades"
|
||||
- run: su forgejo -c "./end-to-end.sh test_storage"
|
||||
- name: full logs
|
||||
if: always()
|
||||
run: su forgejo -c "./end-to-end.sh show_logs"
|
39
.forgejo/workflows/pr.yml
Normal file
39
.forgejo/workflows/pr.yml
Normal file
|
@ -0,0 +1,39 @@
|
|||
on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
info:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: node:20-bookworm
|
||||
steps:
|
||||
- name: event
|
||||
run: |
|
||||
cat <<'EOF'
|
||||
${{ toJSON(github.event) }}
|
||||
EOF
|
||||
|
||||
actions:
|
||||
runs-on: self-hosted
|
||||
container:
|
||||
image: node:20-bookworm
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: https://code.forgejo.org/actions/setup-forgejo@v2
|
||||
with:
|
||||
install-only: true
|
||||
|
||||
- shell: bash
|
||||
run: |
|
||||
set -x
|
||||
forgejo-binary.sh ensure_user forgejo
|
||||
|
||||
export DIR=$(mktemp -d)
|
||||
chown forgejo $DIR /srv
|
||||
|
||||
if test -f forgejo/binary-url ; then
|
||||
su -c "actions/run.sh $(cat forgejo/binary-url) unknown_full_version v7_0" forgejo
|
||||
else
|
||||
echo "forgejo/binary-url does not exist, do nothing"
|
||||
fi
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,9 +1,12 @@
|
|||
*~
|
||||
forgejo-api
|
||||
forgejo-header
|
||||
forgejo-ip
|
||||
forgejo-runner-home
|
||||
forgejo-runner-pid
|
||||
forgejo-runner-token
|
||||
forgejo-runner.clientpid
|
||||
forgejo-runner.log
|
||||
forgejo-token
|
||||
.runner
|
||||
#*
|
||||
|
|
88
README.md
88
README.md
|
@ -18,7 +18,7 @@ as:
|
|||
|
||||
```json
|
||||
{
|
||||
"insecure-registries": [ "10.0.0.0/8" ]
|
||||
"insecure-registries": [ "10.80.4.76:3000" ]
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -30,24 +30,24 @@ Action](https://forgejo.org/docs/v1.21/user/actions/) which is meant
|
|||
to be used in workflows. However, it is implemented as shell scripts that
|
||||
can also be used to create Forgejo instances and runners locally. This
|
||||
is convenient for testing and the reason why it needs to be added to the PATH.
|
||||
For instance, it is a dependency of the `end-to-end.sh` script.
|
||||
For instance, it is a dependency of the `actions/run.sh` script.
|
||||
|
||||
```sh
|
||||
git clone https://code.forgejo.org/actions/setup-forgejo
|
||||
export PATH=$(pwd)/setup-forgejo:$PATH
|
||||
git clone https://code.forgejo.org/forgejo/end-to-end
|
||||
cd end-to-end
|
||||
export DIR=/tmp/end-to-end
|
||||
rm -fr /tmp/end-to-end ; sudo rm -fr /srv/example ; sudo mkdir /srv/example ; sudo chown -R $USER /srv/example
|
||||
```
|
||||
|
||||
## Running from locally built binary
|
||||
Run using Forgejo built from source.
|
||||
|
||||
```sh
|
||||
make TAGS='bindata sqlite sqlite_unlock_notify' generate forgejo
|
||||
cp -a forgejo /srv/forgejo-binaries/forgejo-7.0-dev
|
||||
cp -a forgejo $DIR/forgejo
|
||||
```
|
||||
|
||||
It will be used whenver the version `7.0-dev` is specified in a test.
|
||||
|
||||
## Running actions locally
|
||||
|
||||
To run and debug workflows from `actions/example-*`, from the root of
|
||||
|
@ -58,25 +58,71 @@ run as root in the context of Forgejo Actions and assume they have
|
|||
admin permissions. But they do not need to run as root and must work
|
||||
fine when run as a regular user.
|
||||
|
||||
```sh
|
||||
./end-to-end.sh actions_setup 1.21
|
||||
firefox 0.0.0.0:3000 # user root / admin1234
|
||||
./end-to-end.sh actions_verify_example artifacts
|
||||
./end-to-end.sh actions_teardown
|
||||
```
|
||||
## Running other tests locally
|
||||
|
||||
To run and debug tests, from the root of the source directory.
|
||||
|
||||
Run one test. When the test fails the instance can be inspected at http://0.0.0.0:3000
|
||||
Run one example
|
||||
|
||||
```sh
|
||||
./end-to-end.sh test_packages_alpine
|
||||
./end-to-end.sh test_storage_stable_s3 minio
|
||||
actions/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v7.0.0-test/forgejo-7.0.0-test-linux-amd64 v7.0.0-test v7_0 cron # runs actions/example-cron
|
||||
```
|
||||
|
||||
Cleanup. It will teardown the Forgejo instance.
|
||||
Cleanup. It will teardown Forgejo & the runner and not run them because there is nothing to test.
|
||||
|
||||
```sh
|
||||
./end-to-end.sh stop
|
||||
actions/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v7.0.0-test/forgejo-7.0.0-test-linux-amd64 v7.0.0-test v7_0 none
|
||||
```
|
||||
|
||||
Run all examples for v7_0
|
||||
|
||||
```sh
|
||||
actions/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v7.0.0-test/forgejo-7.0.0-test-linux-amd64 v7.0.0-test v7_0
|
||||
```
|
||||
|
||||
Run from sources
|
||||
|
||||
```sh
|
||||
make TAGS='bindata sqlite sqlite_unlock_notify' generate forgejo
|
||||
cp -a forgejo $DIR/forgejo
|
||||
```
|
||||
|
||||
Remote testing
|
||||
|
||||
To reduce the runtime the following variables can be set to control
|
||||
the number of cases run by the
|
||||
[actions](.forgejo/workflows/actions.yml) tests. If set to
|
||||
**none** they are not run at all for that version of Forgejo. If
|
||||
it does not exist, all tests are run.
|
||||
|
||||
* `v7_0_TESTS`
|
||||
* `V1_21_TESTS`
|
||||
* `V1_20_TESTS`
|
||||
|
||||
## Running packages locally
|
||||
|
||||
To run and debug package tests, from the root of the source directory.
|
||||
|
||||
Run one test
|
||||
|
||||
```sh
|
||||
packages/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v7.0.0-test/forgejo-7.0.0-test-linux-amd64 v7.0.0-test v7_0 alpine # runs packages/alpine.sh
|
||||
```
|
||||
|
||||
Cleanup. It will teardown Forgejo and not run them because there is nothing to test.
|
||||
|
||||
```sh
|
||||
packages/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v7.0.0-test/forgejo-7.0.0-test-linux-amd64 v7.0.0-test v7_0 none
|
||||
```
|
||||
Run all examples for v7_0
|
||||
|
||||
```sh
|
||||
packages/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v7.0.0-test/forgejo-7.0.0-test-linux-amd64 v7.0.0-test v7_0
|
||||
```
|
||||
|
||||
Remote testing
|
||||
|
||||
To reduce the runtime the following variables can be set to control
|
||||
the number of cases run by the
|
||||
[packages test](.forgejo/workflows/packages.yml) tests. If set to
|
||||
**none** they are not run at all for that version of Forgejo. If
|
||||
it does not exist, all tests are run.
|
||||
|
||||
* `v7_0_PACKAGES_TESTS`
|
||||
* `V1_21_PACKAGES_TESTS`
|
||||
|
|
|
@ -1,115 +0,0 @@
|
|||
# Copyright 2024 The Forgejo Authors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
ACTIONS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
function actions_verify_example() {
|
||||
local example=$1
|
||||
|
||||
export url=http://${FORGEJO_USER}:${FORGEJO_PASSWORD}@${HOST_PORT}
|
||||
export token=$(cat $DOT_FORGEJO_CURL/token)
|
||||
|
||||
actions_cleanup_example_volume
|
||||
|
||||
export example
|
||||
export EXAMPLE_DIR=$ACTIONS_DIR/example-$example
|
||||
|
||||
if test -f $EXAMPLE_DIR/setup.sh ; then
|
||||
echo "============================ SETUP example-$example ==================="
|
||||
bash -ex $EXAMPLE_DIR/setup.sh || return 1
|
||||
fi
|
||||
|
||||
if test -f $EXAMPLE_DIR/run.sh ; then
|
||||
echo "============================ RUN example-$example ==================="
|
||||
bash -ex $EXAMPLE_DIR/run.sh || return 1
|
||||
else
|
||||
forgejo-test-helper.sh run_workflow actions/example-$example $url root example-$example $example $token || return 1
|
||||
fi
|
||||
|
||||
if test -f $EXAMPLE_DIR/teardown.sh ; then
|
||||
echo "============================ TEARDOWN example-$example ==================="
|
||||
bash -ex $EXAMPLE_DIR/teardown.sh || return 1
|
||||
fi
|
||||
|
||||
actions_save_contexts $example
|
||||
}
|
||||
|
||||
function actions_save_contexts() {
|
||||
local example="$1"
|
||||
|
||||
if test -d /srv/example/$example/contexts; then
|
||||
mkdir -p /srv/contexts
|
||||
rsync -av /srv/example/$example/contexts/ /srv/contexts/$example/
|
||||
fi
|
||||
}
|
||||
|
||||
function actions_cleanup_example_volume() {
|
||||
if test $(id -u) != 0 ; then
|
||||
$SUDO chown $(id -u) /srv
|
||||
fi
|
||||
|
||||
if ! test -d /srv/example ; then
|
||||
mkdir -p /srv/example
|
||||
return
|
||||
fi
|
||||
|
||||
$SUDO rm -fr /srv/example/*
|
||||
}
|
||||
|
||||
function actions_setup() {
|
||||
local version=$1
|
||||
actions_teardown
|
||||
|
||||
reset_forgejo $ACTIONS_DIR/default-app.ini
|
||||
start_forgejo $version
|
||||
|
||||
export FORGEJO_RUNNER_LOGS=$DIR/forgejo-runner.log
|
||||
|
||||
actions_cleanup_example_volume
|
||||
export FORGEJO_RUNNER_CONFIG=$ACTIONS_DIR/runner-config.yaml
|
||||
forgejo-runner.sh setup '' '' http://${HOST_PORT}
|
||||
}
|
||||
|
||||
function actions_teardown() {
|
||||
forgejo-curl.sh logout
|
||||
forgejo-runner.sh teardown
|
||||
stop_daemon forgejo
|
||||
}
|
||||
|
||||
function actions_runner_version() {
|
||||
local runner_version=$($DIR/forgejo-runner --version | sed -n -e 's/forgejo-runner version v//p')
|
||||
if test -z "$runner_version" ; then
|
||||
$DIR/forgejo-runner --version
|
||||
echo failed to parse version
|
||||
false
|
||||
fi
|
||||
echo $runner_version
|
||||
}
|
||||
|
||||
function test_actions() {
|
||||
local versions="${1:-1.20 1.21 $RELEASE_NUMBERS_AND_DEV}"
|
||||
|
||||
for version in $versions ; do
|
||||
|
||||
actions_setup $version
|
||||
local runner_version=$(actions_runner_version)
|
||||
|
||||
log_info "Testing actions with Forgejo $version & Forgejo runner $runner_version"
|
||||
|
||||
if dpkg --compare-versions $version ge 7.0 && dpkg --compare-versions $runner_version gt 3.3.0 ; then
|
||||
for example in artifacts-v4 ; do
|
||||
run actions_verify_example $example
|
||||
done
|
||||
fi
|
||||
|
||||
for example in echo checkout service container expression local-action docker-action if if-fail ; do
|
||||
run actions_verify_example $example
|
||||
done
|
||||
|
||||
if dpkg --compare-versions $version gt 1.20 ; then
|
||||
for example in push tag push-cancel artifacts pull-request context cron ; do
|
||||
run actions_verify_example $example
|
||||
done
|
||||
fi
|
||||
done
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
RUN_MODE = prod
|
||||
WORK_PATH = ${WORK_PATH}
|
||||
|
||||
[server]
|
||||
APP_DATA_PATH = ${WORK_PATH}/data
|
||||
DOMAIN = ${IP}
|
||||
HTTP_PORT = 3000
|
||||
SSH_LISTEN_PORT = 2222
|
||||
LFS_START_SERVER = true
|
||||
|
||||
[queue]
|
||||
TYPE = immediate
|
||||
|
||||
[database]
|
||||
DB_TYPE = sqlite3
|
||||
PATH = ${WORK_PATH}/forgejo.db
|
||||
|
||||
[log]
|
||||
MODE = file
|
||||
LEVEL = trace
|
||||
ROUTER = file
|
||||
|
||||
[log.file]
|
||||
FILE_NAME = forgejo.log
|
||||
|
||||
[security]
|
||||
INSTALL_LOCK = true
|
||||
|
||||
[repository]
|
||||
ENABLE_PUSH_CREATE_USER = true
|
||||
DEFAULT_PUSH_CREATE_PRIVATE = false
|
||||
DEFAULT_REPO_UNITS = repo.code,repo.releases,repo.issues,repo.pulls,repo.wiki,repo.projects,repo.packages,repo.actions
|
||||
|
||||
[actions]
|
||||
ENABLED = true
|
|
@ -1,47 +0,0 @@
|
|||
on: [push]
|
||||
jobs:
|
||||
upload-many:
|
||||
runs-on: docker
|
||||
steps:
|
||||
- run: mkdir -p artifacts
|
||||
|
||||
- run: touch artifacts/ONE artifacts/TWO
|
||||
|
||||
- uses: https://code.forgejo.org/forgejo/upload-artifact@v4
|
||||
with:
|
||||
name: many-artifacts
|
||||
path: artifacts/
|
||||
|
||||
download-many:
|
||||
needs: [upload-many]
|
||||
runs-on: docker
|
||||
steps:
|
||||
- uses: https://code.forgejo.org/forgejo/download-artifact@v4
|
||||
|
||||
- run: |
|
||||
test -f many-artifacts/ONE
|
||||
test -f many-artifacts/TWO
|
||||
|
||||
upload-one:
|
||||
runs-on: docker
|
||||
steps:
|
||||
- run: mkdir -p path/to/artifact
|
||||
|
||||
- run: echo hello > path/to/artifact/world.txt
|
||||
|
||||
- uses: https://code.forgejo.org/forgejo/upload-artifact@v4
|
||||
with:
|
||||
name: my-artifact
|
||||
path: path/to/artifact/world.txt
|
||||
|
||||
download-one:
|
||||
needs: [upload-one]
|
||||
runs-on: docker
|
||||
steps:
|
||||
- run: "! test -f world.txt"
|
||||
|
||||
- uses: https://code.forgejo.org/forgejo/download-artifact@v4
|
||||
with:
|
||||
name: my-artifact
|
||||
|
||||
- run: "test -f world.txt"
|
|
@ -3,7 +3,7 @@ export d=/srv/example/pull-request
|
|||
|
||||
PROOF='some proof'
|
||||
|
||||
function main() {
|
||||
function setup() {
|
||||
mkdir -p $d
|
||||
|
||||
forgejo-test-helper.sh push_workflow actions/example-$example $url root example-$example setup-forgejo $token
|
||||
|
@ -54,4 +54,8 @@ function main() {
|
|||
done
|
||||
}
|
||||
|
||||
function main() {
|
||||
setup
|
||||
}
|
||||
|
||||
main
|
||||
|
|
|
@ -13,6 +13,6 @@ forgejo-test-helper.sh wait_running $url $repo $sha
|
|||
#
|
||||
forgejo-test-helper.sh push_workflow actions/example-$example $url root example-$example setup-forgejo $token
|
||||
#
|
||||
# wait for the workflow to be canceled as a result of the previous push
|
||||
# wait for the workflow to be canceld as a result of the previous push
|
||||
#
|
||||
forgejo-test-helper.sh wait_failure $url $repo $sha 'Has been cancelled'
|
||||
|
|
|
@ -2,23 +2,7 @@ on: [push]
|
|||
|
||||
jobs:
|
||||
#
|
||||
# No volume involved & the container is implicit
|
||||
#
|
||||
simple-no-container:
|
||||
runs-on: docker
|
||||
services:
|
||||
pgsql:
|
||||
image: code.forgejo.org/oci/postgres:15
|
||||
env:
|
||||
POSTGRES_DB: test
|
||||
POSTGRES_PASSWORD: postgres
|
||||
steps:
|
||||
- run: |
|
||||
apt-get update -qq
|
||||
apt-get install -y -qq postgresql-client
|
||||
PGPASSWORD=postgres psql -h pgsql -U postgres -c '\dt' test
|
||||
#
|
||||
# No volume involved & the container is explicit
|
||||
# No volume involved
|
||||
#
|
||||
simple:
|
||||
runs-on: docker
|
||||
|
|
127
actions/run.sh
Executable file
127
actions/run.sh
Executable file
|
@ -0,0 +1,127 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
SELF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
function run() {
|
||||
local example=$1
|
||||
|
||||
export example
|
||||
export EXAMPLE_DIR=$SELF_DIR/example-$example
|
||||
|
||||
if test -f $EXAMPLE_DIR/setup.sh ; then
|
||||
echo "============================ SETUP example-$example ==================="
|
||||
bash -ex $EXAMPLE_DIR/setup.sh || return 1
|
||||
fi
|
||||
|
||||
if test -f $EXAMPLE_DIR/run.sh ; then
|
||||
echo "============================ RUN example-$example ==================="
|
||||
bash -ex $EXAMPLE_DIR/run.sh || return 1
|
||||
else
|
||||
forgejo-test-helper.sh run_workflow actions/example-$example $url root example-$example $example $token || return 1
|
||||
fi
|
||||
|
||||
if test -f $EXAMPLE_DIR/teardown.sh ; then
|
||||
echo "============================ TEARDOWN example-$example ==================="
|
||||
bash -ex $EXAMPLE_DIR/teardown.sh || return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function examples_v1_20() {
|
||||
echo 'echo checkout service container expression local-action docker-action if if-fail'
|
||||
}
|
||||
|
||||
function examples_v1_21() {
|
||||
# keep "cron" last otherwise it will linger and pollute the following runs
|
||||
echo 'echo push tag push-cancel artifacts service checkout pull-request container expression local-action context docker-action if if-fail cron'
|
||||
}
|
||||
|
||||
function examples_v7_0() {
|
||||
examples_v1_21
|
||||
}
|
||||
|
||||
function save_contexts() {
|
||||
local example="$1"
|
||||
|
||||
if test -d /srv/example/$example/contexts; then
|
||||
mkdir -p /srv/contexts
|
||||
rsync -av /srv/example/$example/contexts/ /srv/contexts/$example/
|
||||
fi
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
function teardown() {
|
||||
forgejo-curl.sh logout
|
||||
forgejo-runner.sh teardown
|
||||
forgejo-binary.sh teardown
|
||||
}
|
||||
|
||||
function main() {
|
||||
local binary="$1"
|
||||
shift
|
||||
export full_version="$1"
|
||||
shift
|
||||
export version="$1"
|
||||
shift
|
||||
|
||||
export DOT=$DIR/forgejo-curl
|
||||
|
||||
teardown
|
||||
|
||||
if test "$#" = 0 ; then
|
||||
examples=$(examples_${version/./_})
|
||||
else
|
||||
examples="$@"
|
||||
fi
|
||||
|
||||
if test "$examples" = "none" ; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
setup $binary
|
||||
|
||||
if ! test -f "$DIR/forgejo-auth-url" ; then
|
||||
echo "DIR=$DIR must be a directory with a forgejo-auth-url file"
|
||||
fi
|
||||
|
||||
export FORGEJO_RUNNER_LOGS=$DIR/forgejo-runner.log
|
||||
export url=$(cat $DIR/forgejo-auth-url)
|
||||
export token=$(cat $DIR/forgejo-token)
|
||||
|
||||
for example in $examples ; do
|
||||
echo "======================== BEGIN example-$example ==================="
|
||||
if ! time run $example >& /tmp/run.out ; then
|
||||
sed -e 's/^/[RUN] /' < /tmp/run.out
|
||||
echo "======================== FAIL example-$example ==================="
|
||||
sleep 5 # hack for Forgejo v1.21 to workaround a bug by which the last lines of the output are moved to the next step
|
||||
false
|
||||
fi
|
||||
echo "======================== END example-$example ==================="
|
||||
save_contexts $example
|
||||
cleanup_example_volume
|
||||
done
|
||||
}
|
||||
|
||||
main "$@"
|
|
@ -1,24 +0,0 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
#
|
||||
# Debug loop from the source tree:
|
||||
#
|
||||
# ./end-to-end.sh dependencies
|
||||
# ./end-to-end.sh build_all
|
||||
# VERBOSE=true ./end-to-end.sh test_downgrade_1.20.2_fails
|
||||
#
|
||||
# Everything happens in /tmp/forgejo-end-to-end
|
||||
#
|
||||
|
||||
SELF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
SELF="${BASH_SOURCE[0]}"
|
||||
source $SELF_DIR/lib/lib.sh
|
||||
|
||||
source $SELF_DIR/actions/actions.sh
|
||||
source $SELF_DIR/forgejo/fixtures.sh
|
||||
source $SELF_DIR/storage/storage.sh
|
||||
source $SELF_DIR/upgrade/upgrade.sh
|
||||
source $SELF_DIR/packages/packages.sh
|
||||
|
||||
"$@"
|
32
forgejo/build.sh
Executable file
32
forgejo/build.sh
Executable file
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2024 The Forgejo Authors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
set -ex
|
||||
|
||||
SELF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
version=$1
|
||||
DIR=$2
|
||||
|
||||
v=$(echo $version | sed -E -e 's/([0-9]+\.[0-9]+).*/\1/')
|
||||
read url ref semver < $SELF_DIR/sources/$v
|
||||
|
||||
rm -fr $DIR/src
|
||||
if [[ "$ref" =~ ^refs/ ]] ; then
|
||||
git clone --depth 1 $url $DIR/src
|
||||
cd $DIR/src
|
||||
git fetch origin +$ref:$ref
|
||||
git checkout -b $v $ref
|
||||
else
|
||||
git clone --depth 1 -b $ref $url $DIR/src
|
||||
cd $DIR/src
|
||||
fi
|
||||
export TAGS="bindata sqlite sqlite_unlock_notify"
|
||||
make deps-backend backend
|
||||
#
|
||||
# use the gitea target here so that branches that do not contain the commit that adds
|
||||
# the `forgejo` target to the Makefile can build successfully
|
||||
#
|
||||
make VERSION=v$version GITEA_VERSION=v$version FORGEJO_VERSION=$semver generate gitea
|
||||
mv gitea $DIR/forgejo-$version
|
|
@ -1,6 +0,0 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
|
||||
FIXTURES_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
source $FIXTURES_DIR/fixtures/storage.sh
|
||||
source $FIXTURES_DIR/fixtures/doctor.sh
|
|
@ -1,7 +0,0 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
|
||||
function doctor_run() {
|
||||
local version=$1
|
||||
|
||||
$DIR/forgejocli doctor check --all # --log-file -
|
||||
}
|
1
forgejo/sources/1.20
Normal file
1
forgejo/sources/1.20
Normal file
|
@ -0,0 +1 @@
|
|||
https://codeberg.org/forgejo/forgejo v1.20/forgejo 5.0.0+0-gitea-1.20.0
|
1
forgejo/sources/1.21
Normal file
1
forgejo/sources/1.21
Normal file
|
@ -0,0 +1 @@
|
|||
https://codeberg.org/forgejo/forgejo v1.21/forgejo 6.0.0+0-gitea-1.21.0
|
|
@ -1 +1 @@
|
|||
https://codeberg.org/forgejo/forgejo v7.0/forgejo 7.0.0+gitea-1.22.0
|
||||
https://codeberg.org/forgejo/forgejo forgejo 7.0.0+gitea-1.22.0
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
https://codeberg.org/forgejo/forgejo forgejo 8.0.0+gitea-1.22.0
|
|
@ -3,7 +3,6 @@ WORK_PATH = ${WORK_PATH}
|
|||
|
||||
[server]
|
||||
APP_DATA_PATH = ${WORK_PATH}/data
|
||||
DOMAIN = ${IP}
|
||||
HTTP_PORT = 3000
|
||||
SSH_LISTEN_PORT = 2222
|
||||
LFS_START_SERVER = true
|
|
@ -1,3 +1,4 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
#ONEPIXEL="iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg=="
|
||||
|
@ -7,36 +8,15 @@
|
|||
#
|
||||
ONEPIXEL="iVBORw0KGgoAAAANSUhEUgAAASIAAAEiCAYAAABdvt+2AAADrElEQVR4nOzUMRHAMADEsL9eeQd6AsOLhMCT/7udAYS+OgDAiICcEQE5IwJyRgTkjAjIGRGQMyIgZ0RAzoiAnBEBOSMCckYE5IwIyBkRkDMiIGdEQM6IgJwRATkjAnJGBOSMCMgZEZAzIiBnREDOiICcEQE5IwJyRgTkjAjIGRGQMyIgZ0RAzoiAnBEBOSMCckYE5IwIyBkRkDMiIGdEQM6IgJwRATkjAnJGBOSMCMgZEZAzIiBnREDOiICcEQE5IwJyRgTkjAjIGRGQMyIgZ0RAzoiAnBEBOSMCckYE5IwIyBkRkDMiIGdEQM6IgJwRATkjAnJGBOSMCMgZEZAzIiBnREDOiICcEQE5IwJyRgTkjAjIGRGQMyIgZ0RAzoiAnBEBOSMCckYE5IwIyBkRkDMiIGdEQM6IgJwRATkjAnJGBOSMCMgZEZAzIiBnREDOiICcEQE5IwJyRgTkjAjIGRGQMyIgZ0RAzoiAnBEBOSMCckYE5IwIyBkRkDMiIGdEQM6IgJwRATkjAnJGBOSMCMgZEZAzIiBnREDOiICcEQE5IwJyRgTkjAjIGRGQMyIgZ0RAzoiAnBEBOSMCckYE5IwIyBkRkDMiIGdEQM6IgJwRATkjAnJGBOSMCMgZEZAzIiBnREDOiICcEQE5IwJyRgTkjAjIGRGQMyIgZ0RAzoiAnBEBOSMCckYE5IwIyBkRkDMiIGdEQM6IgJwRATkjAnJGBOSMCMgZEZAzIiBnREDOiICcEQE5IwJyRgTkjAjIGRGQMyIgZ0RAzoiAnBEBOSMCckYE5IwIyBkRkDMiIGdEQM6IgJwRATkjAnJGBOSMCMgZEZAzIiBnREDOiICcEQE5IwJyRgTkjAjIGRGQMyIgZ0RAzoiAnBEBOSMCckYE5IwIyBkRkDMiIGdEQM6IgJwRATkjAnJGBOSMCMgZEZAzIiBnREDOiICcEQE5IwJyRgTkjAjIGRGQMyIgZ0RAzoiAnBEBOSMCckYE5IwIyBkRkDMiIGdEQM6IgJwRATkjAnJGBOSMCMgZEZAzIiBnREDOiICcEQE5IwJyRgTkjAjIGRGQMyIgZ0RAzoiAnBEBOSMCckYE5IwIyBkRkDMiIGdEQM6IgJwRATkjAnJGBOSMCMgZEZAzIiBnREDOiICcEQE5IwJyRgTkjAjIGRGQMyIgZ0RAzoiAnBEBOSMCckYE5IwIyBkRkDMiIGdEQM6IgJwRATkjAnJGBOSMCMgZEZAzIiBnREDuBQAA//+4jAPFe1H1tgAAAABJRU5ErkJggg=="
|
||||
|
||||
STORAGE_FUN="attachments avatars lfs packages repo_archive repo_avatars"
|
||||
: ${FORGEJO_REPO:=fixture}
|
||||
|
||||
function fixture_get_paths_s3() {
|
||||
local path=$1
|
||||
|
||||
(
|
||||
mc ls --quiet --recursive testS3/$path | sed -e "s|.* |$path/|"
|
||||
echo -n $path/
|
||||
mc ls --quiet --recursive testS3/$path | sed -e 's/.* //'
|
||||
) > $DIR/path
|
||||
}
|
||||
|
||||
function fixture_content_search_s3() {
|
||||
local path="$1"
|
||||
local expected="$2"
|
||||
|
||||
fixture_get_paths_s3 $path
|
||||
if test $(wc -l < $DIR/path) -lt 1 ; then
|
||||
echo expected at least one but got "'$(cat $DIR/path)'"
|
||||
return 1
|
||||
fi
|
||||
for filename in $(cat $DIR/path) ; do
|
||||
local content=$(mc cat testS3/$filename | base64 -w0)
|
||||
if test "$content" = "$expected" ; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
echo nothing in $path found with the expected content "$expected"
|
||||
return 1
|
||||
}
|
||||
|
||||
function fixture_get_paths_local() {
|
||||
local path=$1
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
@ -84,18 +64,6 @@ function fixture_lfs_create() {
|
|||
)
|
||||
}
|
||||
|
||||
function fixture_lfs_assert() {
|
||||
local d=$(mktemp -d)
|
||||
(
|
||||
git clone http://${FORGEJO_USER}:${FORGEJO_PASSWORD}@${HOST_PORT}/${FORGEJO_USER}/${FORGEJO_REPO} $d/${FORGEJO_REPO}
|
||||
cd $d/${FORGEJO_REPO}
|
||||
rm file.txt
|
||||
git-lfs checkout file.txt
|
||||
test -f file.txt
|
||||
)
|
||||
rm -fr $d
|
||||
}
|
||||
|
||||
function fixture_lfs_assert_s3() {
|
||||
local content=$(mc cat testS3/forgejo/lfs/d6/1e/5fa787e50330288923bd0c9866b44643925965144262288447cf52f9f9b7)
|
||||
test "$content" = CONTENT
|
||||
|
@ -111,8 +79,8 @@ function fixture_lfs_assert_local() {
|
|||
|
||||
function fixture_packages_create() {
|
||||
echo PACKAGE_CONTENT > $DIR/fixture/package
|
||||
forgejo-curl.sh api_json -X DELETE http://${HOST_PORT}/api/packages/${FORGEJO_USER}/generic/test_package/1.0.0/file.txt || true
|
||||
forgejo-curl.sh api_json --upload-file $DIR/fixture/package http://${HOST_PORT}/api/packages/${FORGEJO_USER}/generic/test_package/1.0.0/file.txt
|
||||
$work_path/forgejo-api -X DELETE http://${HOST_PORT}/api/packages/${FORGEJO_USER}/generic/test_package/1.0.0/file.txt || true
|
||||
$work_path/forgejo-api --upload-file $DIR/fixture/package http://${HOST_PORT}/api/packages/${FORGEJO_USER}/generic/test_package/1.0.0/file.txt
|
||||
}
|
||||
|
||||
function fixture_packages_assert_s3() {
|
||||
|
@ -129,11 +97,13 @@ function fixture_packages_assert_local() {
|
|||
|
||||
function fixture_avatars_create() {
|
||||
echo -n $ONEPIXEL | base64 --decode > $DIR/avatar.png
|
||||
forgejo-curl.sh web --form avatar=@$DIR/avatar.png http://${HOST_PORT}/user/settings/avatar
|
||||
$work_path/forgejo-client --form avatar=@$DIR/avatar.png http://${HOST_PORT}/user/settings/avatar
|
||||
}
|
||||
|
||||
function fixture_avatars_assert_s3() {
|
||||
fixture_content_search_s3 forgejo/avatars "$ONEPIXEL"
|
||||
local filename=$(fixture_get_one_path s3 forgejo/avatars)
|
||||
local content=$(mc cat testS3/$filename | base64 -w0)
|
||||
test "$content" = "$ONEPIXEL"
|
||||
}
|
||||
|
||||
function fixture_avatars_assert_local() {
|
||||
|
@ -146,9 +116,9 @@ function fixture_avatars_assert_local() {
|
|||
|
||||
function fixture_repo_avatars_create() {
|
||||
echo -n $ONEPIXEL | base64 --decode > $DIR/repo-avatar.png
|
||||
forgejo-curl.sh web --form avatar=@$DIR/repo-avatar.png http://${HOST_PORT}/${FORGEJO_USER}/${FORGEJO_REPO}/settings/avatar
|
||||
$work_path/forgejo-client --form avatar=@$DIR/repo-avatar.png http://${HOST_PORT}/${FORGEJO_USER}/${FORGEJO_REPO}/settings/avatar
|
||||
# v1.21 only
|
||||
#forgejo-curl.sh api_json -X POST --data-raw '{"body":"'$avatar'"}' http://${HOST_PORT}/api/v1/repos/${FORGEJO_USER}/${FORGEJO_REPO}/avatar
|
||||
#$work_path/forgejo-api -X POST --data-raw '{"body":"'$avatar'"}' http://${HOST_PORT}/api/v1/repos/${FORGEJO_USER}/${FORGEJO_REPO}/avatar
|
||||
}
|
||||
|
||||
function fixture_repo_avatars_assert_s3() {
|
||||
|
@ -167,17 +137,17 @@ function fixture_repo_avatars_assert_local() {
|
|||
|
||||
function fixture_attachments_create_1_18() {
|
||||
echo -n $ONEPIXEL | base64 --decode > $DIR/attachment.png
|
||||
forgejo-curl.sh web --trace-ascii - --form file=@$DIR/attachment.png http://${HOST_PORT}/${FORGEJO_USER}/${FORGEJO_REPO}/issues/attachments
|
||||
$work_path/forgejo-client --trace-ascii - --form file=@$DIR/attachment.png http://${HOST_PORT}/${FORGEJO_USER}/${FORGEJO_REPO}/issues/attachments
|
||||
}
|
||||
|
||||
function fixture_attachments_create() {
|
||||
if forgejo-curl.sh api_json http://${HOST_PORT}/api/v1/version | grep --quiet --fixed-strings 1.18. ; then
|
||||
if $work_path/forgejo-api http://${HOST_PORT}/api/v1/version | grep --quiet --fixed-strings 1.18. ; then
|
||||
fixture_attachments_create_1_18
|
||||
return
|
||||
fi
|
||||
id=$(forgejo-curl.sh api_json --data-raw '{"title":"TITLE"}' http://${HOST_PORT}/api/v1/repos/${FORGEJO_USER}/${FORGEJO_REPO}/issues | jq .id)
|
||||
id=$($work_path/forgejo-api --data-raw '{"title":"TITLE"}' http://${HOST_PORT}/api/v1/repos/${FORGEJO_USER}/${FORGEJO_REPO}/issues | jq .id)
|
||||
echo -n $ONEPIXEL | base64 --decode > $DIR/attachment.png
|
||||
forgejo-curl.sh api --form name=attachment.png --form attachment=@$DIR/attachment.png http://${HOST_PORT}/api/v1/repos/${FORGEJO_USER}/${FORGEJO_REPO}/issues/$id/assets
|
||||
$work_path/forgejo-client -H @$DIR/forgejo-work-path/forgejo-header --form name=attachment.png --form attachment=@$DIR/attachment.png http://${HOST_PORT}/api/v1/repos/${FORGEJO_USER}/${FORGEJO_REPO}/issues/$id/assets
|
||||
}
|
||||
|
||||
function fixture_attachments_assert_s3() {
|
||||
|
@ -215,9 +185,3 @@ function fixture_create() {
|
|||
fixture_${fun}_create
|
||||
done
|
||||
}
|
||||
|
||||
function fixture_assert() {
|
||||
for fun in lfs ; do
|
||||
fixture_${fun}_assert
|
||||
done
|
||||
}
|
|
@ -3,7 +3,6 @@ WORK_PATH = ${WORK_PATH}
|
|||
|
||||
[server]
|
||||
APP_DATA_PATH = ${WORK_PATH}/data
|
||||
DOMAIN = ${IP}
|
||||
HTTP_PORT = 3000
|
||||
SSH_LISTEN_PORT = 2222
|
||||
LFS_START_SERVER = true
|
|
@ -3,7 +3,6 @@ WORK_PATH = ${WORK_PATH}
|
|||
|
||||
[server]
|
||||
APP_DATA_PATH = ${WORK_PATH}/data
|
||||
DOMAIN = ${IP}
|
||||
HTTP_PORT = 3000
|
||||
SSH_LISTEN_PORT = 2222
|
||||
LFS_START_SERVER = true
|
|
@ -3,7 +3,6 @@ WORK_PATH = ${WORK_PATH}
|
|||
|
||||
[server]
|
||||
APP_DATA_PATH = ${WORK_PATH}/elsewhere
|
||||
DOMAIN = ${IP}
|
||||
HTTP_PORT = 3000
|
||||
SSH_LISTEN_PORT = 2222
|
||||
LFS_START_SERVER = true
|
|
@ -3,7 +3,6 @@ WORK_PATH = ${WORK_PATH}
|
|||
|
||||
[server]
|
||||
APP_DATA_PATH = ${WORK_PATH}/elsewhere
|
||||
DOMAIN = ${IP}
|
||||
HTTP_PORT = 3000
|
||||
SSH_LISTEN_PORT = 2222
|
||||
LFS_START_SERVER = true
|
|
@ -3,7 +3,6 @@ WORK_PATH = ${WORK_PATH}
|
|||
|
||||
[server]
|
||||
APP_DATA_PATH = ${WORK_PATH}/elsewhere
|
||||
DOMAIN = ${IP}
|
||||
HTTP_PORT = 3000
|
||||
SSH_LISTEN_PORT = 2222
|
||||
LFS_START_SERVER = true
|
|
@ -3,7 +3,6 @@ WORK_PATH = ${WORK_PATH}
|
|||
|
||||
[server]
|
||||
APP_DATA_PATH = ${WORK_PATH}/data
|
||||
DOMAIN = ${IP}
|
||||
HTTP_PORT = 3000
|
||||
SSH_LISTEN_PORT = 2222
|
||||
LFS_START_SERVER = true
|
|
@ -3,7 +3,6 @@ WORK_PATH = ${WORK_PATH}
|
|||
|
||||
[server]
|
||||
APP_DATA_PATH = ${WORK_PATH}/elsewhere
|
||||
DOMAIN = ${IP}
|
||||
HTTP_PORT = 3000
|
||||
SSH_LISTEN_PORT = 2222
|
||||
LFS_START_SERVER = true
|
|
@ -3,7 +3,6 @@ WORK_PATH = ${WORK_PATH}
|
|||
|
||||
[server]
|
||||
APP_DATA_PATH = ${WORK_PATH}/elsewhere
|
||||
DOMAIN = ${IP}
|
||||
HTTP_PORT = 3000
|
||||
SSH_LISTEN_PORT = 2222
|
||||
LFS_START_SERVER = true
|
|
@ -3,7 +3,6 @@ WORK_PATH = ${WORK_PATH}
|
|||
|
||||
[server]
|
||||
APP_DATA_PATH = ${WORK_PATH}/data
|
||||
DOMAIN = ${IP}
|
||||
HTTP_PORT = 3000
|
||||
SSH_LISTEN_PORT = 2222
|
||||
LFS_START_SERVER = true
|
620
forgejo/upgrades/test-upgrade.sh
Executable file
620
forgejo/upgrades/test-upgrade.sh
Executable file
|
@ -0,0 +1,620 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
#
|
||||
# Debug loop from the source tree:
|
||||
#
|
||||
# ./.forgejo/upgrades/test-upgrade.sh dependencies
|
||||
# ./.forgejo/upgrades/test-upgrade.sh build_all
|
||||
# VERBOSE=true ./.forgejo/upgrades/test-upgrade.sh test_downgrade_1.20.2_fails
|
||||
#
|
||||
# Everything happens in /tmp/forgejo-upgrades
|
||||
#
|
||||
|
||||
PREFIX===============
|
||||
HOST_PORT=0.0.0.0:3000
|
||||
STORAGE_PATHS="attachments avatars lfs packages repo-archive repo-avatars"
|
||||
STORAGE_FUN="attachments avatars lfs packages repo_archive repo_avatars"
|
||||
DIR=/tmp/forgejo-upgrades
|
||||
if ${VERBOSE:-false} ; then
|
||||
set -ex
|
||||
PS4='${BASH_SOURCE[0]}:$LINENO: ${FUNCNAME[0]}: '
|
||||
else
|
||||
set -e
|
||||
fi
|
||||
SELF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
: ${FORGEJO_USER:=root}
|
||||
: ${FORGEJO_REPO:=fixture}
|
||||
: ${FORGEJO_PASSWORD:=admin1234}
|
||||
|
||||
source $SELF_DIR/fixtures.sh
|
||||
|
||||
function maybe_sudo() {
|
||||
if test $(id -u) != 0 ; then
|
||||
SUDO=sudo
|
||||
fi
|
||||
}
|
||||
|
||||
function log_info() {
|
||||
echo "$PREFIX $@"
|
||||
}
|
||||
|
||||
function dependencies() {
|
||||
maybe_sudo
|
||||
if ! which curl daemon jq git-lfs > /dev/null ; then
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
$SUDO apt-get update -qq
|
||||
$SUDO apt-get install -y -qq curl daemon git-lfs jq sqlite3 gettext-base
|
||||
fi
|
||||
|
||||
if ! test -f /usr/local/bin/mc || ! test -f /usr/local/bin/minio > /dev/null ; then
|
||||
$SUDO curl --fail -sS https://dl.min.io/client/mc/release/linux-amd64/mc -o /usr/local/bin/mc
|
||||
$SUDO curl --fail -sS https://dl.min.io/server/minio/release/linux-amd64/minio -o /usr/local/bin/minio
|
||||
fi
|
||||
if ! test -x /usr/local/bin/mc || ! test -x /usr/local/bin/minio > /dev/null ; then
|
||||
$SUDO chmod +x /usr/local/bin/mc
|
||||
$SUDO chmod +x /usr/local/bin/minio
|
||||
fi
|
||||
|
||||
if ! test -f /usr/local/bin/garage > /dev/null ; then
|
||||
$SUDO curl --fail -sS https://garagehq.deuxfleurs.fr/_releases/v0.8.2/x86_64-unknown-linux-musl/garage -o /usr/local/bin/garage
|
||||
fi
|
||||
if ! test -x /usr/local/bin/garage > /dev/null ; then
|
||||
$SUDO chmod +x /usr/local/bin/garage
|
||||
fi
|
||||
}
|
||||
|
||||
function build_all() {
|
||||
log_info 7.0.0-dev
|
||||
$SELF_DIR/../build.sh 7.0.0-dev $DIR
|
||||
}
|
||||
|
||||
function retry() {
|
||||
rm -f $DIR/wait-for.out
|
||||
success=false
|
||||
for delay in 1 1 5 5 15 ; do
|
||||
if "$@" >> $DIR/wait-for.out 2>&1 ; then
|
||||
success=true
|
||||
break
|
||||
fi
|
||||
cat $DIR/wait-for.out
|
||||
echo waiting $delay
|
||||
sleep $delay
|
||||
done
|
||||
if test $success = false ; then
|
||||
cat $DIR/wait-for.out
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function download() {
|
||||
local version=$1
|
||||
|
||||
if ! test -f $DIR/forgejo-$version ; then
|
||||
mkdir -p $DIR
|
||||
for owner in forgejo forgejo-experimental forgejo-integration ; do
|
||||
if wget -O $DIR/forgejo-$version --quiet https://codeberg.org/$owner/forgejo/releases/download/v$version/forgejo-$version-linux-amd64 ; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
chmod +x $DIR/forgejo-$version
|
||||
fi
|
||||
}
|
||||
|
||||
function cleanup_logs() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
rm -f $DIR/*.log
|
||||
rm -f $work_path/log/*.log
|
||||
}
|
||||
|
||||
function clobber() {
|
||||
rm -fr /tmp/forgejo-upgrades
|
||||
}
|
||||
|
||||
function start_forgejo() {
|
||||
local version=$1
|
||||
|
||||
download $version
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
daemon --chdir=$DIR --unsafe --env="TERM=$TERM" --env="HOME=$HOME" --env="PATH=$PATH" --pidfile=$DIR/forgejo-pid --errlog=$DIR/forgejo-err.log --output=$DIR/forgejo-out.log -- $DIR/forgejo-$version --config $work_path/app.ini --work-path $work_path
|
||||
if ! retry grep 'Starting server on' $work_path/log/forgejo.log ; then
|
||||
cat $DIR/*.log
|
||||
cat $work_path/log/*.log
|
||||
return 1
|
||||
fi
|
||||
create_user $version
|
||||
}
|
||||
|
||||
function start_minio() {
|
||||
mkdir -p $DIR/minio
|
||||
daemon --chdir=$DIR --unsafe \
|
||||
--env="PATH=$PATH" \
|
||||
--env=MINIO_ROOT_USER=123456 \
|
||||
--env=MINIO_ROOT_PASSWORD=12345678 \
|
||||
--env=MINIO_VOLUMES=$DIR/minio \
|
||||
--pidfile=$DIR/minio-pid --errlog=$DIR/minio-err.log --output=$DIR/minio-out.log -- /usr/local/bin/minio server
|
||||
retry mc alias set testS3 http://127.0.0.1:9000 123456 12345678
|
||||
}
|
||||
|
||||
function start_garage() {
|
||||
mkdir -p $DIR/garage/{data,meta}
|
||||
cat > $DIR/garage/garage.toml <<EOF
|
||||
metadata_dir = "$DIR/garage/meta"
|
||||
data_dir = "$DIR/garage/data"
|
||||
db_engine = "lmdb"
|
||||
|
||||
replication_mode = "none"
|
||||
|
||||
rpc_bind_addr = "127.0.0.1:3901"
|
||||
rpc_public_addr = "127.0.0.1:3901"
|
||||
rpc_secret = "$(openssl rand -hex 32)"
|
||||
|
||||
[s3_api]
|
||||
s3_region = "us-east-1"
|
||||
api_bind_addr = "127.0.0.1:9000"
|
||||
root_domain = ".s3.garage.localhost"
|
||||
|
||||
[s3_web]
|
||||
bind_addr = "127.0.0.1:3902"
|
||||
root_domain = ".web.garage.localhost"
|
||||
index = "index.html"
|
||||
|
||||
[k2v_api]
|
||||
api_bind_addr = "127.0.0.1:3904"
|
||||
|
||||
[admin]
|
||||
api_bind_addr = "127.0.0.1:3903"
|
||||
admin_token = "$(openssl rand -base64 32)"
|
||||
EOF
|
||||
|
||||
daemon --chdir=$DIR --unsafe \
|
||||
--env="PATH=$PATH" \
|
||||
--env=RUST_LOG=garage_api=debug \
|
||||
--pidfile=$DIR/garage-pid --errlog=$DIR/garage-err.log --output=$DIR/garage-out.log -- /usr/local/bin/garage -c $DIR/garage/garage.toml server
|
||||
|
||||
retry garage -c $DIR/garage/garage.toml status
|
||||
garage -c $DIR/garage/garage.toml layout assign -z dc1 -c 1 $(garage -c $DIR/garage/garage.toml status | tail -1 | grep -o '[0-9a-z]*' | head -1)
|
||||
ver=$(garage -c $DIR/garage/garage.toml layout show | grep -oP '(?<=Current cluster layout version: )\d+')
|
||||
garage -c $DIR/garage/garage.toml layout apply --version $((ver+1))
|
||||
garage -c $DIR/garage/garage.toml key info test || garage -c $DIR/garage/garage.toml key import -n test 123456 12345678
|
||||
garage -c $DIR/garage/garage.toml key allow --create-bucket test
|
||||
retry mc alias set testS3 http://127.0.0.1:9000 123456 12345678
|
||||
}
|
||||
|
||||
function start_s3() {
|
||||
local s3_backend=$1
|
||||
|
||||
start_$s3_backend
|
||||
}
|
||||
|
||||
function start() {
|
||||
local version=$1
|
||||
local s3_backend=${2:-minio}
|
||||
|
||||
start_s3 $s3_backend
|
||||
start_forgejo $version
|
||||
}
|
||||
|
||||
function create_user() {
|
||||
local version=$1
|
||||
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
if test -f $work_path/forgejo-token; then
|
||||
return
|
||||
fi
|
||||
|
||||
local cli="$DIR/forgejo-$version --config $work_path/app.ini --work-path $work_path"
|
||||
$cli admin user create --admin --username "$FORGEJO_USER" --password "$FORGEJO_PASSWORD" --email "$FORGEJO_USER@example.com"
|
||||
local scopes="--scopes all"
|
||||
if echo $version | grep --quiet 1.18. ; then
|
||||
scopes=""
|
||||
fi
|
||||
|
||||
#
|
||||
# forgejo-cli is to use with api/v1 enpoints
|
||||
#
|
||||
# tail -1 is because there are logs creating noise in the output in v1.19.4-0
|
||||
#
|
||||
$cli admin user generate-access-token -u $FORGEJO_USER --raw $scopes | tail -1 > $work_path/forgejo-token
|
||||
( echo -n 'Authorization: token ' ; cat $work_path/forgejo-token ) > $work_path/forgejo-header
|
||||
( echo "#!/bin/sh" ; echo 'curl -f -sS -H "Content-Type: application/json" -H @'$work_path/forgejo-header' "$@"' ) > $work_path/forgejo-api && chmod +x $work_path/forgejo-api
|
||||
$work_path/forgejo-api http://${HOST_PORT}/api/v1/version
|
||||
|
||||
#
|
||||
# forgejo-client is to use with web endpoints
|
||||
#
|
||||
#
|
||||
# login and obtain a CSRF, all stored in the cookie file
|
||||
#
|
||||
( echo "#!/bin/sh" ; echo 'curl --cookie-jar '$DIR/cookies' --cookie '$DIR/cookies' -f -sS "$@"' ) > $work_path/forgejo-client-update-cookies && chmod +x $work_path/forgejo-client-update-cookies
|
||||
$work_path/forgejo-client-update-cookies http://${HOST_PORT}/user/login -o /dev/null
|
||||
$work_path/forgejo-client-update-cookies --verbose -X POST --data user_name=${FORGEJO_USER} --data password=${FORGEJO_PASSWORD} http://${HOST_PORT}/user/login >& $DIR/login.html
|
||||
$work_path/forgejo-client-update-cookies http://${HOST_PORT}/user/login -o /dev/null
|
||||
local csrf=$(sed -n -e '/csrf/s/.*csrf\t//p' $DIR/cookies)
|
||||
#
|
||||
# use the cookie file but do not modify it
|
||||
#
|
||||
( echo "#!/bin/sh" ; echo 'curl --cookie '$DIR/cookies' -H "X-Csrf-Token: '$csrf'" -f -sS "$@"' ) > $work_path/forgejo-client && chmod +x $work_path/forgejo-client
|
||||
}
|
||||
|
||||
function stop_daemon() {
|
||||
local daemon=$1
|
||||
|
||||
if test -f $DIR/$daemon-pid ; then
|
||||
local pid=$(cat $DIR/$daemon-pid)
|
||||
kill -TERM $pid
|
||||
pidwait $pid || true
|
||||
for delay in 1 1 2 2 5 5 ; do
|
||||
if ! test -f $DIR/$daemon-pid ; then
|
||||
break
|
||||
fi
|
||||
sleep $delay
|
||||
done
|
||||
! test -f $DIR/$daemon-pid
|
||||
fi
|
||||
}
|
||||
|
||||
function stop() {
|
||||
stop_daemon forgejo
|
||||
stop_daemon minio
|
||||
stop_daemon garage
|
||||
|
||||
cleanup_logs
|
||||
}
|
||||
|
||||
function reset_forgejo() {
|
||||
local config=$1
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
rm -fr $work_path
|
||||
mkdir -p $work_path
|
||||
WORK_PATH=$work_path envsubst < $SELF_DIR/$config-app.ini > $work_path/app.ini
|
||||
}
|
||||
|
||||
function reset_minio() {
|
||||
rm -fr $DIR/minio
|
||||
}
|
||||
|
||||
function reset_garage() {
|
||||
rm -fr $DIR/garage
|
||||
}
|
||||
|
||||
function reset() {
|
||||
local config=$1
|
||||
reset_forgejo $config
|
||||
reset_minio
|
||||
reset_garage
|
||||
}
|
||||
|
||||
function verify_storage() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
test -d $work_path/data/$path
|
||||
done
|
||||
}
|
||||
|
||||
function cleanup_storage() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
rm -fr $work_path/data/$path
|
||||
done
|
||||
}
|
||||
|
||||
function test_downgrade_1.20.2_fails() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
log_info "See also https://codeberg.org/forgejo/forgejo/pulls/1225"
|
||||
|
||||
log_info "downgrading from 1.20.3-0 to 1.20.2-0 fails"
|
||||
stop
|
||||
reset default
|
||||
start 1.20.3-0
|
||||
stop
|
||||
download 1.20.2-0
|
||||
timeout 60 $DIR/forgejo-1.20.2-0 --config $work_path/app.ini --work-path $work_path || true
|
||||
if ! grep --fixed-strings --quiet 'use the newer database' $work_path/log/forgejo.log ; then
|
||||
cat $work_path/log/forgejo.log
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function test_bug_storage_merged() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
log_info "See also https://codeberg.org/forgejo/forgejo/pulls/1225"
|
||||
|
||||
log_info "using < 1.20.3-0 and [storage].PATH merge all storage"
|
||||
for version in 1.18.5-0 1.19.4-0 1.20.2-0 ; do
|
||||
stop
|
||||
reset merged
|
||||
start $version
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
! test -d $work_path/data/$path
|
||||
done
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
! test -d $work_path/merged/$path
|
||||
done
|
||||
test -d $work_path/merged
|
||||
done
|
||||
stop
|
||||
|
||||
log_info "upgrading from 1.20.2-0 with [storage].PATH fails"
|
||||
download 1.20.3-0
|
||||
timeout 60 $DIR/forgejo-1.20.3-0 --config $work_path/app.ini --work-path $work_path || true
|
||||
if ! grep --fixed-strings --quiet '[storage].PATH is set and may create storage issues' $work_path/log/forgejo.log ; then
|
||||
cat $work_path/log/forgejo.log
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function test_bug_storage_relative_path() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
log_info "using < 1.20.3-0 legacy [server].XXXX and [picture].XXXX are relative to WORK_PATH"
|
||||
for version in 1.18.5-0 1.19.4-0 1.20.2-0 ; do
|
||||
stop
|
||||
reset legagy-relative
|
||||
start $version
|
||||
test -d $work_path/relative-lfs
|
||||
test -d $work_path/relative-avatars
|
||||
test -d $work_path/relative-repo-avatars
|
||||
done
|
||||
|
||||
log_info "using >= 1.20.3-0 legacy [server].XXXX and [picture].XXXX are relative to APP_DATA_PATH"
|
||||
for version in 1.20.3-0 1.21.0-5-rc2 ; do
|
||||
stop
|
||||
reset legagy-relative
|
||||
start $version
|
||||
test -d $work_path/data/relative-lfs
|
||||
test -d $work_path/data/relative-avatars
|
||||
test -d $work_path/data/relative-repo-avatars
|
||||
done
|
||||
|
||||
log_info "using >= 1.20.3-0 relative [storage.XXXX].PATHS are relative to APP_DATA_PATH"
|
||||
for version in 1.20.3-0 1.21.0-5-rc2 ; do
|
||||
stop
|
||||
reset storage-relative
|
||||
start $version
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
test -d $work_path/data/relative-$path
|
||||
done
|
||||
done
|
||||
|
||||
log_info "using 1.20.[12]-0 relative [storage.XXXX].PATHS are inconsistent"
|
||||
for version in 1.20.2-0 ; do
|
||||
stop
|
||||
reset storage-relative
|
||||
start $version
|
||||
test -d $work_path/data/packages
|
||||
test -d $work_path/relative-repo-archive
|
||||
test -d $work_path/relative-attachments
|
||||
test -d $work_path/relative-lfs
|
||||
test -d $work_path/data/avatars
|
||||
test -d $work_path/data/repo-avatars
|
||||
done
|
||||
|
||||
log_info "using < 1.20 relative [storage.XXXX].PATHS are inconsistent"
|
||||
for version in 1.18.5-0 1.19.4-0 ; do
|
||||
stop
|
||||
reset storage-relative
|
||||
start $version
|
||||
test -d $work_path/relative-packages
|
||||
test -d $work_path/relative-repo-archive
|
||||
test -d $work_path/relative-attachments
|
||||
test -d $work_path/data/lfs
|
||||
test -d $work_path/data/avatars
|
||||
test -d $work_path/data/repo-avatars
|
||||
done
|
||||
|
||||
log_info "using < 1.20.3-0 relative [XXXX].PATHS are relative to WORK_PATH"
|
||||
for version in 1.18.5-0 1.19.4-0 1.20.2-0 ; do
|
||||
stop
|
||||
reset relative
|
||||
start $version
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
test -d $work_path/relative-$path
|
||||
done
|
||||
done
|
||||
|
||||
log_info "using >= 1.20.3-0 relative [XXXX].PATHS are relative to APP_DATA_PATH"
|
||||
for version in 1.20.3-0 1.21.0-5-rc2 ; do
|
||||
stop
|
||||
reset relative
|
||||
start $version
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
test -d $work_path/data/relative-$path
|
||||
done
|
||||
done
|
||||
|
||||
stop
|
||||
}
|
||||
|
||||
function test_bug_storage_s3_misplace() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
local s3_backend=${2:-minio}
|
||||
|
||||
log_info "See also https://codeberg.org/forgejo/forgejo/issues/1338"
|
||||
|
||||
for version in 1.20.2-0 1.20.3-0 ; do
|
||||
log_info "Forgejo $version & $s3_backend"
|
||||
stop
|
||||
reset misplace-s3
|
||||
start $version $s3_backend
|
||||
fixture_create
|
||||
for fun in ${STORAGE_FUN} ; do
|
||||
fixture_${fun}_assert_s3
|
||||
done
|
||||
done
|
||||
|
||||
for version in 1.18.5-0 1.19.4-0 ; do
|
||||
log_info "Forgejo $version & $s3_backend"
|
||||
stop
|
||||
reset misplace-s3
|
||||
start $version $s3_backend
|
||||
fixture_create
|
||||
#
|
||||
# some storage are in S3
|
||||
#
|
||||
fixture_attachments_assert_s3
|
||||
fixture_lfs_assert_s3
|
||||
#
|
||||
# others are in local
|
||||
#
|
||||
fixture_repo_archive_assert_local elsewhere/repo-archive
|
||||
fixture_avatars_assert_local elsewhere/avatars
|
||||
fixture_packages_assert_local elsewhere/packages
|
||||
fixture_repo_avatars_assert_local elsewhere/repo-avatars
|
||||
done
|
||||
}
|
||||
|
||||
function test_storage_stable_s3() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
local s3_backend=${1:-minio}
|
||||
|
||||
log_info "See also https://codeberg.org/forgejo/forgejo/issues/1338"
|
||||
|
||||
for version in 1.18.5-0 1.19.4-0 1.20.2-0 1.20.3-0 ; do
|
||||
log_info "Forgejo $version & $s3_backend"
|
||||
stop
|
||||
reset stable-s3
|
||||
start $version $s3_backend
|
||||
fixture_create
|
||||
for fun in ${STORAGE_FUN} ; do
|
||||
fixture_${fun}_assert_s3
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
function test_bug_storage_misplace() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
log_info "See also https://codeberg.org/forgejo/forgejo/pulls/1225"
|
||||
|
||||
log_info "using < 1.20 and conflicting sections misplace storage"
|
||||
for version in 1.18.5-0 1.19.4-0 ; do
|
||||
stop
|
||||
reset misplace
|
||||
start $version
|
||||
#
|
||||
# some storage are where they should be
|
||||
#
|
||||
test -d $work_path/data/packages
|
||||
test -d $work_path/data/repo-archive
|
||||
test -d $work_path/data/attachments
|
||||
#
|
||||
# others are under APP_DATA_PATH
|
||||
#
|
||||
test -d $work_path/elsewhere/lfs
|
||||
test -d $work_path/elsewhere/avatars
|
||||
test -d $work_path/elsewhere/repo-avatars
|
||||
done
|
||||
|
||||
log_info "using < 1.20.[12]-0 and conflicting sections ignores [storage.*]"
|
||||
for version in 1.20.2-0 ; do
|
||||
stop
|
||||
reset misplace
|
||||
start $version
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
test -d $work_path/elsewhere/$path
|
||||
done
|
||||
done
|
||||
|
||||
stop
|
||||
|
||||
log_info "upgrading from 1.20.2-0 with conflicting sections fails"
|
||||
download 1.20.3-0
|
||||
timeout 60 $DIR/forgejo-1.20.3-0 --config $work_path/app.ini --work-path $work_path || true
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
if ! grep --fixed-strings --quiet "[storage.$path] may conflict" $work_path/log/forgejo.log ; then
|
||||
cat $work_path/log/forgejo.log
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function test_successful_upgrades() {
|
||||
for config in default specific ; do
|
||||
log_info "using $config app.ini"
|
||||
reset $config
|
||||
|
||||
for version in 1.18.5-0 1.19.4-0 1.20.2-0 1.20.3-0 1.21.0-5-rc2 ; do
|
||||
log_info "run $version"
|
||||
cleanup_storage
|
||||
start $version
|
||||
verify_storage
|
||||
stop
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
function test_forgejo_database_version() {
|
||||
local expected_version=$1
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
actual_version=$(sqlite3 $work_path/forgejo.db "select version from forgejo_version")
|
||||
test "$expected_version" = "$actual_version"
|
||||
}
|
||||
|
||||
function test_forgejo_database_v3_upgrades_list_table() {
|
||||
local table=$1
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
sqlite3 $work_path/forgejo.db ".tables $table" .exit | grep --quiet $table
|
||||
}
|
||||
|
||||
function test_forgejo_database_v3_upgrades() {
|
||||
local table=forgejo_auth_token
|
||||
|
||||
stop
|
||||
|
||||
reset default
|
||||
log_info "run 1.20.4-1"
|
||||
start 1.20.4-1
|
||||
stop
|
||||
! test_forgejo_database_v3_upgrades_list_table $table
|
||||
test_forgejo_database_version 2
|
||||
|
||||
log_info "run 1.20.5-0"
|
||||
start 1.20.5-0
|
||||
stop
|
||||
test_forgejo_database_v3_upgrades_list_table $table
|
||||
test_forgejo_database_version 3
|
||||
}
|
||||
|
||||
function run() {
|
||||
local fun=$1
|
||||
shift
|
||||
|
||||
echo Start running $fun
|
||||
mkdir -p $DIR
|
||||
> $DIR/$fun.out
|
||||
tail --follow $DIR/$fun.out | sed --unbuffered -n -e "/^$PREFIX/s/^$PREFIX //p" &
|
||||
pid=$!
|
||||
if ! VERBOSE=true ${BASH_SOURCE[0]} $fun "$@" >& $DIR/$fun.out ; then
|
||||
kill $pid
|
||||
cat $DIR/$fun.out
|
||||
echo Failure running $fun
|
||||
return 1
|
||||
fi
|
||||
kill $pid
|
||||
echo Success running $fun
|
||||
}
|
||||
|
||||
function test_upgrades() {
|
||||
run stop
|
||||
run dependencies
|
||||
run build_all
|
||||
run test_successful_upgrades
|
||||
run test_bug_storage_misplace
|
||||
run test_bug_storage_merged
|
||||
run test_downgrade_1.20.2_fails
|
||||
run test_bug_storage_s3_misplace
|
||||
run test_storage_stable_s3 minio
|
||||
run test_storage_stable_s3 garage
|
||||
run test_forgejo_database_v3_upgrades
|
||||
}
|
||||
|
||||
"$@"
|
|
@ -1 +0,0 @@
|
|||
forgejo forgejo-experimental forgejo-integration
|
34
lib/build.sh
34
lib/build.sh
|
@ -1,34 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2024 The Forgejo Authors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
set -ex
|
||||
|
||||
SELF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
version=$1
|
||||
dir_binaries=$2
|
||||
|
||||
v=$(echo $version | sed -E -e 's/^([0-9]+\.[0-9]+).*/\1/')
|
||||
src=$dir_binaries/src-$v
|
||||
read url ref semver < $SELF_DIR/../forgejo/sources/$v
|
||||
|
||||
if ! test -d $src ; then
|
||||
mkdir -p $src
|
||||
cd $src
|
||||
git init
|
||||
git remote add origin $url
|
||||
else
|
||||
cd $src
|
||||
fi
|
||||
|
||||
if ! [[ "$ref" =~ ^refs/ ]] ; then
|
||||
ref=refs/heads/$ref
|
||||
fi
|
||||
git fetch --update-head-ok origin +$ref:$ref
|
||||
git switch --force-create $v $ref
|
||||
|
||||
export TAGS="bindata sqlite sqlite_unlock_notify" FORGEJO_VERSION=$semver
|
||||
make deps-backend backend
|
||||
make generate forgejo
|
||||
cp -a forgejo $dir_binaries/forgejo-$v-dev
|
311
lib/lib.sh
311
lib/lib.sh
|
@ -2,15 +2,7 @@
|
|||
# Copyright 2024 The Forgejo Authors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
LIB_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
if ${VERBOSE:-false} ; then
|
||||
set -ex
|
||||
PS4='${BASH_SOURCE[0]}:$LINENO: ${FUNCNAME[0]}: '
|
||||
else
|
||||
set -e
|
||||
fi
|
||||
|
||||
set -o pipefail
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
@ -19,305 +11,4 @@ if test $(id -u) != 0 ; then
|
|||
SUDO=sudo
|
||||
fi
|
||||
|
||||
IP=$(hostname -I | cut -f1 -d' ')
|
||||
|
||||
#
|
||||
# Forgejo releases for which a branch exists (7.0/forgejo etc.)
|
||||
#
|
||||
RELEASE_NUMBERS="7.0 8.0"
|
||||
|
||||
PREFIX===============
|
||||
HOST_PORT=$IP:3000
|
||||
export DIR=/tmp/forgejo-end-to-end
|
||||
DIR_BINARIES=/srv/forgejo-binaries
|
||||
export DOT_FORGEJO_CURL=$DIR/forgejo-curl
|
||||
export DOT=$DOT_FORGEJO_CURL # for backward compatibility with forgejo-curl.sh 1.0.0
|
||||
: ${FORGEJO_USER:=root}
|
||||
: ${FORGEJO_PASSWORD:=admin1234}
|
||||
RELEASE_NUMBERS_AND_DEV="$(for r in $RELEASE_NUMBERS ; do echo -n "$r $r-dev " ; done)"
|
||||
ORGANIZATIONS=$(cat $LIB_DIR/ORGANIZATIONS)
|
||||
|
||||
function log_info() {
|
||||
echo "$PREFIX $@"
|
||||
}
|
||||
|
||||
function dependencies() {
|
||||
|
||||
if ! test -f /usr/local/bin/forgejo-curl.sh ; then
|
||||
$SUDO curl --fail -sS https://code.forgejo.org/forgejo/forgejo-curl/raw/branch/main/forgejo-curl.sh -o /usr/local/bin/forgejo-curl.sh
|
||||
$SUDO chmod +x /usr/local/bin/forgejo-curl.sh
|
||||
fi
|
||||
|
||||
if ! which make curl daemon git-lfs jq sqlite3 > /dev/null ; then
|
||||
$SUDO apt-get update -qq
|
||||
$SUDO apt-get install -y -qq make curl daemon git-lfs jq sqlite3 gettext-base
|
||||
fi
|
||||
|
||||
if ! test -f /usr/local/bin/mc || ! test -f /usr/local/bin/minio ; then
|
||||
$SUDO curl --fail -sS https://dl.min.io/client/mc/release/linux-amd64/mc -o /usr/local/bin/mc
|
||||
$SUDO curl --fail -sS https://dl.min.io/server/minio/release/linux-amd64/minio -o /usr/local/bin/minio
|
||||
fi
|
||||
if ! test -x /usr/local/bin/mc || ! test -x /usr/local/bin/minio ; then
|
||||
$SUDO chmod +x /usr/local/bin/mc
|
||||
$SUDO chmod +x /usr/local/bin/minio
|
||||
fi
|
||||
|
||||
if ! test -f /usr/local/bin/garage > /dev/null ; then
|
||||
$SUDO curl --fail -sS https://garagehq.deuxfleurs.fr/_releases/v0.8.2/x86_64-unknown-linux-musl/garage -o /usr/local/bin/garage
|
||||
fi
|
||||
if ! test -x /usr/local/bin/garage > /dev/null ; then
|
||||
$SUDO chmod +x /usr/local/bin/garage
|
||||
fi
|
||||
}
|
||||
|
||||
function build_all() {
|
||||
for dev in $RELEASE_NUMBERS ; do
|
||||
local forgejo=$DIR_BINARIES/forgejo-$dev-dev
|
||||
if test -f $forgejo ; then
|
||||
log_info $dev already exists
|
||||
else
|
||||
$LIB_DIR/build.sh $dev $DIR_BINARIES
|
||||
log_info $dev built from sources
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function retry() {
|
||||
rm -f $DIR/wait-for.out
|
||||
success=false
|
||||
for delay in 1 1 5 5 15 ; do
|
||||
if "$@" >> $DIR/wait-for.out 2>&1 ; then
|
||||
success=true
|
||||
break
|
||||
fi
|
||||
cat $DIR/wait-for.out
|
||||
echo waiting $delay
|
||||
sleep $delay
|
||||
done
|
||||
if test $success = false ; then
|
||||
cat $DIR/wait-for.out
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function full_version() {
|
||||
local version=$1
|
||||
local owner=$2
|
||||
|
||||
if [[ $version =~ ^[0-9]+\.[0-9]+$ ]] ; then
|
||||
full_version=$(curl -sS https://codeberg.org/api/v1/repos/$owner/forgejo/releases | jq -r '.[] | .tag_name | select(startswith("v'$version'"))' | sort -r | head -1)
|
||||
echo ${full_version#v}
|
||||
else
|
||||
echo $version
|
||||
fi
|
||||
}
|
||||
|
||||
function download() {
|
||||
local version=$1
|
||||
|
||||
if ! test -f $DIR_BINARIES/forgejo-$version ; then
|
||||
mkdir -p $DIR_BINARIES
|
||||
for owner in $ORGANIZATIONS ; do
|
||||
full_version=$(full_version $version $owner)
|
||||
if test "$full_version" = "" ; then
|
||||
continue
|
||||
fi
|
||||
if wget -O $DIR_BINARIES/forgejo-$version --quiet https://codeberg.org/$owner/forgejo/releases/download/v$full_version/forgejo-$full_version-linux-amd64 ; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -s $DIR_BINARIES/forgejo-$version ; then
|
||||
if test "$version" != "$full_version" ; then
|
||||
log_info "downloaded $full_version for $version"
|
||||
fi
|
||||
else
|
||||
echo unable to download Forgejo $version
|
||||
return 1
|
||||
fi
|
||||
chmod +x $DIR_BINARIES/forgejo-$version
|
||||
fi
|
||||
}
|
||||
|
||||
function cleanup_logs() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
rm -f $DIR/*.log
|
||||
rm -f $work_path/log/*.log
|
||||
}
|
||||
|
||||
function clobber() {
|
||||
rm -fr /tmp/forgejo-end-to-end
|
||||
}
|
||||
|
||||
function start_forgejo() {
|
||||
local version=$1
|
||||
|
||||
download $version
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
daemon --chdir=$DIR --unsafe --env="TERM=$TERM" --env="HOME=$HOME" --env="PATH=$PATH" --pidfile=$DIR/forgejo-pid --errlog=$DIR/forgejo-err.log --output=$DIR/forgejo-out.log -- $DIR_BINARIES/forgejo-$version --config $work_path/app.ini --work-path $work_path
|
||||
if ! retry grep --no-messages --quiet 'Starting server on' $work_path/log/forgejo.log ; then
|
||||
grep '' $DIR/*.log
|
||||
grep '' $work_path/log/*.log 2> /dev/null
|
||||
return 1
|
||||
fi
|
||||
echo "$DIR_BINARIES/forgejo-$version --config $work_path/app.ini --work-path $work_path" '"$@"' > $DIR/forgejocli
|
||||
chmod +x $DIR/forgejocli
|
||||
create_user_and_login $version
|
||||
}
|
||||
|
||||
function start_minio() {
|
||||
mkdir -p $DIR/minio
|
||||
daemon --chdir=$DIR --unsafe \
|
||||
--env="PATH=$PATH" \
|
||||
--env=MINIO_ROOT_USER=123456 \
|
||||
--env=MINIO_ROOT_PASSWORD=12345678 \
|
||||
--env=MINIO_VOLUMES=$DIR/minio \
|
||||
--pidfile=$DIR/minio-pid --errlog=$DIR/minio-err.log --output=$DIR/minio-out.log -- /usr/local/bin/minio server
|
||||
retry mc alias set testS3 http://127.0.0.1:9000 123456 12345678 >& /dev/null
|
||||
mc alias set testS3 http://127.0.0.1:9000 123456 12345678
|
||||
}
|
||||
|
||||
function start_garage() {
|
||||
mkdir -p $DIR/garage/{data,meta}
|
||||
cat > $DIR/garage/garage.toml <<EOF
|
||||
metadata_dir = "$DIR/garage/meta"
|
||||
data_dir = "$DIR/garage/data"
|
||||
db_engine = "lmdb"
|
||||
|
||||
replication_mode = "none"
|
||||
|
||||
rpc_bind_addr = "127.0.0.1:3901"
|
||||
rpc_public_addr = "127.0.0.1:3901"
|
||||
rpc_secret = "$(openssl rand -hex 32)"
|
||||
|
||||
[s3_api]
|
||||
s3_region = "us-east-1"
|
||||
api_bind_addr = "127.0.0.1:9000"
|
||||
root_domain = ".s3.garage.localhost"
|
||||
|
||||
[s3_web]
|
||||
bind_addr = "127.0.0.1:3902"
|
||||
root_domain = ".web.garage.localhost"
|
||||
index = "index.html"
|
||||
|
||||
[k2v_api]
|
||||
api_bind_addr = "127.0.0.1:3904"
|
||||
|
||||
[admin]
|
||||
api_bind_addr = "127.0.0.1:3903"
|
||||
admin_token = "$(openssl rand -base64 32)"
|
||||
EOF
|
||||
|
||||
daemon --chdir=$DIR --unsafe \
|
||||
--env="PATH=$PATH" \
|
||||
--env=RUST_LOG=garage_api=debug \
|
||||
--pidfile=$DIR/garage-pid --errlog=$DIR/garage-err.log --output=$DIR/garage-out.log -- /usr/local/bin/garage -c $DIR/garage/garage.toml server
|
||||
|
||||
retry garage -c $DIR/garage/garage.toml status
|
||||
garage -c $DIR/garage/garage.toml layout assign -z dc1 -c 1 $(garage -c $DIR/garage/garage.toml status | tail -1 | grep -o '[0-9a-z]*' | head -1)
|
||||
ver=$(garage -c $DIR/garage/garage.toml layout show | grep -oP '(?<=Current cluster layout version: )\d+')
|
||||
garage -c $DIR/garage/garage.toml layout apply --version $((ver+1))
|
||||
garage -c $DIR/garage/garage.toml key info test || garage -c $DIR/garage/garage.toml key import -n test 123456 12345678
|
||||
garage -c $DIR/garage/garage.toml key allow --create-bucket test
|
||||
retry mc alias set testS3 http://127.0.0.1:9000 123456 12345678
|
||||
}
|
||||
|
||||
function start_s3() {
|
||||
local s3_backend=$1
|
||||
|
||||
start_$s3_backend
|
||||
}
|
||||
|
||||
function start() {
|
||||
local version=$1
|
||||
local s3_backend=${2:-minio}
|
||||
|
||||
start_s3 $s3_backend
|
||||
start_forgejo $version
|
||||
}
|
||||
|
||||
function reset_forgejo() {
|
||||
local config=$1
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
rm -fr $work_path
|
||||
mkdir -p $work_path
|
||||
IP=$IP WORK_PATH=$work_path envsubst < $config > $work_path/app.ini
|
||||
}
|
||||
|
||||
function reset_minio() {
|
||||
rm -fr $DIR/minio
|
||||
}
|
||||
|
||||
function reset_garage() {
|
||||
rm -fr $DIR/garage
|
||||
}
|
||||
|
||||
function create_user_and_login() {
|
||||
local version=$1
|
||||
|
||||
local email="$FORGEJO_USER@example.com"
|
||||
if ! $DIR/forgejocli admin user list | grep --quiet "$email" ; then
|
||||
$DIR/forgejocli admin user create --admin --username "$FORGEJO_USER" --password "$FORGEJO_PASSWORD" --email $email
|
||||
fi
|
||||
|
||||
forgejo-curl.sh logout
|
||||
local scopes='--scopes ["all"]'
|
||||
if echo $version | grep --quiet 1.18 ; then
|
||||
scopes=""
|
||||
fi
|
||||
forgejo-curl.sh --user "$FORGEJO_USER" --password "$FORGEJO_PASSWORD" $scopes login http://${HOST_PORT}
|
||||
}
|
||||
|
||||
function stop_daemon() {
|
||||
local daemon=$1
|
||||
|
||||
if test -f $DIR/$daemon-pid ; then
|
||||
local pid=$(cat $DIR/$daemon-pid)
|
||||
kill -TERM $pid
|
||||
pidwait $pid || true
|
||||
for delay in 1 1 2 2 5 5 ; do
|
||||
if ! test -f $DIR/$daemon-pid ; then
|
||||
break
|
||||
fi
|
||||
sleep $delay
|
||||
done
|
||||
! test -f $DIR/$daemon-pid
|
||||
fi
|
||||
}
|
||||
|
||||
function stop() {
|
||||
stop_daemon forgejo
|
||||
stop_daemon minio
|
||||
stop_daemon garage
|
||||
|
||||
cleanup_logs
|
||||
}
|
||||
|
||||
function show_logs() {
|
||||
(
|
||||
cd $DIR
|
||||
set +e
|
||||
grep --text '' *.log
|
||||
grep --text '' forgejo-work-path/log/*.log
|
||||
grep --text '' *.out
|
||||
)
|
||||
}
|
||||
|
||||
function run() {
|
||||
local fun=$1
|
||||
shift
|
||||
|
||||
echo Start running $fun "$@"
|
||||
mkdir -p $DIR
|
||||
> $DIR/$fun.out
|
||||
tail --follow $DIR/$fun.out |& sed --unbuffered -n -e "/^$PREFIX/s/^$PREFIX //p" &
|
||||
local pid=$!
|
||||
if ! VERBOSE=true $SELF $fun "$@" >& $DIR/$fun.out ; then
|
||||
kill $pid
|
||||
cat $DIR/$fun.out
|
||||
echo Failure running $fun
|
||||
return 1
|
||||
fi
|
||||
kill $pid
|
||||
echo Success running $fun
|
||||
}
|
||||
PS4='${BASH_SOURCE[0]}:$LINENO: ${FUNCNAME[0]}: '
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
alpine-7.0-test
|
|
@ -1,24 +0,0 @@
|
|||
# -*- mode: Shell-script; eval: (setq indent-tabs-mode 't); eval: (setq tab-width 4) -*-
|
||||
# Maintainer: Dominic Meiser <git@msrd0.de>
|
||||
pkgname=forgejo-2173
|
||||
pkgver=1.0
|
||||
pkgrel=0
|
||||
pkgdesc="Forgejo #2173 Reproduction"
|
||||
url="https://msrd0.dev/msrd0/$pkgname"
|
||||
arch="noarch"
|
||||
license="custom"
|
||||
|
||||
subpackages="$pkgname-openrc"
|
||||
|
||||
source="forgejo_2173 forgejo_2173.init"
|
||||
builddir="$srcdir"
|
||||
|
||||
package() {
|
||||
install -D -m755 "$srcdir/forgejo_2173" "$pkgdir"/usr/bin/forgejo_2173
|
||||
install -D -m755 "$srcdir/forgejo_2173.init" "$pkgdir"/etc/init.d/forgejo_2173
|
||||
}
|
||||
|
||||
sha512sums="
|
||||
651c2a816510a18981bcd45077eb5acd6e58511d641949ddc690e326b81018d851eb7f1c88e2336eada2f216606ce2aa0569eb2d02d7c423c80705cc00acf838 forgejo_2173
|
||||
abc3b1c91bd69478e8e0d46a31148bcd5b4e7838dc35e7b601673866d7e925d70ab70d63c32df98aad060134eaaa6f957691c2c4397d85af5a77f9773de21b5b forgejo_2173.init
|
||||
"
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo "Hello World"
|
|
@ -1,7 +0,0 @@
|
|||
#!/sbin/openrc-run
|
||||
|
||||
command="/usr/bin/forgejo_2173"
|
||||
|
||||
depend() {
|
||||
need net
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
# -*- mode: Shell-script; eval: (setq indent-tabs-mode 't); eval: (setq tab-width 4) -*-
|
||||
# Maintainer: Dominic Meiser <git@msrd0.de>
|
||||
pkgname=forgejo-2174
|
||||
pkgver=1.0
|
||||
pkgrel=0
|
||||
pkgdesc="Forgejo #2174 Reproduction"
|
||||
url="https://msrd0.dev/msrd0/$pkgname"
|
||||
arch="x86_64"
|
||||
license="custom"
|
||||
|
||||
# using x86_64 instead of noarch as a workaround of
|
||||
# https://codeberg.org/forgejo/forgejo/issues/2173
|
||||
subpackages="$pkgname-openrc::x86_64"
|
||||
|
||||
source="forgejo_2174 forgejo_2174.init"
|
||||
builddir="$srcdir"
|
||||
|
||||
package() {
|
||||
install -D -m755 "$srcdir/forgejo_2174" "$pkgdir"/usr/bin/forgejo_2174
|
||||
install -D -m755 "$srcdir/forgejo_2174.init" "$pkgdir"/etc/init.d/forgejo_2174
|
||||
}
|
||||
|
||||
sha512sums="
|
||||
651c2a816510a18981bcd45077eb5acd6e58511d641949ddc690e326b81018d851eb7f1c88e2336eada2f216606ce2aa0569eb2d02d7c423c80705cc00acf838 forgejo_2174
|
||||
b1cba77139cdaf9e0cdd78de93becbb3891ec59646e8d2cb40620b230bd798d51e6d9c58e65b584812a6bb8eb2b9c9f89262a8700a39c62af8ec8ea09aee4e29 forgejo_2174.init
|
||||
"
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo "Hello World"
|
|
@ -1,7 +0,0 @@
|
|||
#!/sbin/openrc-run
|
||||
|
||||
command="/usr/bin/forgejo_2174"
|
||||
|
||||
depend() {
|
||||
need net
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
#!/bin/busybox ash
|
||||
set -exuo pipefail
|
||||
|
||||
forgejo_url=$1
|
||||
forgejo_token=$2
|
||||
|
||||
# initialize abuild
|
||||
apk update
|
||||
apk add --no-cache alpine-sdk sudo util-linux
|
||||
adduser -D user -h /home/user
|
||||
addgroup user abuild
|
||||
echo "root ALL=(ALL) ALL" >/etc/sudoers
|
||||
echo "%abuild ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers
|
||||
mkdir -p /var/cache/distfiles
|
||||
chgrp abuild /var/cache/distfiles
|
||||
chmod 775 /var/cache/distfiles
|
||||
mkdir -p "/home/user/.abuild"
|
||||
echo "/home/user/.abuild/user.rsa" | abuild-keygen -i -b 4096
|
||||
echo 'PACKAGER_PRIVKEY=/home/user/.abuild/user.rsa' >/home/user/.abuild/abuild.conf
|
||||
chown -R "user:user" /home/user/
|
||||
|
||||
# make sure we own the relevant directory
|
||||
cp -r package-source /srv/alpine
|
||||
cd /srv
|
||||
mkdir packages
|
||||
echo "REPODEST=/srv/packages" >>/home/user/.abuild/abuild.conf
|
||||
cat /home/user/.abuild/abuild.conf
|
||||
chown -R user:user alpine packages
|
||||
|
||||
# build the package
|
||||
sudo -u user APKBUILD=alpine/forgejo-2174/APKBUILD abuild -r
|
||||
|
||||
# build the package
|
||||
sudo -u user APKBUILD=alpine/forgejo-2173/APKBUILD abuild -r
|
||||
|
||||
# upload new package
|
||||
cd packages/alpine/x86_64/
|
||||
for file in $(find . -name '*.apk' -type f | sed -e 's,./,,'); do
|
||||
# remove old package
|
||||
curl \
|
||||
--fail \
|
||||
-H "Authorization: token $forgejo_token" \
|
||||
-X DELETE \
|
||||
"$forgejo_url/api/packages/root/alpine/3.19/e2e-tests/$file" \
|
||||
|| true
|
||||
|
||||
# upload new package
|
||||
curl \
|
||||
--fail \
|
||||
-H "Authorization: token $forgejo_token" \
|
||||
-T "$file" \
|
||||
"$forgejo_url/api/packages/root/alpine/3.19/e2e-tests"
|
||||
done
|
||||
|
||||
# ensure that the install-if condition works as expected
|
||||
apk add openrc
|
||||
(cd /etc/apk/keys && curl -JO $forgejo_url/api/packages/root/alpine/key)
|
||||
echo "$forgejo_url/api/packages/root/alpine/3.19/e2e-tests" >>/etc/apk/repositories
|
||||
apk add forgejo-2174 forgejo-2173
|
||||
[ -e /usr/bin/forgejo_2174 ] # from the installed package
|
||||
[ -e /usr/bin/forgejo_2173 ] # from the installed package
|
||||
[ -e /etc/init.d/forgejo_2174 ] # from the -openrc package installed because of the install-if condition
|
||||
[ -e /etc/init.d/forgejo_2173 ] # from the -openrc package installed because of the install-if condition
|
|
@ -1,31 +0,0 @@
|
|||
RUN_MODE = prod
|
||||
WORK_PATH = ${WORK_PATH}
|
||||
|
||||
[server]
|
||||
APP_DATA_PATH = ${WORK_PATH}/data
|
||||
DOMAIN = ${IP}
|
||||
HTTP_PORT = 3000
|
||||
SSH_LISTEN_PORT = 2222
|
||||
LFS_START_SERVER = true
|
||||
|
||||
[database]
|
||||
DB_TYPE = sqlite3
|
||||
PATH = ${WORK_PATH}/forgejo.db
|
||||
|
||||
[log]
|
||||
MODE = file
|
||||
LEVEL = trace
|
||||
ROUTER = file
|
||||
|
||||
[log.file]
|
||||
FILE_NAME = forgejo.log
|
||||
|
||||
[security]
|
||||
INSTALL_LOCK = true
|
||||
|
||||
[repository]
|
||||
ENABLE_PUSH_CREATE_USER = true
|
||||
DEFAULT_PUSH_CREATE_PRIVATE = false
|
||||
|
||||
[actions]
|
||||
ENABLED = true
|
|
@ -1,24 +1,17 @@
|
|||
#!/bin/sh
|
||||
# Copyright 2024 The Forgejo Authors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
function test_packages_alpine_version() {
|
||||
local alpine_version=$1 forgejo_version=$2
|
||||
stop_daemon forgejo
|
||||
reset_forgejo $PACKAGES_DIR/alpine-app.ini
|
||||
start_forgejo $forgejo_version
|
||||
SELF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
local d=$PACKAGES_DIR/alpine-$forgejo_version
|
||||
local token=$(cat $DIR/forgejo-curl/token)
|
||||
local url=http://${HOST_PORT}
|
||||
source $SELF_DIR/../lib/lib.sh
|
||||
|
||||
log_info "alpine:$alpine_version & Forgejo $forgejo_version"
|
||||
docker run --rm --volume $d:$d:ro --workdir $d docker.io/alpine:$alpine_version ash -c "./test.sh $url $token"
|
||||
function main() {
|
||||
local d=$SELF_DIR/alpine
|
||||
local token=$(cat $DIR/forgejo-token)
|
||||
local url=$(cat $DIR/forgejo-url)
|
||||
|
||||
docker run --rm --volume $d:$d:ro --workdir $d docker.io/alpine:3.19 ash -c "./test.sh $url $token"
|
||||
}
|
||||
|
||||
function test_packages_alpine() {
|
||||
for alpine_version in 3.18 3.19 ; do
|
||||
for forgejo_version in 1.21 7.0-test 7.0-dev ; do
|
||||
test_packages_alpine_version $alpine_version $forgejo_version
|
||||
done
|
||||
done
|
||||
}
|
||||
"${@:-main}"
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
#!/bin/sh
|
||||
# Copyright 2024 The Forgejo Authors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
PACKAGES_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
source $PACKAGES_DIR/alpine.sh
|
||||
|
||||
function test_packages() {
|
||||
run test_packages_alpine
|
||||
}
|
80
packages/run.sh
Executable file
80
packages/run.sh
Executable file
|
@ -0,0 +1,80 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2024 The Forgejo Authors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
SELF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
source $SELF_DIR/../lib/lib.sh
|
||||
|
||||
function run() {
|
||||
local package=$1
|
||||
|
||||
bash -ex $SELF_DIR/$package.sh
|
||||
}
|
||||
|
||||
function packages_v1_21() {
|
||||
echo 'alpine'
|
||||
}
|
||||
|
||||
function packages_v7_0() {
|
||||
packages_v1_21
|
||||
}
|
||||
|
||||
function setup() {
|
||||
local binary=$1
|
||||
forgejo-binary.sh setup root admin1234 $binary
|
||||
}
|
||||
|
||||
function teardown() {
|
||||
forgejo-curl.sh logout
|
||||
forgejo-binary.sh teardown
|
||||
}
|
||||
|
||||
function main() {
|
||||
local binary="$1"
|
||||
shift
|
||||
export full_version="$1"
|
||||
shift
|
||||
export version="$1"
|
||||
shift
|
||||
|
||||
export DOT=$DIR/forgejo-curl
|
||||
|
||||
teardown
|
||||
|
||||
if test "$#" = 0 ; then
|
||||
packages=$(packages_${version/./_})
|
||||
else
|
||||
packages="$@"
|
||||
fi
|
||||
|
||||
if test "$packages" = "none" ; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
setup $binary
|
||||
|
||||
if ! test -f "$DIR/forgejo-auth-url" ; then
|
||||
echo "DIR=$DIR must be a directory with a forgejo-auth-url file"
|
||||
fi
|
||||
|
||||
export url=$(cat $DIR/forgejo-auth-url)
|
||||
export token=$(cat $DIR/forgejo-token)
|
||||
|
||||
for package in $packages ; do
|
||||
echo "======================== BEGIN package-$package ==================="
|
||||
if ! time run $package >& /tmp/run.out ; then
|
||||
sed -e 's/^/[RUN] /' < /tmp/run.out
|
||||
echo "======================== FAIL package-$package ==================="
|
||||
sleep 5 # hack for Forgejo v1.21 to workaround a bug by which the last lines of the output are moved to the next step
|
||||
false
|
||||
else
|
||||
if test "$VERBOSE" = true ; then
|
||||
sed -e 's/^/[RUN] /' < /tmp/run.out
|
||||
fi
|
||||
fi
|
||||
echo "======================== END package-$package ==================="
|
||||
done
|
||||
}
|
||||
|
||||
main "$@"
|
|
@ -1,56 +0,0 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
|
||||
STORAGE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
STORAGE_PATHS="attachments avatars lfs packages repo-archive repo-avatars"
|
||||
|
||||
function storage_reset() {
|
||||
local config=$1
|
||||
reset_forgejo $STORAGE_DIR/$config-app.ini
|
||||
reset_minio
|
||||
reset_garage
|
||||
}
|
||||
|
||||
function verify_storage() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
test -d $work_path/data/$path
|
||||
done
|
||||
}
|
||||
|
||||
function cleanup_storage() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
rm -fr $work_path/data/$path
|
||||
done
|
||||
}
|
||||
|
||||
function test_storage_stable_s3() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
local s3_backend=${1:-minio}
|
||||
|
||||
log_info "See also https://codeberg.org/forgejo/forgejo/issues/1338"
|
||||
|
||||
for version in 1.18 1.19 1.20.2-0 1.20.3-0 1.20 1.21 $RELEASE_NUMBERS_AND_DEV ; do
|
||||
log_info "Forgejo $version & $s3_backend"
|
||||
stop
|
||||
storage_reset stable-s3
|
||||
start $version $s3_backend
|
||||
fixture_create
|
||||
for fun in ${STORAGE_FUN} ; do
|
||||
fixture_${fun}_assert_s3
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
source $STORAGE_DIR/test-upgrade-1.20-storage.sh
|
||||
|
||||
function test_storage() {
|
||||
run test_storage_stable_s3 minio
|
||||
run test_storage_stable_s3 garage
|
||||
|
||||
test_upgrade_1_20_storage
|
||||
run test_forgejo_database_v3_upgrades
|
||||
}
|
|
@ -1,223 +0,0 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
function test_downgrade_1.20.2_fails() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
log_info "See also https://codeberg.org/forgejo/forgejo/pulls/1225"
|
||||
|
||||
log_info "downgrading from 1.20.3-0 to 1.20.2-0 fails"
|
||||
stop
|
||||
storage_reset default
|
||||
start 1.20.3-0
|
||||
stop
|
||||
download 1.20.2-0
|
||||
timeout 60 $DIR_BINARIES/forgejo-1.20.2-0 --config $work_path/app.ini --work-path $work_path || true
|
||||
if ! grep --fixed-strings --quiet 'use the newer database' $work_path/log/forgejo.log ; then
|
||||
cat $work_path/log/forgejo.log
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function test_bug_storage_merged() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
log_info "See also https://codeberg.org/forgejo/forgejo/pulls/1225"
|
||||
|
||||
log_info "using < 1.20.3-0 and [storage].PATH merge all storage"
|
||||
for version in 1.18.5-0 1.19.4-0 1.20.2-0 ; do
|
||||
stop
|
||||
storage_reset merged
|
||||
start $version
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
! test -d $work_path/data/$path
|
||||
done
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
! test -d $work_path/merged/$path
|
||||
done
|
||||
test -d $work_path/merged
|
||||
done
|
||||
stop
|
||||
|
||||
log_info "upgrading from 1.20.2-0 with [storage].PATH fails"
|
||||
download 1.20.3-0
|
||||
timeout 60 $DIR_BINARIES/forgejo-1.20.3-0 --config $work_path/app.ini --work-path $work_path || true
|
||||
if ! grep --fixed-strings --quiet '[storage].PATH is set and may create storage issues' $work_path/log/forgejo.log ; then
|
||||
cat $work_path/log/forgejo.log
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function test_bug_storage_relative_path() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
log_info "using < 1.20.3-0 legacy [server].XXXX and [picture].XXXX are relative to WORK_PATH"
|
||||
for version in 1.18.5-0 1.19.4-0 1.20.2-0 ; do
|
||||
stop
|
||||
storage_reset legagy-relative
|
||||
start $version
|
||||
test -d $work_path/relative-lfs
|
||||
test -d $work_path/relative-avatars
|
||||
test -d $work_path/relative-repo-avatars
|
||||
done
|
||||
|
||||
log_info "using >= 1.20.3-0 legacy [server].XXXX and [picture].XXXX are relative to APP_DATA_PATH"
|
||||
for version in 1.20.3-0 1.21.0-5-rc2 ; do
|
||||
stop
|
||||
storage_reset legagy-relative
|
||||
start $version
|
||||
test -d $work_path/data/relative-lfs
|
||||
test -d $work_path/data/relative-avatars
|
||||
test -d $work_path/data/relative-repo-avatars
|
||||
done
|
||||
|
||||
log_info "using >= 1.20.3-0 relative [storage.XXXX].PATHS are relative to APP_DATA_PATH"
|
||||
for version in 1.20.3-0 1.21.0-5-rc2 ; do
|
||||
stop
|
||||
storage_reset storage-relative
|
||||
start $version
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
test -d $work_path/data/relative-$path
|
||||
done
|
||||
done
|
||||
|
||||
log_info "using 1.20.[12]-0 relative [storage.XXXX].PATHS are inconsistent"
|
||||
for version in 1.20.2-0 ; do
|
||||
stop
|
||||
storage_reset storage-relative
|
||||
start $version
|
||||
test -d $work_path/data/packages
|
||||
test -d $work_path/relative-repo-archive
|
||||
test -d $work_path/relative-attachments
|
||||
test -d $work_path/relative-lfs
|
||||
test -d $work_path/data/avatars
|
||||
test -d $work_path/data/repo-avatars
|
||||
done
|
||||
|
||||
log_info "using < 1.20 relative [storage.XXXX].PATHS are inconsistent"
|
||||
for version in 1.18.5-0 1.19.4-0 ; do
|
||||
stop
|
||||
storage_reset storage-relative
|
||||
start $version
|
||||
test -d $work_path/relative-packages
|
||||
test -d $work_path/relative-repo-archive
|
||||
test -d $work_path/relative-attachments
|
||||
test -d $work_path/data/lfs
|
||||
test -d $work_path/data/avatars
|
||||
test -d $work_path/data/repo-avatars
|
||||
done
|
||||
|
||||
log_info "using < 1.20.3-0 relative [XXXX].PATHS are relative to WORK_PATH"
|
||||
for version in 1.18.5-0 1.19.4-0 1.20.2-0 ; do
|
||||
stop
|
||||
storage_reset relative
|
||||
start $version
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
test -d $work_path/relative-$path
|
||||
done
|
||||
done
|
||||
|
||||
log_info "using >= 1.20.3-0 relative [XXXX].PATHS are relative to APP_DATA_PATH"
|
||||
for version in 1.20.3-0 1.21.0-5-rc2 ; do
|
||||
stop
|
||||
storage_reset relative
|
||||
start $version
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
test -d $work_path/data/relative-$path
|
||||
done
|
||||
done
|
||||
|
||||
stop
|
||||
}
|
||||
|
||||
function test_bug_storage_s3_misplace() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
local s3_backend=${2:-minio}
|
||||
|
||||
log_info "See also https://codeberg.org/forgejo/forgejo/issues/1338"
|
||||
|
||||
for version in 1.20.2-0 1.20.3-0 ; do
|
||||
log_info "Forgejo $version & $s3_backend"
|
||||
stop
|
||||
storage_reset misplace-s3
|
||||
start $version $s3_backend
|
||||
fixture_create
|
||||
for fun in ${STORAGE_FUN} ; do
|
||||
fixture_${fun}_assert_s3
|
||||
done
|
||||
done
|
||||
|
||||
for version in 1.18.5-0 1.19.4-0 ; do
|
||||
log_info "Forgejo $version & $s3_backend"
|
||||
stop
|
||||
storage_reset misplace-s3
|
||||
start $version $s3_backend
|
||||
fixture_create
|
||||
#
|
||||
# some storage are in S3
|
||||
#
|
||||
fixture_attachments_assert_s3
|
||||
fixture_lfs_assert_s3
|
||||
#
|
||||
# others are in local
|
||||
#
|
||||
fixture_repo_archive_assert_local elsewhere/repo-archive
|
||||
fixture_avatars_assert_local elsewhere/avatars
|
||||
fixture_packages_assert_local elsewhere/packages
|
||||
fixture_repo_avatars_assert_local elsewhere/repo-avatars
|
||||
done
|
||||
}
|
||||
|
||||
function test_bug_storage_misplace() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
log_info "See also https://codeberg.org/forgejo/forgejo/pulls/1225"
|
||||
|
||||
log_info "using < 1.20 and conflicting sections misplace storage"
|
||||
for version in 1.18.5-0 1.19.4-0 ; do
|
||||
stop
|
||||
storage_reset misplace
|
||||
start $version
|
||||
#
|
||||
# some storage are where they should be
|
||||
#
|
||||
test -d $work_path/data/packages
|
||||
test -d $work_path/data/repo-archive
|
||||
test -d $work_path/data/attachments
|
||||
#
|
||||
# others are under APP_DATA_PATH
|
||||
#
|
||||
test -d $work_path/elsewhere/lfs
|
||||
test -d $work_path/elsewhere/avatars
|
||||
test -d $work_path/elsewhere/repo-avatars
|
||||
done
|
||||
|
||||
log_info "using < 1.20.[12]-0 and conflicting sections ignores [storage.*]"
|
||||
for version in 1.20.2-0 ; do
|
||||
stop
|
||||
storage_reset misplace
|
||||
start $version
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
test -d $work_path/elsewhere/$path
|
||||
done
|
||||
done
|
||||
|
||||
stop
|
||||
|
||||
log_info "upgrading from 1.20.2-0 with conflicting sections fails"
|
||||
download 1.20.3-0
|
||||
timeout 60 $DIR_BINARIES/forgejo-1.20.3-0 --config $work_path/app.ini --work-path $work_path || true
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
if ! grep --fixed-strings --quiet "[storage.$path] may conflict" $work_path/log/forgejo.log ; then
|
||||
cat $work_path/log/forgejo.log
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function test_upgrade_1_20_storage() {
|
||||
run test_bug_storage_misplace
|
||||
run test_bug_storage_merged
|
||||
run test_downgrade_1.20.2_fails
|
||||
run test_bug_storage_s3_misplace
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
RUN_MODE = prod
|
||||
WORK_PATH = ${WORK_PATH}
|
||||
|
||||
[server]
|
||||
APP_DATA_PATH = ${WORK_PATH}/data
|
||||
DOMAIN = ${IP}
|
||||
HTTP_PORT = 3000
|
||||
SSH_LISTEN_PORT = 2222
|
||||
LFS_START_SERVER = true
|
||||
ENABLE_PPROF = true
|
||||
|
||||
[queue]
|
||||
TYPE = immediate
|
||||
|
||||
[database]
|
||||
DB_TYPE = sqlite3
|
||||
PATH = ${WORK_PATH}/forgejo.db
|
||||
|
||||
[log]
|
||||
MODE = file
|
||||
LEVEL = trace
|
||||
ROUTER = file
|
||||
|
||||
[log.file]
|
||||
FILE_NAME = forgejo.log
|
||||
|
||||
[security]
|
||||
INSTALL_LOCK = true
|
||||
|
||||
[repository]
|
||||
ENABLE_PUSH_CREATE_USER = true
|
||||
DEFAULT_PUSH_CREATE_PRIVATE = false
|
||||
|
||||
[actions]
|
||||
ENABLED = true
|
|
@ -1,38 +0,0 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
|
||||
function test_upload_profiles() {
|
||||
FORGEJO_URL="http://localhost:6060"
|
||||
PROFILECLI_URL="http://0.0.0.0:4040"
|
||||
|
||||
endpoints=("/debug/pprof/allocs" "/debug/pprof/block" "/debug/pprof/goroutine" "/debug/pprof/mutex" "/debug/pprof/profile?seconds=5")
|
||||
curl -fL https://github.com/grafana/pyroscope/releases/download/v1.1.5/profilecli_1.1.5_linux_amd64.tar.gz -o profilecli.tar.gz
|
||||
tar xzf profilecli.tar.gz
|
||||
|
||||
for endpoint in "${endpoints[@]}"; do
|
||||
output=$(basename "$endpoint")
|
||||
if [[ $endpoint == *"/profile"* ]]; then
|
||||
output="profile"
|
||||
fi
|
||||
output="${output}.pprof"
|
||||
# Download the content and save it to a file
|
||||
curl -s "${FORGEJO_URL}${endpoint}" -o "${output}"
|
||||
./profilecli upload ${output} --url=${PROFILECLI_URL}
|
||||
|
||||
rm ${output}
|
||||
done
|
||||
}
|
||||
|
||||
function test_forgejo_pprof() {
|
||||
stop
|
||||
docker run --name test_pyroscope --rm -d -p 4040:4040 docker.io/grafana/pyroscope
|
||||
|
||||
log_info "run 8.0-test"
|
||||
|
||||
start 8.0-test
|
||||
|
||||
test_upload_profiles
|
||||
stop
|
||||
|
||||
docker stop test_pyroscope
|
||||
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
|
||||
function test_forgejo_database_version() {
|
||||
local expected_version=$1
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
actual_version=$(sqlite3 $work_path/forgejo.db "select version from forgejo_version")
|
||||
test "$expected_version" = "$actual_version"
|
||||
}
|
||||
|
||||
function test_forgejo_database_v3_upgrades_list_table() {
|
||||
local table=$1
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
sqlite3 $work_path/forgejo.db ".tables $table" .exit | grep --quiet $table
|
||||
}
|
||||
|
||||
function test_forgejo_database_v3_upgrades() {
|
||||
local table=forgejo_auth_token
|
||||
|
||||
stop
|
||||
|
||||
upgrade_reset default
|
||||
log_info "run 1.20.4-1"
|
||||
start 1.20.4-1
|
||||
stop
|
||||
! test_forgejo_database_v3_upgrades_list_table $table
|
||||
test_forgejo_database_version 2
|
||||
|
||||
log_info "run 1.20.5-0"
|
||||
start 1.20.5-0
|
||||
stop
|
||||
test_forgejo_database_v3_upgrades_list_table $table
|
||||
test_forgejo_database_version 3
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
|
||||
UPGRADE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
function upgrade_reset() {
|
||||
local config=$1
|
||||
reset_forgejo $UPGRADE_DIR/$config-app.ini
|
||||
reset_minio
|
||||
}
|
||||
|
||||
function verify_storage() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
test -d $work_path/data/$path
|
||||
done
|
||||
}
|
||||
|
||||
function cleanup_storage() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
rm -fr $work_path/data/$path
|
||||
done
|
||||
}
|
||||
|
||||
function test_successful_upgrades() {
|
||||
stop
|
||||
for config in default ; do
|
||||
log_info "using $config app.ini"
|
||||
upgrade_reset $config
|
||||
|
||||
version=1.18
|
||||
log_info "run $version"
|
||||
cleanup_storage
|
||||
start $version
|
||||
fixture_create
|
||||
fixture_assert
|
||||
doctor_run $version
|
||||
|
||||
for version in 1.19 1.20 1.21 $RELEASE_NUMBERS_AND_DEV ; do
|
||||
stop
|
||||
log_info "run $version"
|
||||
start $version
|
||||
verify_storage
|
||||
fixture_assert
|
||||
doctor_run $version
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
source $UPGRADE_DIR/test-upgrade-forgejo-database-v3.sh
|
||||
source $UPGRADE_DIR/test-pprof-upload.sh
|
||||
|
||||
function test_upgrades() {
|
||||
run dependencies
|
||||
run build_all
|
||||
|
||||
run test_successful_upgrades
|
||||
run test_forgejo_database_v3_upgrades
|
||||
run test_forgejo_pprof
|
||||
}
|
Loading…
Reference in a new issue