-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Separate pipeline for internal/external build and support multi arch #2991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 4 commits
c2eda08
8769ecc
0441ffd
6d6746a
2186828
860bc06
6a3e809
88e3051
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,8 @@ LOCAL_BUILD_FLAGS ?= $(BUILD_FLAGS) | |
| LDFLAGS ?= -X=main.version=$(VERSION) | ||
| DOCKERDIR = docker | ||
|
|
||
| IMAGE ?= registry.opensource.zalan.do/acid/$(BINARY) | ||
| BASE_IMAGE ?= alpine:latest | ||
| IMAGE ?= ghcr.io/zalando/$(BINARY) | ||
| TAG ?= $(VERSION) | ||
| GITHEAD = $(shell git rev-parse --short HEAD) | ||
| GITURL = $(shell git config --get remote.origin.url) | ||
|
|
@@ -42,8 +43,9 @@ ifndef GOPATH | |
| GOPATH := $(HOME)/go | ||
| endif | ||
|
|
||
| PATH := $(GOPATH)/bin:$(PATH) | ||
| SHELL := env PATH="$(PATH)" $(SHELL) | ||
| PATH := $(GOPATH)/bin:$(PATH) | ||
| SHELL := env PATH="$(PATH)" $(SHELL) | ||
| IMAGE_TAG := $(IMAGE):$(TAG)$(CDP_TAG)$(DEBUG_FRESH)$(DEBUG_POSTFIX) | ||
|
|
||
| default: local | ||
|
|
||
|
|
@@ -66,13 +68,25 @@ docker: ${DOCKERDIR}/${DOCKERFILE} | |
| echo "Version ${VERSION}" | ||
| echo "CDP tag ${CDP_TAG}" | ||
| echo "git describe $(shell git describe --tags --always --dirty)" | ||
| docker build --rm -t "$(IMAGE):$(TAG)$(CDP_TAG)$(DEBUG_FRESH)$(DEBUG_POSTFIX)" -f "${DOCKERDIR}/${DOCKERFILE}" --build-arg VERSION="${VERSION}" . | ||
| docker build --rm -t "$(IMAGE_TAG)" -f "${DOCKERDIR}/${DOCKERFILE}" --build-arg VERSION="${VERSION}" --build-arg BASE_IMAGE="${BASE_IMAGE}" . | ||
|
|
||
| indocker-race: | ||
| docker run --rm -v "${GOPATH}":"${GOPATH}" -e GOPATH="${GOPATH}" -e RACE=1 -w ${PWD} golang:1.25.3 bash -c "make linux" | ||
|
|
||
| push: | ||
| docker push "$(IMAGE):$(TAG)$(CDP_TAG)" | ||
| docker-push: | ||
| echo `(env)` | ||
| echo "Tag ${TAG}" | ||
| echo "Version ${VERSION}" | ||
| echo "CDP tag ${CDP_TAG}" | ||
| echo "git describe $(shell git describe --tags --always --dirty)" | ||
| docker buildx create --config /etc/cdp-buildkitd.toml --driver-opt network=host --bootstrap --use | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe do this step in |
||
| docker buildx build --platform "linux/amd64,linux/arm64" \ | ||
| --build-arg BASE_IMAGE="${BASE_IMAGE}" \ | ||
| --build-arg VERSION="${VERSION}" \ | ||
| -t "$(IMAGE_TAG)" \ | ||
| -f "${DOCKERDIR}/${DOCKERFILE}" \ | ||
| --push . | ||
| echo "$(IMAGE_TAG)" | ||
|
|
||
| mocks: | ||
| GO111MODULE=on go generate ./... | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,15 @@ | ||
| version: "2017-09-20" | ||
| allow_concurrent_steps: true | ||
|
|
||
| build_env: &BUILD_ENV | ||
| PYTHON_BASE_IMAGE: container-registry.zalando.net/library/python-3.11-slim | ||
| ALPINE_BASE_IMAGE: container-registry.zalando.net/library/alpine-3.15 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a very old version of alpine, maybe we can use the latest? |
||
| MULTI_ARCH_REGISTRY: container-registry-test.zalando.net/acid | ||
|
|
||
| pipeline: | ||
| - id: build-postgres-operator | ||
| env: | ||
| <<: *BUILD_ENV | ||
| type: script | ||
| vm_config: | ||
| type: linux | ||
|
|
@@ -17,17 +26,21 @@ pipeline: | |
|
|
||
| - desc: Build Docker image | ||
| cmd: | | ||
| IS_PR_BUILD=${CDP_PULL_REQUEST_NUMBER+"true"} | ||
| if [[ ${CDP_TARGET_BRANCH} == "master" && ${IS_PR_BUILD} != "true" ]] | ||
| then | ||
| IMAGE=registry-write.opensource.zalan.do/acid/postgres-operator | ||
| if [ -z ${CDP_SOURCE_BRANCH} ]; then | ||
| IMAGE=${MULTI_ARCH_REGISTRY}/postgres-operator | ||
| else | ||
| IMAGE=registry-write.opensource.zalan.do/acid/postgres-operator-test | ||
| IMAGE=${MULTI_ARCH_REGISTRY}/postgres-operator-test | ||
| fi | ||
|
|
||
| IMAGE_TAG=$(make docker-push IMAGE=${IMAGE} BASE_IMAGE=${ALPINE_BASE_IMAGE}) | ||
|
|
||
| if [ -z ${CDP_SOURCE_BRANCH} ]; then | ||
| cdp-promote-image ${IMAGE_TAG} | ||
| fi | ||
| export IMAGE | ||
| make docker push | ||
|
|
||
| - id: build-operator-ui | ||
| env: | ||
| <<: *BUILD_ENV | ||
| type: script | ||
| vm_config: | ||
| type: linux | ||
|
|
@@ -46,18 +59,21 @@ pipeline: | |
| - desc: 'Build and push Docker image' | ||
| cmd: | | ||
| cd ui | ||
| IS_PR_BUILD=${CDP_PULL_REQUEST_NUMBER+"true"} | ||
| if [[ ${CDP_TARGET_BRANCH} == "master" && ${IS_PR_BUILD} != "true" ]] | ||
| then | ||
| IMAGE=registry-write.opensource.zalan.do/acid/postgres-operator-ui | ||
| if [ -z ${CDP_SOURCE_BRANCH} ]; then | ||
| IMAGE=${MULTI_ARCH_REGISTRY}/postgres-operator-ui | ||
| else | ||
| IMAGE=registry-write.opensource.zalan.do/acid/postgres-operator-ui-test | ||
| IMAGE=${MULTI_ARCH_REGISTRY}/postgres-operator-ui-test | ||
| fi | ||
|
|
||
| IMAGE_TAG=$(make docker-push IMAGE=${IMAGE} BASE_IMAGE=${PYTHON_BASE_IMAGE}) | ||
|
|
||
| if [ -z ${CDP_SOURCE_BRANCH} ]; then | ||
| cdp-promote-image ${IMAGE_TAG} | ||
| fi | ||
| export IMAGE | ||
| make docker | ||
| make push | ||
|
|
||
| - id: build-logical-backup | ||
| env: | ||
| <<: *BUILD_ENV | ||
| type: script | ||
| vm_config: | ||
| type: linux | ||
|
|
@@ -67,6 +83,11 @@ pipeline: | |
| cmd: | | ||
| cd logical-backup | ||
| export TAG=$(git describe --tags --always --dirty) | ||
| IMAGE="registry-write.opensource.zalan.do/acid/logical-backup" | ||
| docker build --rm -t "$IMAGE:$TAG$CDP_TAG" . | ||
| docker push "$IMAGE:$TAG$CDP_TAG" | ||
| docker buildx create --config /etc/cdp-buildkitd.toml --driver-opt network=host --bootstrap --use | ||
| docker buildx build --platform linux/amd64,linux/arm64 \ | ||
| -t ${MULTI_ARCH_REGISTRY}/postgres-operator-logical-backup:${TAG} \ | ||
| --push . | ||
|
|
||
| if [ -z ${CDP_SOURCE_BRANCH} ]; then | ||
| cdp-promote-image ${MULTI_ARCH_REGISTRY}/postgres-operator-logical-backup:${TAG} | ||
| fi | ||
Uh oh!
There was an error while loading. Please reload this page.