diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 36629f8..766f71a 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,10 @@ jobs: password: ${{ secrets.QUAY_TOKEN }} - name: Build and push - if: github.event_name != 'pull_request' 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..edb9a74 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +include constants.Makefile + .PHONY: all all: collector falco clean deploy diff --git a/collector/Containerfile b/collector/Containerfile index 82cb376..d701142 100644 --- a/collector/Containerfile +++ b/collector/Containerfile @@ -8,6 +8,7 @@ RUN dnf install -y epel-release && \ fzf \ inotify-tools \ podman-docker \ + python-pip \ zsh && \ dnf clean all && \ # Install my dev environment diff --git a/collector/Makefile b/collector/Makefile index 9876ab0..7c8b22f 100644 --- a/collector/Makefile +++ b/collector/Makefile @@ -1,20 +1,27 @@ +include ../constants.Makefile + 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/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 f97ccf6..93d6768 100644 --- a/falco-libs/Makefile +++ b/falco-libs/Makefile @@ -1,3 +1,7 @@ +include ../constants.Makefile + +BUILDER_IMAGE=quay.io/mmoltras/devcontainers:falco-libs + .PHONY: clang-config clang-config: envsubst < $(CURDIR)/clangd.tpl.yaml > $(CURDIR)/clangd.yaml @@ -9,18 +13,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 \