From e0c472a02d2a731d8f6eca12bfe8fb39b4dc8289 Mon Sep 17 00:00:00 2001 From: Jan Larwig Date: Tue, 12 Aug 2025 08:17:26 +0200 Subject: [PATCH] feat(e2e): add make build target for local docker image Signed-off-by: Jan Larwig --- .github/workflows/ci.yml | 108 +++++++++++++++++++-------------------- .gitignore | 1 + Makefile | 4 ++ 3 files changed, 59 insertions(+), 54 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b8bcd580..089c29ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,79 +3,79 @@ name: Continuous Integration on: push: branches: - - '**' + - master pull_request: branches: - - '**' + - "**" jobs: build: runs-on: ubuntu-latest env: COVER: true steps: - - name: Check out code - uses: actions/checkout@v5 + - name: Check out code + uses: actions/checkout@v5 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version-file: go.mod - id: go + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + id: go - - name: Get dependencies - env: - # renovate: datasource=github-tags depName=golangci/golangci-lint - GOLANGCI_LINT_VERSION: v2.4.0 - run: | - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION} - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter - chmod +x ./cc-test-reporter + - name: Get dependencies + env: + # renovate: datasource=github-tags depName=golangci/golangci-lint + GOLANGCI_LINT_VERSION: v2.4.0 + run: | + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION} + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter + chmod +x ./cc-test-reporter - - name: Verify Code Generation - run: | - make verify-generate + - name: Verify Code Generation + run: | + make verify-generate - - name: Lint - run: | - make lint + - name: Lint + run: | + make lint - - name: Build - if: (!startsWith(github.head_ref, 'release')) - run: | - make build + - name: Build + if: (!startsWith(github.head_ref, 'release')) + run: | + make build - # For release testing - - name: Build All - if: github.base_ref == 'master' && startsWith(github.head_ref, 'release') - run: | - make release + # For release testing + - name: Build All + if: github.base_ref == 'master' && startsWith(github.head_ref, 'release') + run: | + make release - - name: Test - env: - CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} - run: | - ./.github/workflows/test.sh + - name: Test + env: + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + run: | + ./.github/workflows/test.sh docker: runs-on: ubuntu-latest steps: - - name: Check out code - uses: actions/checkout@v5 + - name: Check out code + uses: actions/checkout@v5 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 - - name: Docker Build - if: (!startsWith(github.head_ref, 'release')) - run: | - make build-docker + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3 - # For release testing - - name: Docker Build All - if: github.base_ref == 'master' && startsWith(github.head_ref, 'release') - run: | - make build-docker-all + - name: Docker Build + if: (!startsWith(github.head_ref, 'release')) + run: | + make build-docker + + # For release testing + - name: Docker Build All + if: github.base_ref == 'master' && startsWith(github.head_ref, 'release') + run: | + make build-docker-all diff --git a/.gitignore b/.gitignore index a7ee4162..5f553c87 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ release .env .bundle c.out +e2e # Go.gitignore # Compiled Object files, Static and Dynamic libs (Shared Objects) diff --git a/Makefile b/Makefile index 091ca726..ddbb0531 100644 --- a/Makefile +++ b/Makefile @@ -75,6 +75,10 @@ DOCKER_BUILDX_PUSH_X_PLATFORM_ALPINE := $(DOCKER_BUILDX_X_PLATFORM_ALPINE) --pus .PHONY: build-docker build-docker: build-distroless build-alpine ## Build multi architecture docker images in both flavours (distroless / alpine) +.PHONY: build-docker-local +build-docker-local: ## Build distroless docker image and locally load into docker images + $(DOCKER_BUILDX) --load -t $(REGISTRY)/$(REPOSITORY):latest -t $(REGISTRY)/$(REPOSITORY):${VERSION} . + .PHONY: build-distroless build-distroless: ## Build multi architecture distroless based docker image $(DOCKER_BUILDX_X_PLATFORM) -t $(REGISTRY)/$(REPOSITORY):latest -t $(REGISTRY)/$(REPOSITORY):${VERSION} .