fix: systemd stuff; pipeline; packagebuild
This commit is contained in:
47
.gitlab-ci.yml
Normal file
47
.gitlab-ci.yml
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
---
|
||||||
|
stages:
|
||||||
|
- test
|
||||||
|
- release
|
||||||
|
|
||||||
|
.go_template_defaults:
|
||||||
|
stage: test
|
||||||
|
.semver_template_defaults:
|
||||||
|
stage: release
|
||||||
|
include:
|
||||||
|
- { project: fsrvcorp/templates, file: templates/language/go.yml, ref: 1.0.10 }
|
||||||
|
- { project: fsrvcorp/templates, file: templates/release/semver.yml, ref: 1.0.10 }
|
||||||
|
|
||||||
|
packages:
|
||||||
|
stage: release
|
||||||
|
image: goreleaser/goreleaser@sha256:f7f4c58b0259a37104ada4db42f2781883ac231e304164f1f352f8a084939dbd
|
||||||
|
script:
|
||||||
|
- git reset --hard $CI_COMMIT_SHA
|
||||||
|
- git clean -ffdx
|
||||||
|
- |
|
||||||
|
if [ -n "$CI_COMMIT_TAG" ]; then
|
||||||
|
goreleaser release --skip publish --clean
|
||||||
|
else
|
||||||
|
goreleaser release --skip publish --clean --snapshot
|
||||||
|
fi
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- dist/*.deb
|
||||||
|
expire_in: 1 week
|
||||||
|
|
||||||
|
deb mirror:
|
||||||
|
stage: release
|
||||||
|
image: alpine@sha256:56fa17d2a7e7f168a043a2712e63aed1f8543aeafdcee47c58dcffe38ed51099
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
|
dependencies:
|
||||||
|
- packages
|
||||||
|
needs:
|
||||||
|
- packages
|
||||||
|
before_script:
|
||||||
|
- apk add --no-cache ca-certificates curl
|
||||||
|
script:
|
||||||
|
- |
|
||||||
|
for file in dist/*.deb; do
|
||||||
|
URL="$(curl --upload-file ${file} https://t.fsrv.xyz)"
|
||||||
|
curl -X POST --fail -F token=$CI_JOB_TOKEN -F "variables[PACKAGE_URL]=${URL}" -F ref=main https://ref.ci/api/v4/projects/185/trigger/pipeline
|
||||||
|
done
|
||||||
27
.goreleaser.yaml
Normal file
27
.goreleaser.yaml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
version: 2
|
||||||
|
|
||||||
|
builds:
|
||||||
|
- env:
|
||||||
|
- CGO_ENABLED=0
|
||||||
|
flags:
|
||||||
|
- -trimpath
|
||||||
|
ldflags:
|
||||||
|
- -s
|
||||||
|
- -w
|
||||||
|
goarch:
|
||||||
|
- amd64
|
||||||
|
- arm64
|
||||||
|
goos:
|
||||||
|
- linux
|
||||||
|
|
||||||
|
nfpms:
|
||||||
|
- maintainer: "Florian Bauer"
|
||||||
|
formats:
|
||||||
|
- deb
|
||||||
|
scripts:
|
||||||
|
postinstall: ./init/postinstall.sh
|
||||||
|
contents:
|
||||||
|
- src: ./init/ocspcrl@.service
|
||||||
|
dst: /etc/systemd/system/ocspcrl@.service
|
||||||
|
type: config
|
||||||
|
|
||||||
4
init/ocspcrl.slice
Normal file
4
init/ocspcrl.slice
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
[Unit]
|
||||||
|
Description="OCSPCRL Server Instances"
|
||||||
|
|
||||||
|
[Slice]
|
||||||
16
init/ocspcrl@.service
Normal file
16
init/ocspcrl@.service
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=OCSP / CRL server %i
|
||||||
|
After=network.target
|
||||||
|
ConditionPathExists=/etc/default/ocspcrl-%i
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
IPAccounting=true
|
||||||
|
MemoryAccounting=true
|
||||||
|
Slice=ocspcrl.slice
|
||||||
|
EnvironmentFile=/etc/default/ocspcrl-%i
|
||||||
|
ExecStart=/usr/bin/ocspcrl $OCSPCRL_OPTS
|
||||||
|
ExecReload=/bin/kill -HUP $MAINPID
|
||||||
|
TimeoutStopSec=30
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
3
init/postinstall.sh
Executable file
3
init/postinstall.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl restart ocspcrl.slice
|
||||||
Reference in New Issue
Block a user