drone: update build flags
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
nyyu 2022-07-14 09:51:09 +02:00
parent 5ffff2b392
commit 620aa6d349
7 changed files with 131 additions and 72 deletions

View File

@ -3,37 +3,37 @@ type: docker
name: default
steps:
- name: build
pull: always
image: archlinux:base-devel
volumes:
- name: repo
path: /repo
commands:
- cp -f conf/{makepkg,pacman}.conf /etc/
- cat conf/pacman-conf.d-noextract.conf >> /etc/pacman.conf
- sed -i 's/# REPOSITORIES/[nyyu]\nServer = https:\\/\\/archlinux.nyyu.dev\\/nyyu\nSigLevel = Never/' /etc/pacman.conf
- sed -i 's/#PACKAGER=".*"/PACKAGER="nyyu <mail@nyyu.dev>"/' /etc/makepkg.conf
- pacman -Syu git jq pacman-contrib pandoc-bin --noconfirm
- useradd build -m
- "echo 'build ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers"
- chown -R build:build .
- sudo -u build --preserve-env=PGP_KEY,PGP_PWD,PGP_ID sh -c 'mkdir ~/.gnupg && echo -e "default-cache-ttl 3600\nallow-preset-passphrase" > ~/.gnupg/gpg-agent.conf && echo "$PGP_KEY" | gpg --import --no-tty --batch --yes && echo "$PGP_PWD" | /usr/lib/gnupg/gpg-preset-passphrase --preset $PGP_ID'
- sudo -u build --preserve-env=DRONE_GIT_HTTP_URL,DRONE_BRANCH,GIT_PASSWORD sh -c './build.sh'
environment:
PGP_KEY:
from_secret: PGP_KEY
PGP_PWD:
from_secret: PGP_PWD
PGP_ID:
from_secret: PGP_ID
GIT_PASSWORD:
from_secret: git_password
- name: build
pull: always
image: archlinux:base-devel
volumes:
- name: repo
path: /repo
commands:
- cp -f conf/{makepkg,pacman}.conf /etc/
- cat conf/pacman-conf.d-noextract.conf >> /etc/pacman.conf
- sed -i 's/# REPOSITORIES/[nyyu]\nServer = https:\\/\\/archlinux.nyyu.dev\\/nyyu\nSigLevel = Never/' /etc/pacman.conf
- sed -i 's/#PACKAGER=".*"/PACKAGER="nyyu <mail@nyyu.dev>"/' /etc/makepkg.conf
- pacman -Syu git jq pacman-contrib pandoc-bin --noconfirm
- useradd build -m
- "echo 'build ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers"
- chown -R build:build .
- sudo -u build --preserve-env=PGP_KEY,PGP_PWD,PGP_ID sh -c 'mkdir ~/.gnupg && echo -e "default-cache-ttl 3600\nallow-preset-passphrase" > ~/.gnupg/gpg-agent.conf && echo "$PGP_KEY" | gpg --import --no-tty --batch --yes && echo "$PGP_PWD" | /usr/lib/gnupg/gpg-preset-passphrase --preset $PGP_ID'
- sudo -u build --preserve-env=DRONE_GIT_HTTP_URL,DRONE_BRANCH,GIT_PASSWORD sh -c './build.sh'
environment:
PGP_KEY:
from_secret: PGP_KEY
PGP_PWD:
from_secret: PGP_PWD
PGP_ID:
from_secret: PGP_ID
GIT_PASSWORD:
from_secret: git_password
volumes:
- name: repo
host:
path: /mnt/archlinux/nyyu
- name: repo
host:
path: /mnt/archlinux/nyyu
trigger:
branch:
- master
- master

View File

