mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-18 14:49:14 +02:00
Separate pipeline for internal/external build and support multi arch (#2991)
* separate pipeline for internal/external build and support multi arch * remove distutils and use node:lts-alpine in both * change base image arguments * fix local naming and base image * address feedback --------- Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
This commit is contained in:
co-authored by
Felix Kunde
parent
842c6eded3
commit
1b4ffb0875
+44
-18
@@ -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
|
||||
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,26 @@ 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
|
||||
|
||||
docker buildx create --config /etc/cdp-buildkitd.toml --driver-opt network=host --bootstrap --use
|
||||
docker buildx build --platform "linux/amd64,linux/arm64" \
|
||||
--build-arg BASE_IMAGE="${ALPINE_BASE_IMAGE}" \
|
||||
-t "${IMAGE}:${CDP_BUILD_VERSION}" \
|
||||
-f docker/Dockerfile \
|
||||
--push .
|
||||
|
||||
if [ -z ${CDP_SOURCE_BRANCH} ]; then
|
||||
cdp-promote-image ${IMAGE}:${CDP_BUILD_VERSION}
|
||||
fi
|
||||
export IMAGE
|
||||
make docker push
|
||||
|
||||
- id: build-operator-ui
|
||||
env:
|
||||
<<: *BUILD_ENV
|
||||
type: script
|
||||
vm_config:
|
||||
type: linux
|
||||
@@ -46,18 +64,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 +88,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
|
||||
|
||||
Reference in New Issue
Block a user