Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as it is not used to ghcr build (direct Dockerfile usage), i would make it just postgres-operator for local builds

TAG ?= $(VERSION)
GITHEAD = $(shell git rev-parse --short HEAD)
GITURL = $(shell git config --get remote.origin.url)
Expand Down Expand Up @@ -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

Expand All @@ -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
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 ./...
Expand Down
57 changes: 39 additions & 18 deletions delivery.yaml
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
MULTI_ARCH_REGISTRY: container-registry-test.zalando.net/acid

pipeline:
- id: build-postgres-operator
env:
<<: *BUILD_ENV
type: script
vm_config:
type: linux
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BASE_IMAGE=registry.opensource.zalan.do/library/alpine-3:latest
ARG BASE_IMAGE=alpine:latest
FROM golang:1.25-alpine AS builder
ARG VERSION=latest

Expand Down
2 changes: 1 addition & 1 deletion ui/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BASE_IMAGE=registry.opensource.zalan.do/library/python-3.11-slim:latest
ARG BASE_IMAGE=python:3.11-slim
ARG NODE_IMAGE=node:lts-alpine

FROM $NODE_IMAGE AS build
Expand Down
21 changes: 16 additions & 5 deletions ui/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.PHONY: clean test appjs docker push mock

IMAGE ?= registry.opensource.zalan.do/acid/postgres-operator-ui
IMAGE ?= ghcr.io/zalando/postgres-operator-ui
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here for the naming

BASE_IMAGE ?= alpine
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without tag?

VERSION ?= $(shell git describe --tags --always --dirty)
TAG ?= $(VERSION)
GITHEAD = $(shell git rev-parse --short HEAD)
Expand Down Expand Up @@ -30,10 +31,20 @@ docker: appjs
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)" -f Dockerfile .

push:
docker push "$(IMAGE):$(TAG)$(CDP_TAG)"
docker build --rm -t "$(IMAGE):$(TAG)$(CDP_TAG)" -f Dockerfile --build-arg BASE_IMAGE="${BASE_IMAGE}" --build-arg .

docker-push: appjs
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
docker buildx build --platform linux/amd64,linux/arm64 \
--build-arg BASE_IMAGE="${BASE_IMAGE}" \
-f Dockerfile \
-t "$(IMAGE):$(TAG)$(CDP_TAG)" \
--push .
echo "$(IMAGE):$(TAG)$(CDP_TAG)"

mock:
docker run -it -p 8081:8081 "$(IMAGE):$(TAG)" --mock