diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index b8386cd2b..c874c7a32 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -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 diff --git a/delivery.yaml b/delivery.yaml index adabbf1a6..67366b64e 100644 --- a/delivery.yaml +++ b/delivery.yaml @@ -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: @@ -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: