Skip to content

Commit

Permalink
Separate trigger and OSS pipelines (#1052)
Browse files Browse the repository at this point in the history
- Build zalando trigger image unconditionally
- Add possibility to push a pr image (staging registry) on approval
- Allow building master branch images on approval
- Update github actions deps
  • Loading branch information
hughcapet authored Nov 19, 2024
1 parent 13b80c6 commit 56c5eaf
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 11 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,22 @@ on:
push:
branches:
- master
- trigger

jobs:
tests:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up packages
run: sudo apt-get install -y shellcheck
run: sudo apt-get install -y shellcheck docker-compose
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.7
- name: Install flake8 and docker-compose
run: python -m pip install flake8 docker-compose==1.17.1
python-version: '3.10'
- name: Install flake8
run: python -m pip install flake8
- name: Run shellcheck
run: find postgres-appliance -name '*.sh' -print0 | xargs -0 shellcheck
- name: Run flake8
Expand Down
70 changes: 65 additions & 5 deletions delivery.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,73 @@
version: "2017-09-20"
allow_concurrent_steps: true

build_env: &BUILD_ENV
BASE_IMAGE: container-registry.zalando.net/library/ubuntu-22.04
PGVERSION: 16
MULTI_ARCH_REGISTRY: container-registry-test.zalando.net/acid

pipeline:
- id: push-spilo-ecr
- id: push-spilo-cdp-pr
env:
<<: *BUILD_ENV
type: script
requires_human_approval: true
when:
- event: pull_request
timeout: 10h
vm_config:
type: linux
size: large
commands:
- desc: Tag and push spilo-cdp image without promotion
cmd: |
cd postgres-appliance
PATRONIVERSION=$(sed -n 's/^ENV PATRONIVERSION=\([1-9][0-9]*\.[0-9]*\).*$/\1/p' Dockerfile)
ECR_TEST_IMAGE="$MULTI_ARCH_REGISTRY/spilo-cdp-pr$CDP_PULL_REQUEST_NUMBER-$PGVERSION:$PATRONIVERSION-p$CDP_PULL_REQUEST_COUNTER"
# create a Buildkit builder with CDP specific configuration
docker buildx create --config /etc/cdp-buildkitd.toml --driver-opt network=host --bootstrap --use
# single platform build for PR images!
docker buildx build --platform "linux/amd64" \
--build-arg PGVERSION="$PGVERSION" \
--build-arg BASE_IMAGE="$BASE_IMAGE" \
-t "$ECR_TEST_IMAGE" \
--push .
- id: push-spilo-cdp
env:
<<: *BUILD_ENV
type: script
when:
- event: push
branch: trigger
timeout: 10h
vm_config:
type: linux
size: extra_large
commands:
- desc: Tag and push spilo-cdp image
cmd: |
cd postgres-appliance
PATRONIVERSION=$(sed -n 's/^ENV PATRONIVERSION=\([1-9][0-9]*\.[0-9]*\).*$/\1/p' Dockerfile)
ECR_TEST_IMAGE="$MULTI_ARCH_REGISTRY/spilo-cdp-$PGVERSION:trigger-$PATRONIVERSION-p$CDP_TARGET_BRANCH_COUNTER"
# create a Buildkit builder with CDP specific configuration
docker buildx create --config /etc/cdp-buildkitd.toml --driver-opt network=host --bootstrap --use
docker buildx build --platform "linux/amd64,linux/arm64" \
--build-arg PGVERSION="$PGVERSION" \
--build-arg BASE_IMAGE="$BASE_IMAGE" \
-t "$ECR_TEST_IMAGE" \
--push .
cdp-promote-image "$ECR_TEST_IMAGE"
- id: push-spilo-cdp-master
env:
BASE_IMAGE: container-registry.zalando.net/library/ubuntu-22.04
PGVERSION: 16
MULTI_ARCH_REGISTRY: container-registry-test.zalando.net/acid
<<: *BUILD_ENV
type: script
requires_human_approval: true
when:
Expand Down Expand Up @@ -35,7 +96,6 @@ pipeline:
cdp-promote-image "$ECR_TEST_IMAGE"
- id: tag-spilo
depends_on: [push-spilo-ecr]
type: script
requires_human_approval: true
when:
Expand Down

0 comments on commit 56c5eaf

Please sign in to comment.