Skip to content

continuous-delivery #772

continuous-delivery

continuous-delivery #772

name: continuous-delivery
on:
workflow_dispatch:
inputs:
cnpg_branch:
description: "Name of the branch/tag used to build & load the operator (leave empty for default)"
required: false
test_depth:
description: 'E2E test level: 0(highest) to 4(lowest) (leave empty for default)'
required: false
feature_type:
description: 'E2E feature type filter. See https://github.com/cloudnative-pg/cloudnative-pg/blob/main/contribute/e2e_testing_environment/README.md#using-feature-type-test-selectionfilter'
required: false
schedule:
- cron: '0 1 * * *'
# set up environment variables to be used across all the jobs
env:
REGISTRY: "ghcr.io/${{ github.repository_owner }}/postgresql-trunk"
defaults:
run:
# default failure handling for shell scripts in 'run' steps
shell: 'bash -Eeuo pipefail -x {0}'
jobs:
build-pg:
name: Build the Trunk of PostgreSQL
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
outputs:
pg_image: ${{ env.TAG }}
pg_major: ${{ env.PG_MAJOR }}
cnpg_branch: ${{ env.CNPG_BRANCH }}
test_depth: ${{ env.TEST_DEPTH }}
feature_type: ${{ env.FEATURE_TYPE }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set env variables from defaults.json
run: |
for key in $(jq -r 'keys[]' defaults.json); do
echo "$key=$(cat defaults.json | jq -r --arg key "$key" '.[$key]')" >> $GITHUB_ENV
done
# Inputs have priority over defaults.json.
- name: Evaluate E2E workflow inputs
run: |
if [[ -n "${{ github.event.inputs.cnpg_branch }}" ]]; then
echo "CNPG_BRANCH=${{ github.event.inputs.cnpg_branch }}" >> $GITHUB_ENV
fi
if [[ -n "${{ github.event.inputs.test_depth }}" ]]; then
echo "TEST_DEPTH=${{ github.event.inputs.test_depth }}" >> $GITHUB_ENV
fi
if [[ -n "${{ github.event.inputs.feature_type }}" ]]; then
echo "FEATURE_TYPE=${{ github.event.inputs.feature_type }}" >> $GITHUB_ENV
fi
- name: Set tag
run: |
postgres_img="${{ env.REGISTRY }}:${{ env.PG_MAJOR }}-devel"
echo "TAG=${postgres_img}" >> $GITHUB_ENV
- name: Log in to the GitHub Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and load
uses: docker/build-push-action@v6
with:
context: .
push: true
load: false
tags: |
${{ env.TAG }}
call-reusable-e2e:
if: github.event_name == 'schedule'
needs:
- build-pg
uses: ./.github/workflows/reusable-e2e.yml
with:
postgres_img: ${{ needs.build-pg.outputs.pg_image }}
major_version: ${{ needs.build-pg.outputs.pg_major }}
cnpg_branch: ${{ needs.build-pg.outputs.cnpg_branch }}
test_depth: ${{ needs.build-pg.outputs.test_depth }}
feature_type: ${{ needs.build-pg.outputs.feature_type }}