Skip to content
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

Separate trigger and OSS pipelines #1052

Merged
merged 4 commits into from
Nov 19, 2024
Merged
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
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