diff --git a/.github/workflows/build-rock.yaml b/.github/workflows/build-rock.yaml deleted file mode 100644 index ff39b99..0000000 --- a/.github/workflows/build-rock.yaml +++ /dev/null @@ -1,16 +0,0 @@ -name: Build ROCK - -on: - workflow_dispatch: {} - push: - branches: - - main - schedule: - - cron: "0 12 * * 0" - -jobs: - build: - uses: canonical/observability/.github/workflows/build-rock.yaml@main - secrets: inherit - with: - rock-name: alertmanager diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml new file mode 100644 index 0000000..4e0077b --- /dev/null +++ b/.github/workflows/pull-request.yaml @@ -0,0 +1,16 @@ +name: Pull Requests + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + pull_request: + branches: + - main + +jobs: + pull-request: + name: PR + uses: canonical/observability/.github/workflows/rock-pull-request.yaml@main + secrets: inherit diff --git a/.github/workflows/rock-release-dev.yaml b/.github/workflows/rock-release-dev.yaml new file mode 100644 index 0000000..fb7c403 --- /dev/null +++ b/.github/workflows/rock-release-dev.yaml @@ -0,0 +1,18 @@ +name: "Publish ROCK to GHCR:dev" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + workflow_dispatch: {} + push: + branches: + - main + +jobs: + build: + uses: canonical/observability/.github/workflows/rock-release-dev.yaml@main + secrets: inherit + with: + rock-name: alertmanager diff --git a/.github/workflows/rock-release-oci-factory.yaml b/.github/workflows/rock-release-oci-factory.yaml new file mode 100644 index 0000000..495bffd --- /dev/null +++ b/.github/workflows/rock-release-oci-factory.yaml @@ -0,0 +1,13 @@ +name: Open a PR to OCI Factory + +on: + workflow_dispatch: {} # TODO: Test to see if this works + push: + branches: + - main + +jobs: + build: + uses: canonical/observability/.github/workflows/rock-release-oci-factory.yaml@main + with: + rock-name: alertmanager diff --git a/.github/workflows/update-rock.yaml b/.github/workflows/rock-update.yaml similarity index 77% rename from .github/workflows/update-rock.yaml rename to .github/workflows/rock-update.yaml index cf5b0d4..96869b9 100644 --- a/.github/workflows/update-rock.yaml +++ b/.github/workflows/rock-update.yaml @@ -7,7 +7,7 @@ on: jobs: build: - uses: canonical/observability/.github/workflows/update-rock.yaml@main + uses: canonical/observability/.github/workflows/rock-update.yaml@main with: rock-name: alertmanager source-repo: prometheus/alertmanager diff --git a/alertmanager.yml b/0.25.0/alertmanager.yml similarity index 100% rename from alertmanager.yml rename to 0.25.0/alertmanager.yml diff --git a/rockcraft.yaml b/0.25.0/rockcraft.yaml similarity index 100% rename from rockcraft.yaml rename to 0.25.0/rockcraft.yaml diff --git a/README.md b/README.md index c6bd5f3..27e5753 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,16 @@ # alertmanager-rock -[![Build ROCK](https://github.com/canonical/alertmanager-rock/actions/workflows/build-rock.yaml/badge.svg)](https://github.com/canonical/alertmanager-rock/actions/workflows/build-rock.yaml) +[![Open a PR to OCI Factory](https://github.com/canonical/alertmanager-rock/actions/workflows/rock-release-oci-factory.yaml/badge.svg)](https://github.com/canonical/alertmanager-rock/actions/workflows/rock-release-oci-factory.yaml) +[![Publish to GHCR:dev](https://github.com/canonical/alertmanager-rock/actions/workflows/rock-release-dev.yaml/badge.svg)](https://github.com/canonical/alertmanager-rock/actions/workflows/rock-release-dev.yaml) +[![Update ROCK](https://github.com/canonical/alertmanager-rock/actions/workflows/rock-update.yaml/badge.svg)](https://github.com/canonical/alertmanager-rock/actions/workflows/rock-update.yaml) -Build an alertmanager image using -[rockcraft](https://github.com/canonical/rockcraft), maintaining the same file -hierarchy as the -[`prometheus/alertmanager`](https://github.com/prometheus/alertmanager/blob/main/Dockerfile) -image. +[ROCKs](https://canonical-rockcraft.readthedocs-hosted.com/en/latest/) for [Alertmanager](https://prometheus.io/docs/alerting/latest/alertmanager/). +This repository holds all the necessary files to build ROCKs for the upstream versions we support. The Alertmanager ROCK is used by the [alertmanager-k8s-operator](https://github.com/canonical/alertmanager-k8s-operator) charm. -## Usage -```shell -rockcraft pack -v -``` +The ROCKs on this repository are built with [OCI Factory](https://github.com/canonical/oci-factory/), which also takes care of periodically rebuilding the images. -## Manual verification -```shell -tar tf alertmanager_0.24.0_amd64.rock -tar -O -xf alertmanager_0.24.0_amd64.rock oci-layout +Automation takes care of: +* validating PRs, by simply trying to build the ROCK; +* pulling upstream releases, creating a PR with the necessary files to be manually reviewed; +* releasing to GHCR at [ghcr.io/canonical/alertmanager:dev](https://ghcr.io/canonical/alertmanager:dev), when merging to main, for development purposes. -skopeo --insecure-policy copy oci-archive:alertmanager_0.24.0_amd64.rock docker-daemon:alertmanager:0.24.0 -dive alertmanager:0.24.0 - -docker run --rm -d -p 9093:9093 alertmanager:0.24.0 -curl localhost:9093/api/v1/alerts -``` - -## Build automation -This repo has workflows in place to: -- update `rockcraft.yaml` when new versions of alertmanager are published; -- publish a new rock on every merge.