1
0
mirror of https://gitlab.com/packaging/gitea synced 2025-04-08 09:07:12 +00:00

Compare commits

..

No commits in common. "master" and "v1.20.6+1" have entirely different histories.

5 changed files with 62 additions and 165 deletions

View File

@ -21,10 +21,10 @@ stages:
- apt-get -qqy install ruby-dev ruby-ffi curl file - apt-get -qqy install ruby-dev ruby-ffi curl file
- gem install fpm - gem install fpm
- 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}" - echo "https://dl.gitea.com/gitea/v${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.com/gitea/${VERSION}/gitea-${VERSION}-linux-${ARCH}" "https://dl.gitea.com/gitea/v${VERSION}/gitea-${VERSION}-linux-${ARCH}"
- file - file
--mime-type --mime-type
--brief --brief
@ -53,7 +53,8 @@ stages:
artifacts: artifacts:
paths: paths:
- $CI_PROJECT_DIR/*.deb - $CI_PROJECT_DIR/*.deb
expire_in: 7 days only:
- tags


.manual: &manual .manual: &manual
when: manual when: manual
@ -62,125 +63,110 @@ stages:


.trigger: &trigger .trigger: &trigger
when: delayed when: delayed
start_in: 2 hours start_in: 1 hours
only: only:
- triggers - triggers


gitea-amd64-tag: gitea-amd64-tag:
<<: [*package, *manual] <<: *package
<<: *manual
variables: variables:
<<: *vars <<: *vars
ARCH: amd64 ARCH: amd64


gitea-amd64-trigger: gitea-amd64-trigger:
<<: [*package, *trigger] <<: *package
<<: *trigger
variables: variables:
<<: *vars <<: *vars
ARCH: amd64 ARCH: amd64


gitea-arm64-tag: gitea-arm64-tag:
<<: [*package, *manual] <<: *package
<<: *manual
variables: variables:
<<: *vars <<: *vars
ARCH: arm64 ARCH: arm64


gitea-arm64-trigger: gitea-arm64-trigger:
<<: [*package, *trigger] <<: *package
<<: *trigger
variables: variables:
<<: *vars <<: *vars
ARCH: arm64 ARCH: arm64


.test-install: &test-install test-install:
stage: test stage: test
image: ubuntu:noble image: docker:latest
script: services:
- ./.gitlab-ci/test-install.sh - docker:dind

.test-update: &test-update
stage: test
image: ubuntu:noble
script:
- ./.gitlab-ci/test-update.sh

test-install-trigger:
<<: *test-install
needs: needs:
- gitea-amd64-trigger - gitea-amd64-trigger
only: script:
- trigger - docker run

-d
test-install-tag: --name systemd-ubuntu
<<: *test-install --privileged
needs: -v /sys/fs/cgroup:/sys/fs/cgroup:ro
- gitea-amd64-tag -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-install.sh
only: only:
- tags - tags


test-update-trigger: test-update:
<<: *test-update stage: test
image: docker:latest
services:
- docker:dind
needs: needs:
- gitea-amd64-trigger - gitea-amd64-trigger
only: script:
- trigger - docker run

-d
test-update-tag: --name systemd-ubuntu
<<: *test-update --privileged
needs: -v /sys/fs/cgroup:/sys/fs/cgroup:ro
- gitea-amd64-tag -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


.repro: &repo reprepro:
cache: cache:
untracked: true untracked: true
paths: paths:
- $CI_PROJECT_DIR/.repo - $CI_PROJECT_DIR/.repo
key: repo key: reprepro
stage: repo stage: repo
image: registry.gitlab.com/packaging/utils:latest image: registry.gitlab.com/packaging/reprepro-multiple-versions:latest
script: script:
- /deb.sh gitea - apt-get -qq update

- apt-get -qqy install curl
repo-apt-tag: - curl -L https://gitlab.com/packaging/utils/-/raw/main/repo.sh |
<<: [*repo] bash -s -- gitea
needs: only:
- gitea-amd64-tag - tags
- 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: repo key: reprepro
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 -rv - cp -r
$CI_PROJECT_DIR/.repo/deb/gpg.key $CI_PROJECT_DIR/.repo/gpg.key
$CI_PROJECT_DIR/.repo/deb/gitea/gitea/{dists,pool} $CI_PROJECT_DIR/.repo/gitea/{dists,pool}
$CI_PROJECT_DIR/public/ $CI_PROJECT_DIR/public/
artifacts: artifacts:
paths: paths:
@ -188,4 +174,3 @@ pages:
expire_in: 1 day expire_in: 1 day
only: only:
- tags - tags
- triggers

View File

@ -1,84 +0,0 @@
#!/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

0
.gitlab-ci/test-install.sh Executable file → Normal file
View File

2
.gitlab-ci/test-update.sh Executable file → Normal file
View File

@ -6,7 +6,7 @@ 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
install -o gitea -g gitea -m 644 "/${CI_PROJECT_DIR}/.gitlab-ci/app.ini" /etc/gitea/app.ini cp "/${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"

12
.gitlab-ci/test.sh Executable file → Normal file
View File

@ -6,20 +6,16 @@ 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() {
/etc/init.d/gitea start systemctl start gitea
sleep 10 sleep 10
if ! /etc/init.d/gitea status | grep 'gitea is running'; then if ! systemctl is-active gitea; then
cat /var/lib/gitea/log/gitea.log journalctl -lu gitea --no-pager
fi fi
} }


restart_gitea() { restart_gitea() {
/etc/init.d/gitea stop systemctl stop gitea
start_gitea start_gitea
} }