From 3edf33ccc2bde2e483e9dce82edc33a5091b575f Mon Sep 17 00:00:00 2001 From: ObNitram Date: Mon, 19 Jan 2026 23:00:59 +0100 Subject: [PATCH] Add workflows for building and pushing observability components: Alloy, Grafana, Loki, and Prometheus --- .gitea/workflows/action-build-and-push.yaml | 85 +++++++++++++++++++ .gitea/workflows/b&p-observability-alloy.yaml | 17 ++++ .../workflows/b&p-observability-grafana.yaml | 17 ++++ .gitea/workflows/b&p-observability-loki.yaml | 17 ++++ .../b&p-observability-prometheus.yaml | 17 ++++ 5 files changed, 153 insertions(+) create mode 100644 .gitea/workflows/action-build-and-push.yaml create mode 100644 .gitea/workflows/b&p-observability-alloy.yaml create mode 100644 .gitea/workflows/b&p-observability-grafana.yaml create mode 100644 .gitea/workflows/b&p-observability-loki.yaml create mode 100644 .gitea/workflows/b&p-observability-prometheus.yaml diff --git a/.gitea/workflows/action-build-and-push.yaml b/.gitea/workflows/action-build-and-push.yaml new file mode 100644 index 0000000..4e9f848 --- /dev/null +++ b/.gitea/workflows/action-build-and-push.yaml @@ -0,0 +1,85 @@ +name: Docker Build & Push to GitHub Container Registry (Use git tags with format vX.Y.Z as release version) + +on: + workflow_call: + inputs: + image_name: + type: string + required: true + description: > + Docker image name without registry and owner. + Example: observability/alloy + + build_context: + type: string + required: false + default: . + description: > + Path to the Docker build context. + Example: . or ./services/api + + file_path: + type: string + required: false + default: ./Dockerfile + description: > + Path to the Dockerfile relative to the repository root. + Example: ./Dockerfile or ./services/api/Dockerfile + + platforms: + type: string + required: false + default: linux/amd64,linux/arm64 + description: > + Comma-separated list of target platforms to build. + Example: linux/amd64,linux/arm64 + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU (for cross-arch builds) + uses: docker/setup-qemu-action@v3 + with: + platforms: arm64 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Ensure lowercase username because some registries do not allow uppercase letters + id: lowercase + run: echo "username=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ steps.lowercase.outputs.username }}/${{ inputs.image_name }} + tags: | + type=match,pattern=.*(v\d+\.\d+\.\d+),group=1 + type=match,pattern=.*(v\d+\.\d+)\.\d+,group=1 + type=match,pattern=.*(v\d+)\.\d+\.\d+,group=1 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: ${{ inputs.build_context }} + file: ${{ inputs.file_path }} + platforms: ${{ inputs.platforms }} + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.gitea/workflows/b&p-observability-alloy.yaml b/.gitea/workflows/b&p-observability-alloy.yaml new file mode 100644 index 0000000..3b067e0 --- /dev/null +++ b/.gitea/workflows/b&p-observability-alloy.yaml @@ -0,0 +1,17 @@ +name: Build and Push Alloy + +on: + push: + tags: + - "alloy-v*.*.*" + +jobs: + build-and-push: + uses: ./.github/workflows/action-build-and-push.yaml + permissions: + contents: read + packages: write + with: + image_name: observability/alloy + build_context: ./observability/alloy + file_path: ./observability/alloy/Dockerfile \ No newline at end of file diff --git a/.gitea/workflows/b&p-observability-grafana.yaml b/.gitea/workflows/b&p-observability-grafana.yaml new file mode 100644 index 0000000..033d8ce --- /dev/null +++ b/.gitea/workflows/b&p-observability-grafana.yaml @@ -0,0 +1,17 @@ +name: Build and Push Grafana Observability + +on: + push: + tags: + - "grafana-v*.*.*" + +jobs: + build-and-push: + uses: ./.github/workflows/action-build-and-push.yaml + permissions: + contents: read + packages: write + with: + image_name: observability/grafana + build_context: ./observability/grafana + file_path: ./observability/grafana/Dockerfile \ No newline at end of file diff --git a/.gitea/workflows/b&p-observability-loki.yaml b/.gitea/workflows/b&p-observability-loki.yaml new file mode 100644 index 0000000..1fddf96 --- /dev/null +++ b/.gitea/workflows/b&p-observability-loki.yaml @@ -0,0 +1,17 @@ +name: Build and Push Loki Database + +on: + push: + tags: + - "loki-v*.*.*" + +jobs: + build-and-push: + uses: ./.github/workflows/action-build-and-push.yaml + permissions: + contents: read + packages: write + with: + image_name: observability/loki + build_context: ./observability/loki + file_path: ./observability/loki/Dockerfile \ No newline at end of file diff --git a/.gitea/workflows/b&p-observability-prometheus.yaml b/.gitea/workflows/b&p-observability-prometheus.yaml new file mode 100644 index 0000000..b067c48 --- /dev/null +++ b/.gitea/workflows/b&p-observability-prometheus.yaml @@ -0,0 +1,17 @@ +name: Build and Push Prometheus Observability + +on: + push: + tags: + - "prometheus-v*.*.*" + +jobs: + build-and-push: + uses: ./.github/workflows/action-build-and-push.yaml + permissions: + contents: read + packages: write + with: + image_name: observability/prometheus + build_context: ./observability/prometheus + file_path: ./observability/prometheus/Dockerfile \ No newline at end of file