1
0
mirror of https://gitlab.com/packaging/gitea synced 2024-12-18 16:13:44 +00:00
This commit is contained in:
morph027 2020-06-20 14:39:39 +02:00
parent b4157100de
commit 693e213a2f
No known key found for this signature in database
GPG Key ID: BF17A54BB873BE58
5 changed files with 57 additions and 8 deletions

View File

@ -47,7 +47,7 @@ package:
only: only:
- tags - tags


test-plain-install: test-install:
stage: test stage: test
image: docker:latest image: docker:latest
services: services:
@ -62,7 +62,26 @@ test-plain-install:
-e CI_PROJECT_DIR=/src -e CI_PROJECT_DIR=/src
-e CI_COMMIT_TAG=$CI_COMMIT_TAG -e CI_COMMIT_TAG=$CI_COMMIT_TAG
jrei/systemd-ubuntu:20.04 jrei/systemd-ubuntu:20.04
- docker exec -t systemd-ubuntu /bin/bash /src/.gitlab-ci/test.sh - docker exec -t systemd-ubuntu /bin/bash /src/.gitlab-ci/test-install.sh
only:
- tags

test-update:
stage: test
image: docker:latest
services:
- docker:dind
script:
- docker run
-d
--name systemd-ubuntu
--privileged
-v /sys/fs/cgroup:/sys/fs/cgroup:ro
-v $CI_PROJECT_DIR:/src
-e CI_PROJECT_DIR=/src
-e CI_COMMIT_TAG=$CI_COMMIT_TAG
jrei/systemd-ubuntu:20.04
- docker exec -t systemd-ubuntu /bin/bash /src/.gitlab-ci/test-update.sh
only: only:
- tags - tags



BIN
.gitlab-ci/data.tgz Normal file

Binary file not shown.

View File

@ -0,0 +1,6 @@
#!/bin/bash

. "${CI_PROJECT_DIR}/.gitlab-ci/test.sh"

apt-get -qqy install "${CI_PROJECT_DIR}/gitea_${VERSION}-${PATCHLEVEL}_amd64.deb"
start_gitea

13
.gitlab-ci/test-update.sh Normal file
View File

@ -0,0 +1,13 @@
#!/bin/bash

. "${CI_PROJECT_DIR}/.gitlab-ci/test.sh"

curl -sL -o /etc/apt/trusted.gpg.d/morph027-gitea.asc https://packaging.gitlab.io/gitea/gpg.key
echo "deb [arch=amd64] https://packaging.gitlab.io/gitea gitea main" > /etc/apt/sources.list.d/morph027-gitea.list
apt-get -qq update
apt-get -qqy install gitea
tar -C / -xzf "/${CI_PROJECT_DIR}/.gitlab-ci/data.tgz"
chown -R gitea: /var/lib/gitea /etc/gitea
start_gitea
apt-get -qqy install "${CI_PROJECT_DIR}/gitea_${VERSION}-${PATCHLEVEL}_amd64.deb"
restart_gitea

View File

@ -4,10 +4,21 @@ set -e


VERSION=$(echo "${CI_COMMIT_TAG#*v}" | cut -d'-' -f1) VERSION=$(echo "${CI_COMMIT_TAG#*v}" | cut -d'-' -f1)
PATCHLEVEL=$(echo "${CI_COMMIT_TAG}" | cut -d'-' -f2) PATCHLEVEL=$(echo "${CI_COMMIT_TAG}" | cut -d'-' -f2)
apt-get -qq update export VERSION PATCHLEVEL
apt-get -qqy install "${CI_PROJECT_DIR}/gitea_${VERSION}-${PATCHLEVEL}_amd64.deb"
systemctl start gitea start_gitea() {
sleep 10 systemctl start gitea
if ! systemctl is-active gitea; then sleep 10
if ! systemctl is-active gitea; then
journalctl -lu gitea --no-pager journalctl -lu gitea --no-pager
fi fi
curl -s localhost:3000/api/v1/version | jq -e '.version'
}

restart_gitea() {
systemctl stop gitea
start_gitea
}

apt-get -qq update
apt-get -qqy install curl jq