-
Notifications
You must be signed in to change notification settings - Fork 4
93 lines (84 loc) · 3.03 KB
/
continuous-delivery.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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 }}