@ -7,7 +7,7 @@ build() {
if grep -c 'git+' PKGBUILD >/dev/null && ! grep -c '#tag=' PKGBUILD >/dev/null; then
makepkg --nodeps --nobuild --skippgpcheck --noconfirm
makepkg --printsrcinfo > .SRCINFO
makepkg --printsrcinfo >.SRCINFO
fi
name=$(grep -m1 'pkgname' .SRCINFO | cut -d'=' -f2 | tr -d ' ')
ver=$(grep 'pkgver' .SRCINFO | cut -d'=' -f2 | tr -d ' ')

View File

@ -1,20 +1,20 @@
pkgbase = drone-runner-docker
pkgdesc = Drone is a Continuous Delivery platform built on Docker, written in Go - Free enterprise variant
pkgdesc = Drone pipeline runner that executes builds inside Docker containers
pkgver = 1.8.2
pkgrel = 1
pkgrel = 2
url = https://drone.io
arch = x86_64
license = Apache
license = custom
makedepends = go
makedepends = git
makedepends = gcc
depends = docker
options = !lto
backup = etc/drone/agent
source = git+https://github.com/drone-runners/drone-runner-docker.git#tag=v1.8.2
source = drone-agent.service
source = agent.conf
sha256sums = SKIP
sha256sums = dda7f52cb406beeb16024eb077ecfdd4b05929a955f796214646a16db5898ea2
sha256sums = a739e3efeffdf93dd13ba4947608ecd17ea585473de55a2323f6f3e89f787dca
sha256sums = 2c1a13f0d4bf83c1716db1b3179f38da7b9f0e762f781a8a6ab13cc683f057fe
pkgname = drone-runner-docker

View File

@ -1,35 +1,66 @@
# Maintainer: Sl@ny <webmaster [at] slany [dot] work>
pkgname=drone-runner-docker
pkgver=1.8.2
pkgrel=1
pkgdesc="Drone is a Continuous Delivery platform built on Docker, written in Go - Free enterprise variant"
pkgrel=2
pkgdesc='Drone pipeline runner that executes builds inside Docker containers'
arch=('x86_64')
url="https://drone.io"
license=('Apache')
makedepends=('go' 'git' 'gcc')
license=('custom')
makedepends=('go' 'git')
options=('!lto')
depends=('docker')
backup=('etc/drone/agent')
source=(git+https://github.com/drone-runners/$pkgname.git#tag=v$pkgver
'drone-agent.service'
'agent.conf')
'drone-agent.service'
'agent.conf')
sha256sums=('SKIP'
'dda7f52cb406beeb16024eb077ecfdd4b05929a955f796214646a16db5898ea2'
'a739e3efeffdf93dd13ba4947608ecd17ea585473de55a2323f6f3e89f787dca'
'2c1a13f0d4bf83c1716db1b3179f38da7b9f0e762f781a8a6ab13cc683f057fe')
prepare() {
cd "$pkgname"
# create directory for build output
mkdir -p build
# download dependencies
go mod download
}
build() {
cd "$srcdir/$pkgname"
go build -a -v -trimpath -buildmode=pie -mod=readonly -ldflags '-w -s' .
cd "$pkgname"
# set Go flags
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
go build -v \
-trimpath \
-buildmode=pie \
-mod=readonly \
-modcacherw \
-ldflags "-linkmode external -extldflags \"${LDFLAGS}\"" \
-o build \
.
}
package() {
cd "$srcdir"
# binaries
install -Dm755 "$pkgname/$pkgname" "$pkgdir"/usr/bin/drone-agent
# service
install -Dm644 drone-agent.service "$pkgdir/usr/lib/systemd/system/drone-agent.service"
# config
install -Dm644 agent.conf "$pkgdir/etc/drone/agent"
cd "$pkgname"
# binary
install -vDm755 -t "$pkgdir/usr/bin" build/*
# licenses
install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" licenses/* LICENSE.md
# documentation
install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" README.md CHANGELOG.md
}

View File

@ -1,5 +1,5 @@
[Unit]
Description=Drone Continuous Integration platform agent
Description=Drone Runner (Docker)
After=network.target
[Service]
@ -7,7 +7,7 @@ User=drone-agent
Group=docker
Type=simple
EnvironmentFile=/etc/drone/agent
ExecStart=/usr/bin/drone-agent
ExecStart=/usr/bin/drone-runner-docker
ExecReload=/usr/bin/kill -HUP $MAINPID
Restart=on-failure
KillSignal=SIGINT

View File

@ -1,13 +1,13 @@
pkgbase = drone
pkgdesc = Drone is a Continuous Delivery platform built on Docker, written in Go - Free enterprise variant
pkgver = 2.12.1
pkgrel = 1
pkgrel = 2
url = https://drone.io
arch = x86_64
license = Apache
license = custom
makedepends = go
makedepends = git
makedepends = gcc
options = !lto
backup = etc/drone/server
source = git+https://github.com/drone/drone.git#tag=v2.12.1
source = drone.service

View File

@ -1,37 +1,65 @@
# Maintainer: Sl@ny <webmaster [at] slany [dot] work>
pkgname=drone
pkgver=2.12.1
pkgrel=1
pkgrel=2
pkgdesc="Drone is a Continuous Delivery platform built on Docker, written in Go - Free enterprise variant"
arch=('x86_64')
url="https://drone.io"
license=('Apache')
makedepends=('go' 'git' 'gcc')
license=('custom')
makedepends=('go' 'git')
options=('!lto')
backup=('etc/drone/server')
source=(git+https://github.com/drone/drone.git#tag=v$pkgver
'drone.service'
'server.conf')
'drone.service'
'server.conf')
sha256sums=('SKIP'
'3cd219b1c5611b9ff4211d4837dff11228d9a491cd41d21f4c60af77c8c21d5c'
'2b8957cd6b9f9ee6e8d831f58b0ef3fac2170a56f6259884ec7d30c3ba38c73a')
'3cd219b1c5611b9ff4211d4837dff11228d9a491cd41d21f4c60af77c8c21d5c'
'2b8957cd6b9f9ee6e8d831f58b0ef3fac2170a56f6259884ec7d30c3ba38c73a')
prepare() {
cd "$pkgname"
mkdir build
go mod download
}
build() {
cd "$srcdir/$pkgname"
go build -a -v -trimpath -buildmode=pie -mod=readonly -tags "nolimit" -ldflags '-w -s' ./cmd/drone-server
cd "$pkgname"
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}\""
)
go build \
"${COMMON_FLAGS[@]}" \
-tags "nolimit" \
-o build \
./cmd/...
}
check() {
cd "$pkgname"
go test -v ./...
}
package() {
cd "$srcdir"
# binaries
install -Dm755 "$pkgname/$pkgname"-server "$pkgdir"/usr/bin/"$pkgname"-server
# license
install -Dm644 "$pkgname/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
# service
install -Dm644 drone.service "$pkgdir/usr/lib/systemd/system/drone.service"
# config
install -Dm644 server.conf "$pkgdir/etc/drone/server"
cd "$pkgname"
# binary
install -vDm755 -t "$pkgdir/usr/bin" build/*
# license
install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE NOTICE
}