debian: add script for packaging
gitea/prometheus-xmpp-alerting/pipeline/head This commit looks good Details

This commit is contained in:
Guillaume Baffoin 2024-03-18 22:49:03 +01:00
parent c73487905a
commit f7b73ba19e
8 changed files with 140 additions and 0 deletions

38
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,38 @@
@Library('eo-jenkins-lib@main') import eo.Utils
pipeline {
agent any
options { disableConcurrentBuilds() }
stages {
stage('Packaging') {
steps {
script {
env.SHORT_JOB_NAME=sh(
returnStdout: true,
// given JOB_NAME=prometheus-xmpp-alerting/project/PR-46, returns project
// given JOB_NAME=project/main, returns project
script: '''
echo "${JOB_NAME}" | sed "s/prometheus-xmpp-alerting\\///" | awk -F/ '{print $1}'
'''
).trim()
if (env.GIT_BRANCH == 'main' || env.GIT_BRANCH == 'origin/main') {
sh "sudo -H -u eobuilder /usr/local/bin/eobuilder -d bookworm ${SHORT_JOB_NAME}"
} else if (env.GIT_BRANCH.startsWith('hotfix/')) {
sh "sudo -H -u eobuilder /usr/local/bin/eobuilder -d bookworm --branch ${env.GIT_BRANCH} --hotfix ${SHORT_JOB_NAME}"
}
}
}
}
}
post {
always {
script {
utils = new Utils()
utils.mail_notify(currentBuild, env, 'ci+jenkins-prometheus-xmpp-alerting@entrouvert.org')
}
}
success {
cleanWs()
}
}
}

56
Makefile Normal file
View File

@ -0,0 +1,56 @@
.PHONY: clean name version fullname dist dist-bzip2
NAME=prometheus-xmpp-alerting
VERSION=$(shell (test -d .git && git describe || cat VERSION) | sed 's/^v//; s/-/./g')
prefix = /usr
prometheus-xmpp-alerting:
go build
chmod +x prometheus-xmpp-alerting
all: prometheus-xmpp-alerting
install: prometheus-xmpp-alerting
clean:
rm -f prometheus-xmpp-alerting
DIST_FILES = \
alert_handler.go \
config.go \
debian \
go.mod \
go.sum \
interfaces.go \
main.go \
prometheus.go \
send_handler.go \
xmpp.go \
Makefile \
dist: clean
-mkdir sdist
rm -rf sdist/$(NAME)-$(VERSION)
mkdir -p sdist/$(NAME)-$(VERSION)
echo $(VERSION) > sdist/$(NAME)-$(VERSION)/VERSION
for i in $(DIST_FILES); do \
cp -R "$$i" sdist/$(NAME)-$(VERSION); \
done
install: prometheus-xmpp-alerting
mkdir -p $(DESTDIR)$(prefix)/bin/
cp -r prometheus-xmpp-alerting $(DESTDIR)$(prefix)/bin/
dist-bzip2: dist
-mkdir sdist
cd sdist && tar cfj ../sdist/$(NAME)-$(VERSION).tar.bz2 $(NAME)-$(VERSION)
version:
@(echo $(VERSION))
name:
@(echo $(NAME))
fullname:
@(echo $(NAME)-$(VERSION))

1
VERSION Normal file
View File

@ -0,0 +1 @@
1.0.0

5
debian/changelog vendored Normal file
View File

@ -0,0 +1,5 @@
gitea (1.18.5-1) unstable; urgency=low
* Initial release
-- Frederic Peters <fpeters@entrouvert.com> Sun, 26 Feb 2023 12:42:38 +0100

11
debian/control vendored Normal file
View File

@ -0,0 +1,11 @@
Source: prometheus-xmpp-alerting
Maintainer: info@entrouvert.com
Section: net
Priority: optional
Homepage: https://github.com/trazfr/prometheus-xmpp-alerting
Build-Depends: debhelper-compat (= 12), xz-utils
Standards-Version: 3.9.6
Package: prometheus-xmpp-alerting
Architecture: amd64
Description: Basic XMPP Alertmanager Webhook Receiver for Prometheus

21
debian/prometheus-xmpp-alerting.service vendored Normal file
View File

@ -0,0 +1,21 @@
# systemd service template for xmpp alerts canal. The actual instances will
# be called "prometheus-xmpp-alerts@name", e.g. "prometheus-xmpp-alerts@gbaffoin". The
# variable %i expands to "name"
[Unit]
Description=Prometheus XMPP Alert Hook
Documentation=https://github.com/trazfr/prometheus-xmpp-alerting
Wants=network-online.target
After=network-online.target
[Service]
Restart=always
User=prometheus
Group=prometheus
StandardError=syslog
Restart=on-failure
KillSignal=SIGQUIT
ExecStart=/usr/bin/prometheus-xmpp-alerting /etc/prometehus-xmpp-alerting/config-%i.json
[Install]
WantedBy=multi-user.target

7
debian/rules vendored Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/make -f
export DEB_BUILD_OPTIONS=nostrip
#export DH_VERBOSE=1
%:
dh $@

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (quilt)