chore: add nfpm based packing recipe
All checks were successful
Cadoles/hydra-werther/pipeline/head This commit looks good
All checks were successful
Cadoles/hydra-werther/pipeline/head This commit looks good
This commit is contained in:
parent
eab0b72431
commit
b940aae071
3
.gitignore
vendored
3
.gitignore
vendored
@ -1 +1,2 @@
|
||||
/bin
|
||||
/bin
|
||||
/dist
|
50
Jenkinsfile
vendored
Normal file
50
Jenkinsfile
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
@Library('cadoles') _
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
dockerfile {
|
||||
label 'docker'
|
||||
filename 'Dockerfile'
|
||||
dir 'misc/ci'
|
||||
}
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Build and publish packages') {
|
||||
when {
|
||||
anyOf {
|
||||
branch 'master'
|
||||
branch 'develop'
|
||||
}
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
List<String> packagers = ['deb', 'rpm']
|
||||
packagers.each { pkgr ->
|
||||
sh "make NFPM_PACKAGER='${pkgr}' build package"
|
||||
}
|
||||
|
||||
List<String> attachments = sh(returnStdout: true, script: "find dist -type f -name '*.deb' -or -name '*.rpm' -or -name '*.ipk'").split(' ')
|
||||
String releaseVersion = sh(returnStdout: true, script: "git describe --always | rev | cut -d '/' -f 1 | rev").trim()
|
||||
|
||||
String releaseBody = """
|
||||
_Publication automatisée réalisée par Jenkins._ [Voir le job](${env.RUN_DISPLAY_URL})
|
||||
"""
|
||||
|
||||
gitea.release('forge-jenkins', 'Cadoles', 'hydra-werther', [
|
||||
'attachments': attachments,
|
||||
'body': releaseBody,
|
||||
'releaseName': "${releaseVersion}",
|
||||
'releaseVersion': "${releaseVersion}"
|
||||
])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
always {
|
||||
cleanWs()
|
||||
}
|
||||
}
|
||||
}
|
13
Makefile
13
Makefile
@ -1,3 +1,6 @@
|
||||
PACKAGE_VERSION ?= $(shell git describe --always | rev | cut -d '/' -f 1 | rev)
|
||||
NFPM_PACKAGER ?= deb
|
||||
|
||||
build: clean generate
|
||||
CGO_ENABLED=0 misc/script/build
|
||||
|
||||
@ -7,4 +10,14 @@ generate:
|
||||
clean:
|
||||
rm -rf bin
|
||||
|
||||
package: dist
|
||||
PACKAGE_VERSION=$(PACKAGE_VERSION) \
|
||||
nfpm package \
|
||||
--config misc/packaging/nfpm.yml \
|
||||
--target ./dist \
|
||||
--packager $(NFPM_PACKAGER)
|
||||
|
||||
dist:
|
||||
mkdir -p dist
|
||||
|
||||
.PHONY: build
|
9
misc/ci/Dockerfile
Normal file
9
misc/ci/Dockerfile
Normal file
@ -0,0 +1,9 @@
|
||||
FROM alpine:3.16
|
||||
|
||||
RUN apk add --no-cache make git curl jq bash openssl go zip
|
||||
|
||||
RUN curl -k https://forge.cadoles.com/Cadoles/Jenkins/raw/branch/master/resources/com/cadoles/common/add-letsencrypt-ca.sh | bash
|
||||
|
||||
RUN wget https://github.com/goreleaser/nfpm/releases/download/v2.20.0/nfpm_2.20.0_Linux_x86_64.tar.gz \
|
||||
&& tar -xzf nfpm_2.20.0_Linux_x86_64.tar.gz -C /usr/local/bin \
|
||||
&& chmod +x /usr/local/bin/nfpm
|
21
misc/packaging/nfpm.yml
Normal file
21
misc/packaging/nfpm.yml
Normal file
@ -0,0 +1,21 @@
|
||||
name: "hydra-werther"
|
||||
arch: "amd64"
|
||||
platform: "linux"
|
||||
version: "${PACKAGE_VERSION}"
|
||||
section: "default"
|
||||
priority: "extra"
|
||||
maintainer: "Cadoles <contact@cadoles.com>"
|
||||
description: |
|
||||
PostgreSQL automated backup scripts
|
||||
vendor: "Cadoles"
|
||||
homepage: "https://forge.cadoles.com/Cadoles/postgres-backup"
|
||||
license: "AGPL-3.0"
|
||||
contents:
|
||||
- src: bin/werther_linux_amd64
|
||||
dst: /usr/bin/hydra-werther
|
||||
- src: conf/hydra-werther.conf
|
||||
dst: /etc/hydra-werther
|
||||
- src: misc/packaging/systemd/hydra-werther.service
|
||||
dst: /usr/lib/systemd/system/hydra-werther.service
|
||||
|
||||
|
12
misc/packaging/systemd/hydra-werther.service
Normal file
12
misc/packaging/systemd/hydra-werther.service
Normal file
@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=Run Hydra Werther login/consent/logout app
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
EnvironmentFile=/etc/hydra-werther/hydra-werther.conf
|
||||
ExecStart=/usr/bin/hydra-werther
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Reference in New Issue
Block a user