Skip to content

Commit

Permalink
CLOUDP-219172: Respect old build flows (#1303)
Browse files Browse the repository at this point in the history
* Respect old build flows

Signed-off-by: Jose Vazquez <jose.vazquez@mongodb.com>

* Apply suggestions from code review

Co-authored-by: Sergiusz Urbaniak <sergiusz.urbaniak@gmail.com>

---------

Signed-off-by: Jose Vazquez <jose.vazquez@mongodb.com>
Co-authored-by: Sergiusz Urbaniak <sergiusz.urbaniak@gmail.com>
  • Loading branch information
josvazg and s-urbaniak committed Jan 3, 2024
1 parent 37074fe commit c360dae
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 33 deletions.
23 changes: 16 additions & 7 deletions .github/workflows/rebuild-released-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ name: Daily build
on:
schedule:
- cron: "0 1 * * 1-5"
- cron: "0 3 * * 1-5"
workflow_dispatch:
inputs:
image_repo:
Expand Down Expand Up @@ -67,10 +66,6 @@ jobs:
ref: "v${{ matrix.version }}"
submodules: true
fetch-depth: 0
- name: Upgrade build Makefile & Dockerfile # TODO: remove after version 1.9 is deprecated
run: |
git remote show origin
git checkout origin/${{ github.ref_name }} -- Makefile fast.Dockerfile scripts/version-check.sh scripts/module-path.sh
- name: Set up Go
uses: actions/setup-go@v5
with:
Expand All @@ -87,8 +82,22 @@ jobs:
shell: bash
run: |
go mod download
- name: Choose Dockerfile
id: pick-dockerfile
run: |
if test -f "fast.Dockerfile"; then
echo "dockerfile=fast.Dockerfile" >> $GITHUB_OUTPUT
else
echo "dockerfile=Dockerfile" >> $GITHUB_OUTPUT
fi
- name: Build all platforms & check version
run: make all-platforms check-version VERSION=${{ matrix.version }}
if: steps.pick-dockerfile.outputs.dockerfile == 'fast.Dockerfile'
run: |
make all-platforms VERSION=${{ github.event.inputs.version }}
# not all versiions Makefiles support the version check
if make |grep -q check-version; then
make check-version VERSION=${{ github.event.inputs.version }}
fi
- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v3
with:
Expand All @@ -108,7 +117,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: fast.Dockerfile
file: ${{ steps.pick-dockerfile.outputs.dockerfile }}
build-args: VERSION=${{ matrix.version }}
platforms: ${{ fromJSON(needs.read-versions.outputs.matrix).platforms }}
cache-from: type=gha
Expand Down
20 changes: 15 additions & 5 deletions .github/workflows/release-post-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,27 @@ jobs:
make release-helm JWT_RSA_PEM_KEY_BASE64="${{ secrets.AKO_RELEASER_RSA_KEY_BASE64 }}" \
JWT_APP_ID="${{ secrets.AKO_RELEASER_APP_ID }}" \
VERSION="${{ steps.tag.outputs.version }}"
- name: Upgrade build Makefile & Dockerfile # TODO: remove after version 1.9 is deprecated
- name: Choose Dockerfile
id: pick-dockerfile
run: |
git remote show origin
git checkout origin/${{ github.ref_name }} -- Makefile fast.Dockerfile scripts/version-check.sh scripts/module-path.sh
if test -f "fast.Dockerfile"; then
echo "dockerfile=fast.Dockerfile" >> $GITHUB_OUTPUT
else
echo "dockerfile=Dockerfile" >> $GITHUB_OUTPUT
fi
- name: Build all platforms & check version
run: make all-platforms check-version VERSION=${{ github.event.inputs.version }}
if: steps.pick-dockerfile.outputs.dockerfile == 'fast.Dockerfile'
run: |
make all-platforms VERSION=${{ github.event.inputs.version }}
# not all versiions Makefiles support the version check
if make | grep -q check-version; then
make check-version VERSION=${{ github.event.inputs.version }}
fi
- name: Build and Push image
uses: ./.github/actions/build-push-image
with:
repository: ${{ env.IMAGE_REPOSITORY }}
file: fast.Dockerfile
file: ${{ steps.pick-dockerfile.outputs.dockerfile }}
version: ${{ steps.tag.outputs.version }}
certified_version: ${{ steps.tag.outputs.certified_version }}
platforms: linux/amd64,linux/arm64
Expand Down
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@ JWT_APP_ID ?= ""
# golangci-lint
GOLANGCI_LINT_VERSION := v1.54.2

# The module import path varies after version 1
MODULE_PATH = $(shell ./scripts/module-path.sh)

.DEFAULT_GOAL := help
.PHONY: help
help: ## Show this help screen
Expand Down Expand Up @@ -169,7 +166,7 @@ bin/$(TARGET_OS)/$(TARGET_ARCH):

bin/$(TARGET_OS)/$(TARGET_ARCH)/manager: $(GO_SOURCES) bin/$(TARGET_OS)/$(TARGET_ARCH)
@echo "Building operator with version $(VERSION); $(TARGET_OS) - $(TARGET_ARCH)"
CGO_ENABLED=0 GOOS=$(TARGET_OS) GOARCH=$(TARGET_ARCH) go build -o $@ -ldflags="-X $(MODULE_PATH)/pkg/version.Version=$(VERSION)" cmd/manager/main.go
CGO_ENABLED=0 GOOS=$(TARGET_OS) GOARCH=$(TARGET_ARCH) go build -o $@ -ldflags="-X github.com/mongodb/mongodb-atlas-kubernetes/v2/pkg/version.Version=$(VERSION)" cmd/manager/main.go
@touch $@

bin/manager: bin/$(TARGET_OS)/$(TARGET_ARCH)/manager
Expand Down Expand Up @@ -413,7 +410,7 @@ tools/makejwt/makejwt: tools/makejwt/*.go
cd tools/makejwt && go test . && go build .

.PHONY: check-version
check-version:
check-version: ## Check the version is correct & releasable (vX.Y.Z and not "*-dirty" or "unknown")
VERSION=$(VERSION) BINARY=bin/$(TARGET_OS)/$(TARGET_ARCH)/manager ./scripts/version-check.sh

.PHONY: release-helm
Expand Down
16 changes: 0 additions & 16 deletions scripts/module-path.sh

This file was deleted.

0 comments on commit c360dae

Please sign in to comment.