From 7fefa16deeb8bd6661c13f3903d9a4035b120083 Mon Sep 17 00:00:00 2001 From: Mauro Ezequiel Moltrasio Date: Thu, 13 Feb 2025 11:34:25 +0100 Subject: [PATCH 1/5] Add gcovr to collector devcontainer --- collector/Containerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/collector/Containerfile b/collector/Containerfile index 82cb376..27bbd88 100644 --- a/collector/Containerfile +++ b/collector/Containerfile @@ -8,6 +8,7 @@ RUN dnf install -y epel-release && \ fzf \ inotify-tools \ podman-docker \ + gcovr \ zsh && \ dnf clean all && \ # Install my dev environment From 0322f9a5b28d33b2be2fd8a2ed482d1ab406acb8 Mon Sep 17 00:00:00 2001 From: Mauro Ezequiel Moltrasio Date: Thu, 13 Feb 2025 11:40:16 +0100 Subject: [PATCH 2/5] Install pip --- collector/Containerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collector/Containerfile b/collector/Containerfile index 27bbd88..d701142 100644 --- a/collector/Containerfile +++ b/collector/Containerfile @@ -8,7 +8,7 @@ RUN dnf install -y epel-release && \ fzf \ inotify-tools \ podman-docker \ - gcovr \ + python-pip \ zsh && \ dnf clean all && \ # Install my dev environment From a4849af132134507ac9aa51b57f9ca6667b27700 Mon Sep 17 00:00:00 2001 From: Mauro Ezequiel Moltrasio Date: Thu, 13 Feb 2025 11:45:19 +0100 Subject: [PATCH 3/5] Override push restriction --- .github/workflows/main.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 36629f8..a085f3a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,7 +23,6 @@ jobs: make -C ${{ matrix.image }} build - name: Login to Quay.io - if: github.event_name != 'pull_request' uses: docker/login-action@v2 with: registry: quay.io @@ -31,6 +30,5 @@ jobs: password: ${{ secrets.QUAY_TOKEN }} - name: Build and push - if: github.event_name != 'pull_request' run: | make -C ${{ matrix.image }} push From 8fbee7ffb0f5e868140c6aa43053fdf00baec5a4 Mon Sep 17 00:00:00 2001 From: Mauro Ezequiel Moltrasio Date: Thu, 13 Feb 2025 11:59:23 +0100 Subject: [PATCH 4/5] Allow image push from PRs --- .github/workflows/main.yml | 5 +++++ Makefile | 2 ++ collector/Makefile | 11 ++++++++--- falco-libs/Makefile | 11 +++++++++-- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a085f3a..766f71a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,3 +32,8 @@ jobs: - name: Build and push run: | make -C ${{ matrix.image }} push + + - name: Retag main branch and push + if: github.event_name == 'push' + run: | + make -C ${{ matrix.image }} tag-push-main diff --git a/Makefile b/Makefile index 2d7c338..bbdb591 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +SUFFIX ?= $(shell git rev-parse --short HEAD) + .PHONY: all all: collector falco clean deploy diff --git a/collector/Makefile b/collector/Makefile index 9876ab0..ac4bfa6 100644 --- a/collector/Makefile +++ b/collector/Makefile @@ -3,18 +3,23 @@ BUILDER_IMAGE=quay.io/mmoltras/devcontainers:collector .PHONY: build build: docker build \ - --tag $(BUILDER_IMAGE) \ + --tag $(BUILDER_IMAGE)-$(SUFFIX) \ -f Containerfile \ $(CURDIR) .PHONY: push push: build - docker push $(BUILDER_IMAGE) + docker push $(BUILDER_IMAGE)-$(SUFFIX) -.PHONY:teardown +.PHONY: teardown teardown: docker rm -f collector-builder +.PHONY: tag-push-main +tag-push-main: build + docker tag $(BUILDER_IMAGE)-$(SUFFIX) $(BUILDER_IMAGE) + docker push $(BUILDER_IMAGE) + .PHONY: deploy deploy: build teardown docker run -idP --privileged --name devcontainers-collector-builder \ diff --git a/falco-libs/Makefile b/falco-libs/Makefile index f97ccf6..aa66a8e 100644 --- a/falco-libs/Makefile +++ b/falco-libs/Makefile @@ -1,3 +1,5 @@ +BUILDER_IMAGE=quay.io/mmoltras/devcontainers:falco-libs + .PHONY: clang-config clang-config: envsubst < $(CURDIR)/clangd.tpl.yaml > $(CURDIR)/clangd.yaml @@ -9,18 +11,23 @@ clean: .PHONY: build build: clang-config docker build \ - --tag quay.io/mmoltras/devcontainers:falco-libs \ + --tag $(BUILDER_IMAGE)-$(SUFFIX) \ -f Containerfile \ $(CURDIR) .PHONY: push push: build - docker push quay.io/mmoltras/devcontainers:falco-libs + docker push $(BUILDER_IMAGE)-$(SUFFIX) .PHONY: teardown teardown: clean docker rm -f libs-builder +.PHONY: tag-push-main +tag-push-main: build + docker tag $(BUILDER_IMAGE)-$(SUFFIX) $(BUILDER_IMAGE) + docker push $(BUILDER_IMAGE) + .PHONY: deploy deploy: build teardown docker run -id --privileged --name libs-builder \ From a9ebbdf2f49d097f98dc3f0f3fa4551c24bac42f Mon Sep 17 00:00:00 2001 From: Mauro Ezequiel Moltrasio Date: Thu, 13 Feb 2025 12:42:02 +0100 Subject: [PATCH 5/5] Add constants.Makefile --- Makefile | 2 +- collector/Makefile | 2 ++ constants.Makefile | 1 + falco-libs/Makefile | 2 ++ 4 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 constants.Makefile diff --git a/Makefile b/Makefile index bbdb591..edb9a74 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -SUFFIX ?= $(shell git rev-parse --short HEAD) +include constants.Makefile .PHONY: all all: collector falco clean deploy diff --git a/collector/Makefile b/collector/Makefile index ac4bfa6..7c8b22f 100644 --- a/collector/Makefile +++ b/collector/Makefile @@ -1,3 +1,5 @@ +include ../constants.Makefile + BUILDER_IMAGE=quay.io/mmoltras/devcontainers:collector .PHONY: build diff --git a/constants.Makefile b/constants.Makefile new file mode 100644 index 0000000..f2857dd --- /dev/null +++ b/constants.Makefile @@ -0,0 +1 @@ +SUFFIX ?= $(shell git rev-parse --short HEAD) diff --git a/falco-libs/Makefile b/falco-libs/Makefile index aa66a8e..93d6768 100644 --- a/falco-libs/Makefile +++ b/falco-libs/Makefile @@ -1,3 +1,5 @@ +include ../constants.Makefile + BUILDER_IMAGE=quay.io/mmoltras/devcontainers:falco-libs .PHONY: clang-config