From 474f7ad356932d7e3b1ec46625920b70dd851f8b Mon Sep 17 00:00:00 2001 From: Paul Meyer <49727155+katexochen@users.noreply.github.com> Date: Wed, 30 Nov 2022 17:20:16 +0100 Subject: [PATCH] ci: build logcollector images Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com> --- .../actions/build_micro_service/action.yml | 1 + .../workflows/build-logcollector-images.yml | 39 +++++++++++++++++++ .../workflows/build-micro-service-manual.yml | 6 +++ debugd/internal/debugd/logcollector/Makefile | 7 ---- .../debugd/logcollector/filebeat/Dockerfile | 4 +- .../debugd/logcollector/logstash/Dockerfile | 6 +-- 6 files changed, 51 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/build-logcollector-images.yml delete mode 100644 debugd/internal/debugd/logcollector/Makefile diff --git a/.github/actions/build_micro_service/action.yml b/.github/actions/build_micro_service/action.yml index bfafcfe9b..dd2a58758 100644 --- a/.github/actions/build_micro_service/action.yml +++ b/.github/actions/build_micro_service/action.yml @@ -46,6 +46,7 @@ runs: type=raw,value=${{ inputs.pushTag }},enable=${{ '' != inputs.pushTag }} type=raw,value=${{ steps.pseudo-version.outputs.pseudoVersion }},enable=${{ '' != steps.pseudo-version.outputs.pseudoVersion }} type=ref,event=branch + - name: Log in to the Container registry id: docker-login uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # tag=v2.1.0 diff --git a/.github/workflows/build-logcollector-images.yml b/.github/workflows/build-logcollector-images.yml new file mode 100644 index 000000000..018274638 --- /dev/null +++ b/.github/workflows/build-logcollector-images.yml @@ -0,0 +1,39 @@ +name: Build logcollector images + +on: + workflow_dispatch: + push: + branches: + - main + paths: + - "debugd/internal/debugd/logcollector/Makefile" + - "debugd/internal/debugd/logcollector/filebeat/**" + - "debugd/internal/debugd/logcollector/logstash/**" + - ".github/workflows/build-logcollector-images.yml" + +jobs: + build-logcollector-images: + runs-on: ubuntu-22.04 + permissions: + contents: read + packages: write + steps: + - name: Check out repository + id: checkout + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3.1.0 + with: + ref: ${{ github.head_ref }} + + - name: Build and upload logstash container image + uses: ./.github/actions/build_micro_service + with: + name: logstash-debugd + dockerfile: debugd/internal/debugd/logcollector/logstash/Dockerfile + githubToken: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and upload filebeat container image + uses: ./.github/actions/build_micro_service + with: + name: filebeat-debugd + dockerfile: debugd/internal/debugd/logcollector/filebeat/Dockerfile + githubToken: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/build-micro-service-manual.yml b/.github/workflows/build-micro-service-manual.yml index af1396f59..e3eb3ba6b 100644 --- a/.github/workflows/build-micro-service-manual.yml +++ b/.github/workflows/build-micro-service-manual.yml @@ -11,6 +11,8 @@ on: - "kmsserver" - "verification-service" - "qemu-metadata-api" + - "filebeat-debug" + - "logstash-debug" required: true default: "join-service" imageTag: @@ -53,6 +55,10 @@ jobs: echo "microServiceDockerfile=verify/Dockerfile" >> "$GITHUB_ENV" ;; "qemu-metadata-api" ) echo "microServiceDockerfile=hack/qemu-metadata-api/Dockerfile" >> "$GITHUB_ENV" ;; + "filebeat-debug" ) + echo "microServiceDockerfile=debugd/internal/debugd/logcollector/filebeat/Dockerfile" >> "$GITHUB_ENV" ;; + "logstash-debug" ) + echo "microServiceDockerfile=debugd/internal/debugd/logcollector/logstash/Dockerfile" >> "$GITHUB_ENV" ;; esac - name: Build and upload container image diff --git a/debugd/internal/debugd/logcollector/Makefile b/debugd/internal/debugd/logcollector/Makefile deleted file mode 100644 index d3e8e9776..000000000 --- a/debugd/internal/debugd/logcollector/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -.PHONY: containers - -containers: - docker build ./filebeat -t ghcr.io/edgelesssys/constellation/filebeat-debug - docker build ./logstash -t ghcr.io/edgelesssys/constellation/logstash-debug - docker push ghcr.io/edgelesssys/constellation/filebeat-debug - docker push ghcr.io/edgelesssys/constellation/logstash-debug diff --git a/debugd/internal/debugd/logcollector/filebeat/Dockerfile b/debugd/internal/debugd/logcollector/filebeat/Dockerfile index 4b37293c6..e947e7be9 100644 --- a/debugd/internal/debugd/logcollector/filebeat/Dockerfile +++ b/debugd/internal/debugd/logcollector/filebeat/Dockerfile @@ -1,8 +1,8 @@ -FROM fedora:37@sha256:f2c083c0b7d2367a375f15e002c2dc7baaca2b3181ace61f9d5113a8fe2f6b44 +FROM fedora:37@sha256:f2c083c0b7d2367a375f15e002c2dc7baaca2b3181ace61f9d5113a8fe2f6b44 AS release RUN dnf install -y https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-8.5.0-x86_64.rpm systemd-devel -COPY filebeat.yml /usr/share/filebeat/filebeat.yml +COPY debugd/internal/debugd/logcollector/filebeat/filebeat.yml /usr/share/filebeat/filebeat.yml RUN chmod 600 /usr/share/filebeat/filebeat.yml diff --git a/debugd/internal/debugd/logcollector/logstash/Dockerfile b/debugd/internal/debugd/logcollector/logstash/Dockerfile index 11b6bb0b2..a2337bb49 100644 --- a/debugd/internal/debugd/logcollector/logstash/Dockerfile +++ b/debugd/internal/debugd/logcollector/logstash/Dockerfile @@ -1,9 +1,9 @@ -FROM docker.io/opensearchproject/logstash-oss-with-opensearch-output-plugin:7.16.2 +FROM docker.io/opensearchproject/logstash-oss-with-opensearch-output-plugin:7.16.2 AS release RUN rm -f /usr/share/logstash/pipeline/logstash.conf -COPY config/ /usr/share/logstash/config/ +COPY debugd/internal/debugd/logcollector/logstash/config/ /usr/share/logstash/config/ -COPY templates/ /usr/share/constellogs/templates/ +COPY debugd/internal/debugd/logcollector/logstash/templates/ /usr/share/constellogs/templates/ ENTRYPOINT ["/usr/share/logstash/bin/logstash"]