110 lines
3.2 KiB
YAML
110 lines
3.2 KiB
YAML
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
|
|
size: large
|
|
image: cdp-runtime/go
|
|
cache:
|
|
paths:
|
|
- /go/pkg/mod # pkg cache for Go modules
|
|
- ~/.cache/go-build # Go build cache
|
|
commands:
|
|
- desc: Run unit tests
|
|
cmd: |
|
|
make deps mocks test
|
|
|
|
- desc: Build Docker image
|
|
cmd: |
|
|
if [ -z ${CDP_SOURCE_BRANCH} ]; then
|
|
IMAGE=${MULTI_ARCH_REGISTRY}/postgres-operator
|
|
else
|
|
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
|
|
|
|
- id: build-operator-ui
|
|
env:
|
|
<<: *BUILD_ENV
|
|
type: script
|
|
vm_config:
|
|
type: linux
|
|
|
|
commands:
|
|
- desc: 'Prepare environment'
|
|
cmd: |
|
|
apt-get update
|
|
apt-get install -y build-essential
|
|
|
|
- desc: 'Compile JavaScript app'
|
|
cmd: |
|
|
cd ui
|
|
make appjs
|
|
|
|
- desc: 'Build and push Docker image'
|
|
cmd: |
|
|
cd ui
|
|
if [ -z ${CDP_SOURCE_BRANCH} ]; then
|
|
IMAGE=${MULTI_ARCH_REGISTRY}/postgres-operator-ui
|
|
else
|
|
IMAGE=${MULTI_ARCH_REGISTRY}/postgres-operator-ui-test
|
|
fi
|
|
|
|
make appjs
|
|
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="${PYTHON_BASE_IMAGE}" \
|
|
-t ${IMAGE}:${CDP_BUILD_VERSION} \
|
|
--push .
|
|
|
|
if [ -z ${CDP_SOURCE_BRANCH} ]; then
|
|
cdp-promote-image ${IMAGE}:${CDP_BUILD_VERSION}
|
|
fi
|
|
|
|
- id: build-logical-backup
|
|
env:
|
|
<<: *BUILD_ENV
|
|
type: script
|
|
vm_config:
|
|
type: linux
|
|
|
|
commands:
|
|
- desc: Build image
|
|
cmd: |
|
|
cd logical-backup
|
|
|
|
if [ -z ${CDP_SOURCE_BRANCH} ]; then
|
|
IMAGE=${MULTI_ARCH_REGISTRY}/logical-backup
|
|
else
|
|
IMAGE=${MULTI_ARCH_REGISTRY}/logical-backup-test
|
|
fi
|
|
|
|
docker buildx create --config /etc/cdp-buildkitd.toml --driver-opt network=host --bootstrap --use
|
|
docker buildx build --platform linux/amd64,linux/arm64 \
|
|
-t ${IMAGE}:${CDP_BUILD_VERSION} \
|
|
--push .
|
|
|
|
if [ -z ${CDP_SOURCE_BRANCH} ]; then
|
|
cdp-promote-image ${IMAGE}:${CDP_BUILD_VERSION}
|
|
fi
|