add woodpecker
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
nyyu 2022-11-14 20:24:47 +01:00
parent 015f885815
commit 360762a7b6
6 changed files with 220 additions and 0 deletions

29
woodpecker/.SRCINFO Normal file
View File

@ -0,0 +1,29 @@
pkgbase = woodpecker
pkgdesc = Woodpecker is a community fork of the Drone CI system
pkgver = 0.15.5
pkgrel = 1
url = https://woodpecker-ci.org
arch = x86_64
license = Apache
makedepends = go
makedepends = git
makedepends = npm
options = !lto
source = git+https://github.com/woodpecker-ci/woodpecker.git#tag=v0.15.5
source = woodpecker-server.service
source = woodpecker-agent.service
source = agent.conf
source = server.conf
sha256sums = SKIP
sha256sums = c83db16998062a6c6dcc0559df5b71c44d6e0f199c74b22f969399098dd57afd
sha256sums = 176d884407b89da3e83cb0b19c506a3fd5ce39a19fb6346e512562ee73e50373
sha256sums = 4de44e9fd4ae2b83955536fa12be94d4812706544178923c40b53b8a6dd71079
sha256sums = 9a90780b9bbd9596b34c0ff81d9256dba54a14d40c72de47c62c1ffd094ba217
pkgname = woodpecker-server
backup = etc/woodpecker/server
pkgname = woodpecker-agent
backup = etc/woodpecker/agent
pkgname = woodpecker-cli

112
woodpecker/PKGBUILD Normal file
View File

@ -0,0 +1,112 @@
pkgbase=woodpecker
pkgname=(
'woodpecker-server'
'woodpecker-agent'
'woodpecker-cli'
)
pkgver=0.15.5
pkgrel=1
pkgdesc="Woodpecker is a community fork of the Drone CI system"
arch=('x86_64')
url="https://woodpecker-ci.org"
license=('Apache')
makedepends=('go' 'git' 'npm')
options=('!lto')
source=(git+https://github.com/woodpecker-ci/woodpecker.git#tag=v$pkgver
'woodpecker-server.service'
'woodpecker-agent.service'
'agent.conf'
'server.conf')
sha256sums=('SKIP'
'c83db16998062a6c6dcc0559df5b71c44d6e0f199c74b22f969399098dd57afd'
'176d884407b89da3e83cb0b19c506a3fd5ce39a19fb6346e512562ee73e50373'
'4de44e9fd4ae2b83955536fa12be94d4812706544178923c40b53b8a6dd71079'
'9a90780b9bbd9596b34c0ff81d9256dba54a14d40c72de47c62c1ffd094ba217')
prepare() {
cd "$pkgbase"
mkdir -p build-server build-agent build-cli
go mod download
}
build() {
cd "$pkgbase"
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
local COMMON_FLAGS=(
-trimpath
-buildmode=pie
-mod=readonly
-modcacherw
-ldflags "-linkmode external -extldflags \"${LDFLAGS}\" -X github.com/woodpecker-ci/woodpecker/version.Version=${pkgver}"
)
cd web
npm install
npm run build
cd ..
go build \
"${COMMON_FLAGS[@]}" \
-o build-server \
./cmd/server/...
go build \
"${COMMON_FLAGS[@]}" \
-o build-agent \
./cmd/agent/...
go build \
"${COMMON_FLAGS[@]}" \
-o build-cli \
./cmd/cli/...
}
check() {
cd "$pkgbase"
go test -v ./...
}
package_woodpecker-server() {
backup=('etc/woodpecker/server')
# service
install -Dm644 woodpecker-server.service "$pkgdir/usr/lib/systemd/system/woodpecker-server.service"
# config
install -Dm644 server.conf "$pkgdir/etc/woodpecker/server"
cd "$pkgbase"
# binary
install -vDm755 build-server/server "$pkgdir/usr/bin/woodpecker-server"
}
package_woodpecker-agent() {
backup=('etc/woodpecker/agent')
# service
install -Dm644 woodpecker-agent.service "$pkgdir/usr/lib/systemd/system/woodpecker-agent.service"
# config
install -Dm644 agent.conf "$pkgdir/etc/woodpecker/agent"
cd "$pkgbase"
# binary
install -vDm755 build-agent/agent "$pkgdir/usr/bin/woodpecker-agent"
}
package_woodpecker-cli() {
cd "$pkgbase"
# binary
install -vDm755 build-cli/cli "$pkgdir/usr/bin/woodpecker-cli"
}

4
woodpecker/agent.conf Normal file
View File

@ -0,0 +1,4 @@
# agent configuration
WOODPECKER_SERVER=localhost:9990
WOODPECKER_AGENT_SECRET=""

32
woodpecker/server.conf Normal file
View File

@ -0,0 +1,32 @@
# woodpecker server configuration
# database configuration
WOODPECKER_DATABASE_DRIVER=sqlite3
WOODPECKER_DATABASE_DATASOURCE=/var/lib/woodpecker-server/woodpecker.sqlite
# remote configuration
WOODPECKER_GITHUB=false
WOODPECKER_GITHUB_CLIENT=""
WOODPECKER_GITHUB_SECRET=""
# gitea
WOODPECKER_GITEA=false
WOODPECKER_GITEA_URL=""
WOODPECKER_GITEA_CLIENT=""
WOODPECKER_GITEA_SECRET=""
# server
WOODPECKER_HOST="https://drone.exemple.com"
WOODPECKER_SERVER_ADDR=:9990
# secret
WOODPECKER_AGENT_SECRET=""
# access configuration
WOODPECKER_ADMIN=
WOODPECKER_ORGS=
WOODPECKER_REPO_OWNERS=
WOODPECKER_OPEN=false
# debug
WOODPECKER_LOG_LEVEL=info

View File

@ -0,0 +1,22 @@
[Unit]
Description=Woodpecker agent
Requires=network-online.target
After=network-online.target
[Service]
User=woodpecker-agent
Group=docker
Type=simple
EnvironmentFile=/etc/woodpecker/agent
ExecStart=/usr/bin/woodpecker-agent
ExecReload=/usr/bin/kill -HUP $MAINPID
Restart=on-failure
KillSignal=SIGINT
LimitNOFILE=8192
PrivateDevices=yes
DynamicUser=yes
ReadWritePaths=/var/run/docker.sock
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,21 @@
[Unit]
Description=Woodpecker server
Requires=network-online.target
After=network-online.target
[Service]
User=woodpecker-server
Type=simple
EnvironmentFile=/etc/woodpecker/server
ExecStart=/usr/bin/woodpecker-server
ExecReload=/usr/bin/kill -HUP $MAINPID
Restart=on-failure
KillSignal=SIGINT
LimitNOFILE=8192
PrivateDevices=yes
DynamicUser=yes
StateDirectory=woodpecker-server
[Install]
WantedBy=multi-user.target