mirror of
https://gitlab.com/packaging/gitea
synced 2025-04-03 22:56:54 +00:00
Compare commits
30 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
20126c8f51 | ||
|
dad4eebc13 | ||
|
3c57e902d7 | ||
|
46a3c4f025 | ||
|
b4da93c2e7 | ||
|
76dd904377 | ||
|
2dbbc72e39 | ||
|
b185ebbe9e | ||
|
0c08e9675d | ||
|
82f6637981 | ||
|
d058c14dd5 | ||
|
315ff0e1b0 | ||
|
28ceca30eb | ||
|
1adabf6ace | ||
|
ec04f77c98 | ||
|
153ab6e886 | ||
|
09f6cfc8dc | ||
|
f450540dc2 | ||
|
0f9c8bed35 | ||
|
050fc4859c | ||
|
74d7e81d43 | ||
|
63e4c70f1d | ||
|
73833d52dc | ||
|
8c6ac8f4e6 | ||
|
b00b9978af | ||
|
5f0e2c85a3 | ||
|
2b8cb0ee34 | ||
|
c2f3770f98 | ||
|
6e8272fe38 | ||
|
1ed73b2f19 |
156
.gitlab-ci.yml
156
.gitlab-ci.yml
@ -15,29 +15,30 @@ stages:
|
|||||||
stage: package
|
stage: package
|
||||||
image: golang:latest
|
image: golang:latest
|
||||||
script:
|
script:
|
||||||
- export VERSION=$(echo ${CI_COMMIT_TAG#*v} | cut -d'-' -f1)
|
- export VERSION=$(echo ${CI_COMMIT_TAG#*v} | cut -d'+' -f1)
|
||||||
- export PATCHLEVEL=$(echo ${CI_COMMIT_TAG} | cut -d'-' -f2)
|
- export PATCHLEVEL=$(echo ${CI_COMMIT_TAG} | cut -d'+' -f2)
|
||||||
- apt-get -qq update
|
- apt-get -qq update
|
||||||
- apt-get -qqy install ruby-dev ruby-ffi curl file
|
- apt-get -qqy install ruby-dev ruby-ffi curl file
|
||||||
- gem install specific_install
|
- gem install fpm
|
||||||
- gem specific_install https://github.com/root360/fpm.git all_fixes
|
|
||||||
- mkdir -p "${CI_PROJECT_DIR}/package_root/usr/bin"
|
- mkdir -p "${CI_PROJECT_DIR}/package_root/usr/bin"
|
||||||
|
- echo "https://dl.gitea.com/gitea/${VERSION}/gitea-${VERSION}-linux-${ARCH}"
|
||||||
- curl -sL -o
|
- curl -sL -o
|
||||||
"${CI_PROJECT_DIR}/package_root/usr/bin/gitea"
|
"${CI_PROJECT_DIR}/package_root/usr/bin/gitea"
|
||||||
"https://dl.gitea.io/gitea/${VERSION}/gitea-${VERSION}-linux-${ARCH}"
|
"https://dl.gitea.com/gitea/${VERSION}/gitea-${VERSION}-linux-${ARCH}"
|
||||||
- file
|
- file
|
||||||
--mime-type
|
--mime-type
|
||||||
--brief
|
--brief
|
||||||
"${CI_PROJECT_DIR}/package_root/usr/bin/gitea"
|
"${CI_PROJECT_DIR}/package_root/usr/bin/gitea"
|
||||||
| grep -q 'application/x-executable'
|
| grep -q 'application/x-executable'
|
||||||
- chmod +x "${CI_PROJECT_DIR}/package_root/usr/bin/gitea"
|
- chmod +x "${CI_PROJECT_DIR}/package_root/usr/bin/gitea"
|
||||||
|
- gem install fpm
|
||||||
- fpm
|
- fpm
|
||||||
--architecture "${ARCH}"
|
--architecture "${ARCH}"
|
||||||
--input-type dir
|
--input-type dir
|
||||||
--output-type deb
|
--output-type deb
|
||||||
--package "${CI_PROJECT_DIR}/gitea_${VERSION}-${PATCHLEVEL}_${ARCH}.deb"
|
--package "${CI_PROJECT_DIR}/gitea_${VERSION}+${PATCHLEVEL}_${ARCH}.deb"
|
||||||
--name "${NAME}"
|
--name "${NAME}"
|
||||||
--version "${VERSION}-${PATCHLEVEL}"
|
--version "${VERSION}+${PATCHLEVEL}"
|
||||||
--description "${DESCRIPTION}"
|
--description "${DESCRIPTION}"
|
||||||
--maintainer "Stefan Heitmüller <stefan.heitmueller@gmx.com>"
|
--maintainer "Stefan Heitmüller <stefan.heitmueller@gmx.com>"
|
||||||
--url "${URL}"
|
--url "${URL}"
|
||||||
@ -52,92 +53,134 @@ stages:
|
|||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- $CI_PROJECT_DIR/*.deb
|
- $CI_PROJECT_DIR/*.deb
|
||||||
|
expire_in: 7 days
|
||||||
|
|
||||||
|
.manual: &manual
|
||||||
|
when: manual
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
|
|
||||||
gitea-amd64:
|
.trigger: &trigger
|
||||||
<<: *package
|
when: delayed
|
||||||
|
start_in: 2 hours
|
||||||
|
only:
|
||||||
|
- triggers
|
||||||
|
|
||||||
|
gitea-amd64-tag:
|
||||||
|
<<: [*package, *manual]
|
||||||
variables:
|
variables:
|
||||||
<<: *vars
|
<<: *vars
|
||||||
ARCH: amd64
|
ARCH: amd64
|
||||||
|
|
||||||
gitea-arm64:
|
gitea-amd64-trigger:
|
||||||
<<: *package
|
<<: [*package, *trigger]
|
||||||
|
variables:
|
||||||
|
<<: *vars
|
||||||
|
ARCH: amd64
|
||||||
|
|
||||||
|
gitea-arm64-tag:
|
||||||
|
<<: [*package, *manual]
|
||||||
variables:
|
variables:
|
||||||
<<: *vars
|
<<: *vars
|
||||||
ARCH: arm64
|
ARCH: arm64
|
||||||
|
|
||||||
test-install:
|
gitea-arm64-trigger:
|
||||||
|
<<: [*package, *trigger]
|
||||||
|
variables:
|
||||||
|
<<: *vars
|
||||||
|
ARCH: arm64
|
||||||
|
|
||||||
|
.test-install: &test-install
|
||||||
stage: test
|
stage: test
|
||||||
image: docker:latest
|
image: ubuntu:noble
|
||||||
services:
|
|
||||||
- docker:dind
|
|
||||||
needs:
|
|
||||||
- gitea-amd64
|
|
||||||
script:
|
script:
|
||||||
- docker run
|
- ./.gitlab-ci/test-install.sh
|
||||||
-d
|
|
||||||
--name systemd-ubuntu
|
.test-update: &test-update
|
||||||
--privileged
|
stage: test
|
||||||
-v /sys/fs/cgroup:/sys/fs/cgroup:ro
|
image: ubuntu:noble
|
||||||
-v $CI_PROJECT_DIR:/src
|
script:
|
||||||
-e CI_PROJECT_DIR=/src
|
- ./.gitlab-ci/test-update.sh
|
||||||
-e CI_COMMIT_TAG=$CI_COMMIT_TAG
|
|
||||||
jrei/systemd-ubuntu:20.04
|
test-install-trigger:
|
||||||
- docker exec -t systemd-ubuntu /bin/bash /src/.gitlab-ci/test-install.sh
|
<<: *test-install
|
||||||
|
needs:
|
||||||
|
- gitea-amd64-trigger
|
||||||
|
only:
|
||||||
|
- trigger
|
||||||
|
|
||||||
|
test-install-tag:
|
||||||
|
<<: *test-install
|
||||||
|
needs:
|
||||||
|
- gitea-amd64-tag
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
|
|
||||||
test-update:
|
test-update-trigger:
|
||||||
stage: test
|
<<: *test-update
|
||||||
image: docker:latest
|
|
||||||
services:
|
|
||||||
- docker:dind
|
|
||||||
needs:
|
needs:
|
||||||
- gitea-amd64
|
- gitea-amd64-trigger
|
||||||
script:
|
only:
|
||||||
- docker run
|
- trigger
|
||||||
-d
|
|
||||||
--name systemd-ubuntu
|
test-update-tag:
|
||||||
--privileged
|
<<: *test-update
|
||||||
-v /sys/fs/cgroup:/sys/fs/cgroup:ro
|
needs:
|
||||||
-v $CI_PROJECT_DIR:/src
|
- gitea-amd64-tag
|
||||||
-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
|
||||||
|
|
||||||
reprepro:
|
.repro: &repo
|
||||||
cache:
|
cache:
|
||||||
untracked: true
|
untracked: true
|
||||||
paths:
|
paths:
|
||||||
- $CI_PROJECT_DIR/.repo
|
- $CI_PROJECT_DIR/.repo
|
||||||
key: reprepro
|
key: repo
|
||||||
stage: repo
|
stage: repo
|
||||||
image: registry.gitlab.com/packaging/reprepro-multiple-versions:latest
|
image: registry.gitlab.com/packaging/utils:latest
|
||||||
script:
|
script:
|
||||||
- apt-get -qq update
|
- /deb.sh gitea
|
||||||
- apt-get -qqy install curl
|
|
||||||
- curl -L https://gitlab.com/packaging/utils/-/raw/main/repo.sh | bash -s -- gitea
|
repo-apt-tag:
|
||||||
only:
|
<<: [*repo]
|
||||||
- tags
|
needs:
|
||||||
|
- gitea-amd64-tag
|
||||||
|
- gitea-arm64-tag
|
||||||
|
- test-install-tag
|
||||||
|
- test-update-tag
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_TAG && $CI_PIPELINE_SOURCE != "trigger"
|
||||||
|
|
||||||
|
|
||||||
|
repo-apt-trigger:
|
||||||
|
<<: [*repo]
|
||||||
|
needs:
|
||||||
|
- gitea-amd64-trigger
|
||||||
|
- gitea-arm64-trigger
|
||||||
|
- test-install-trigger
|
||||||
|
- test-update-trigger
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_TAG && $CI_PIPELINE_SOURCE == "trigger"
|
||||||
|
|
||||||
pages:
|
pages:
|
||||||
cache:
|
cache:
|
||||||
untracked: true
|
untracked: true
|
||||||
paths:
|
paths:
|
||||||
- $CI_PROJECT_DIR/.repo
|
- $CI_PROJECT_DIR/.repo
|
||||||
key: reprepro
|
key: repo
|
||||||
policy: pull
|
policy: pull
|
||||||
stage: pages
|
stage: pages
|
||||||
image: ubuntu:focal
|
image: ubuntu:focal
|
||||||
|
needs:
|
||||||
|
- job: repo-apt-tag
|
||||||
|
optional: true
|
||||||
|
- job: repo-apt-trigger
|
||||||
|
optional: true
|
||||||
script:
|
script:
|
||||||
- mkdir $CI_PROJECT_DIR/public
|
- mkdir $CI_PROJECT_DIR/public
|
||||||
- cp -r
|
- cp -rv
|
||||||
$CI_PROJECT_DIR/.repo/gpg.key
|
$CI_PROJECT_DIR/.repo/deb/gpg.key
|
||||||
$CI_PROJECT_DIR/.repo/gitea/{dists,pool}
|
$CI_PROJECT_DIR/.repo/deb/gitea/gitea/{dists,pool}
|
||||||
$CI_PROJECT_DIR/public/
|
$CI_PROJECT_DIR/public/
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
@ -145,3 +188,4 @@ pages:
|
|||||||
expire_in: 1 day
|
expire_in: 1 day
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
|
- triggers
|
||||||
|
84
.gitlab-ci/init
Executable file
84
.gitlab-ci/init
Executable file
@ -0,0 +1,84 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: gitea
|
||||||
|
# Required-Start: $syslog $network
|
||||||
|
# Required-Stop: $syslog
|
||||||
|
# Default-Start: 2 3 4 5
|
||||||
|
# Default-Stop: 0 1 6
|
||||||
|
# Short-Description: A self-hosted Git service written in Go.
|
||||||
|
# Description: A self-hosted Git service written in Go.
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
# Do NOT "set -e"
|
||||||
|
|
||||||
|
# PATH should only include /usr/* if it runs after the mountnfs.sh script
|
||||||
|
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
|
||||||
|
DESC="Gitea - Git with a cup of tea"
|
||||||
|
NAME=gitea
|
||||||
|
SERVICEVERBOSE=yes
|
||||||
|
PIDFILE=/run/$NAME.pid
|
||||||
|
SCRIPTNAME=/etc/init.d/$NAME
|
||||||
|
WORKINGDIR=/var/lib/$NAME
|
||||||
|
DAEMON=/usr/bin/$NAME
|
||||||
|
DAEMON_ARGS="web -c /etc/$NAME/app.ini"
|
||||||
|
USER=gitea
|
||||||
|
STOP_SCHEDULE="${STOP_SCHEDULE:-QUIT/5/TERM/1/KILL/5}"
|
||||||
|
|
||||||
|
# Read configuration variable file if it is present
|
||||||
|
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
||||||
|
|
||||||
|
# Exit if the package is not installed
|
||||||
|
[ -x "$DAEMON" ] || exit 0
|
||||||
|
|
||||||
|
do_start()
|
||||||
|
{
|
||||||
|
GITEA_ENVS="USER=$USER GITEA_WORK_DIR=$WORKINGDIR HOME=/var/lib/$USER"
|
||||||
|
GITEA_EXEC="$DAEMON -- $DAEMON_ARGS"
|
||||||
|
sh -c "start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \\
|
||||||
|
--background --chdir $WORKINGDIR --chuid $USER \\
|
||||||
|
--exec /bin/bash -- -c '/usr/bin/env $GITEA_ENVS $GITEA_EXEC'"
|
||||||
|
}
|
||||||
|
|
||||||
|
do_stop()
|
||||||
|
{
|
||||||
|
start-stop-daemon --stop --quiet --retry=$STOP_SCHEDULE --pidfile $PIDFILE --name $NAME --oknodo
|
||||||
|
rm -f $PIDFILE
|
||||||
|
}
|
||||||
|
|
||||||
|
do_status()
|
||||||
|
{
|
||||||
|
if [ -f $PIDFILE ]; then
|
||||||
|
if kill -0 $(cat "$PIDFILE") >/dev/null 2>&1; then
|
||||||
|
echo "$NAME is running, PID is $(cat $PIDFILE)"
|
||||||
|
else
|
||||||
|
echo "$NAME process is dead, but pidfile exists"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "$NAME is not running"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
echo "Starting $DESC" "$NAME"
|
||||||
|
do_start
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
echo "Stopping $DESC" "$NAME"
|
||||||
|
do_stop
|
||||||
|
;;
|
||||||
|
status)
|
||||||
|
do_status
|
||||||
|
;;
|
||||||
|
restart)
|
||||||
|
echo "Restarting $DESC" "$NAME"
|
||||||
|
do_stop
|
||||||
|
do_start
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: $SCRIPTNAME {start|stop|status|restart}" >&2
|
||||||
|
exit 2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
2
.gitlab-ci/test-install.sh
Normal file → Executable file
2
.gitlab-ci/test-install.sh
Normal file → Executable file
@ -2,5 +2,5 @@
|
|||||||
|
|
||||||
. "${CI_PROJECT_DIR}/.gitlab-ci/test.sh"
|
. "${CI_PROJECT_DIR}/.gitlab-ci/test.sh"
|
||||||
|
|
||||||
apt-get -y install "${CI_PROJECT_DIR}/gitea_${VERSION}-${PATCHLEVEL}_amd64.deb"
|
apt-get -y install "${CI_PROJECT_DIR}/gitea_${VERSION}+${PATCHLEVEL}_amd64.deb"
|
||||||
start_gitea
|
start_gitea
|
||||||
|
4
.gitlab-ci/test-update.sh
Normal file → Executable file
4
.gitlab-ci/test-update.sh
Normal file → Executable file
@ -6,9 +6,9 @@ curl -sL -o /etc/apt/trusted.gpg.d/morph027-gitea.asc https://packaging.gitlab.i
|
|||||||
echo "deb [arch=amd64] https://packaging.gitlab.io/gitea gitea main" > /etc/apt/sources.list.d/morph027-gitea.list
|
echo "deb [arch=amd64] https://packaging.gitlab.io/gitea gitea main" > /etc/apt/sources.list.d/morph027-gitea.list
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get -y install gitea
|
apt-get -y install gitea
|
||||||
cp "/${CI_PROJECT_DIR}/.gitlab-ci/app.ini" /etc/gitea/app.ini
|
install -o gitea -g gitea -m 644 "/${CI_PROJECT_DIR}/.gitlab-ci/app.ini" /etc/gitea/app.ini
|
||||||
start_gitea
|
start_gitea
|
||||||
curl -s localhost:3000/api/v1/version | jq -e '.version'
|
curl -s localhost:3000/api/v1/version | jq -e '.version'
|
||||||
apt-get -y --allow-downgrades install "${CI_PROJECT_DIR}/gitea_${VERSION}-${PATCHLEVEL}_amd64.deb"
|
apt-get -y --allow-downgrades install "${CI_PROJECT_DIR}/gitea_${VERSION}+${PATCHLEVEL}_amd64.deb"
|
||||||
restart_gitea
|
restart_gitea
|
||||||
curl -s localhost:3000/api/v1/version | jq -e '.version'
|
curl -s localhost:3000/api/v1/version | jq -e '.version'
|
||||||
|
16
.gitlab-ci/test.sh
Normal file → Executable file
16
.gitlab-ci/test.sh
Normal file → Executable file
@ -2,20 +2,24 @@
|
|||||||
|
|
||||||
set -e
|
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)
|
||||||
export VERSION PATCHLEVEL
|
export VERSION PATCHLEVEL
|
||||||
|
|
||||||
|
if [ ! -f /etc/init.d/gitea ]; then
|
||||||
|
cp -v "${CI_PROJECT_DIR}"/.gitlab-ci/init /etc/init.d/gitea
|
||||||
|
fi
|
||||||
|
|
||||||
start_gitea() {
|
start_gitea() {
|
||||||
systemctl start gitea
|
/etc/init.d/gitea start
|
||||||
sleep 10
|
sleep 10
|
||||||
if ! systemctl is-active gitea; then
|
if ! /etc/init.d/gitea status | grep 'gitea is running'; then
|
||||||
journalctl -lu gitea --no-pager
|
cat /var/lib/gitea/log/gitea.log
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
restart_gitea() {
|
restart_gitea() {
|
||||||
systemctl stop gitea
|
/etc/init.d/gitea stop
|
||||||
start_gitea
|
start_gitea
|
||||||
}
|
}
|
||||||
|
|
||||||
|
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2022 packaging
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
Loading…
Reference in New Issue
Block a user