Skip to content

Commit

Permalink
add base certs to rock and add v0.27.0 (#23)
Browse files Browse the repository at this point in the history
* chore(deps): bump alertmanager version to v0.27.0

* add base certs to rock

---------

Co-authored-by: Github Actions <github-actions@github.com>
Co-authored-by: Luca Bello <luca.bello@canonical.com>
  • Loading branch information
3 people authored Mar 13, 2024
1 parent ec50fc6 commit 8b896e6
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 4 deletions.
4 changes: 2 additions & 2 deletions 0.25.0/rockcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: alertmanager
summary: Prometheus alertmanager in a ROCK.
description: Alertmanager handles alerts sent by client applications such as the Prometheus server.
version: "0.25.0"
base: ubuntu:22.04
base: ubuntu@22.04
license: Apache-2.0
# Replicate the tree structure of the original image
# https://github.com/prometheus/alertmanager/blob/main/Dockerfile
Expand Down Expand Up @@ -58,7 +58,7 @@ parts:
# We moved this here because: https://github.com/canonical/rockcraft/issues/343
ca-certs:
plugin: nil
stage-packages: [ca-certificates]
overlay-packages: [ca-certificates]
# The security manifest is required when .deb packages are added to the ROCK
deb-security-manifest:
plugin: nil
Expand Down
4 changes: 2 additions & 2 deletions 0.26.0/rockcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: alertmanager
summary: Prometheus alertmanager in a ROCK.
description: Alertmanager handles alerts sent by client applications such as the Prometheus server.
version: "0.26.0"
base: ubuntu:22.04
base: ubuntu@22.04
license: Apache-2.0
# Replicate the tree structure of the original image
# https://github.com/prometheus/alertmanager/blob/main/Dockerfile
Expand Down Expand Up @@ -58,7 +58,7 @@ parts:
# We moved this here because: https://github.com/canonical/rockcraft/issues/343
ca-certs:
plugin: nil
stage-packages: [ca-certificates]
overlay-packages: [ca-certificates]
# The security manifest is required when .deb packages are added to the ROCK
deb-security-manifest:
plugin: nil
Expand Down
19 changes: 19 additions & 0 deletions 0.27.0/alertmanager.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Dummy config file. Alertmanager won't start without one.
# Source: https://github.com/prometheus/alertmanager/releases/download/v0.24.0/alertmanager-0.24.0.linux-amd64.tar.gz

route:
group_by: ['alertname']
group_wait: 30s
group_interval: 5m
repeat_interval: 1h
receiver: 'web.hook'
receivers:
- name: 'web.hook'
webhook_configs:
- url: 'http://127.0.0.1:5001/'
inhibit_rules:
- source_match:
severity: 'critical'
target_match:
severity: 'warning'
equal: ['alertname', 'dev', 'instance']
71 changes: 71 additions & 0 deletions 0.27.0/rockcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: alertmanager
summary: Prometheus alertmanager in a ROCK.
description: Alertmanager handles alerts sent by client applications such as the Prometheus server.
version: "0.27.0"
base: ubuntu@22.04
license: Apache-2.0
# Replicate the tree structure of the original image
# https://github.com/prometheus/alertmanager/blob/main/Dockerfile
# /
# ├── bin
# │ ├── alertmanager
# │ └── amtool
# └── etc
# └── alertmanager
# └── alertmanager.yml
services:
alertmanager:
command: /bin/alertmanager --config.file=/etc/alertmanager/alertmanager.yml --storage.path=/alertmanager
override: replace
startup: enabled
platforms:
amd64:
parts:
alertmanager:
plugin: go
source: https://github.com/prometheus/alertmanager.git
source-type: git
source-tag: "v0.27.0"
# Override until this issue is fixed: https://github.com/canonical/rockcraft/issues/21
build-snaps:
- go/1.21/stable
stage-packages:
- ca-certificates
override-build: |
set -x
REVISION=$(git rev-parse --short HEAD)
BRANCH=$(git rev-parse --abbrev-ref HEAD)
go build \
-ldflags="-X github.com/prometheus/common/version.Version=$(cat ./VERSION) -X github.com/prometheus/common/version.Revision=${REVISION} -X github.com/prometheus/common/version.Branch=${BRANCH} -X github.com/prometheus/common/version.BuildUser=$(whoami)@$(hostname) -X github.com/prometheus/common/version.BuildDate=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
-o bin/alertmanager \
./cmd/alertmanager
go build \
-ldflags="-X github.com/prometheus/common/version.Version=$(cat ./VERSION) -X github.com/prometheus/common/version.Revision=${REVISION} -X github.com/prometheus/common/version.Branch=${BRANCH} -X github.com/prometheus/common/version.BuildUser=$(whoami)@$(hostname) -X github.com/prometheus/common/version.BuildDate=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
-o bin/amtool \
./cmd/amtool
install -D -m755 bin/alertmanager ${CRAFT_PART_INSTALL}/bin/alertmanager
install -D -m755 bin/amtool ${CRAFT_PART_INSTALL}/bin/amtool
stage:
- bin/alertmanager
- bin/amtool
default-config:
plugin: dump
source: .
organize:
alertmanager.yml: etc/alertmanager/alertmanager.yml
stage:
- etc/alertmanager/alertmanager.yml
# We moved this here because: https://github.com/canonical/rockcraft/issues/343
ca-certs:
plugin: nil
overlay-packages: [ca-certificates]
# The security manifest is required when .deb packages are added to the ROCK
deb-security-manifest:
plugin: nil
after:
- alertmanager
- ca-certs
override-prime: |
set -x
mkdir -p $CRAFT_PRIME/usr/share/rocks/
(echo "# os-release" && cat /etc/os-release && echo "# dpkg-query" && dpkg-query --admindir=$CRAFT_PRIME/var/lib/dpkg/ -f '${db:Status-Abbrev},${binary:Package},${Version},${source:Package},${Source:Version}\n' -W) > $CRAFT_PRIME/usr/share/rocks/dpkg.query

0 comments on commit 8b896e6

Please sign in to comment.