-
Notifications
You must be signed in to change notification settings - Fork 8
105 lines (95 loc) · 3.53 KB
/
continuous-delivery.yml
File metadata and controls
105 lines (95 loc) · 3.53 KB
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
94
95
96
97
98
99
100
101
102
103
104
105
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 * * *'
defaults:
run:
# default failure handling for shell scripts in 'run' steps
shell: 'bash -Eeuo pipefail -x {0}'
permissions: read-all
jobs:
build-pg:
name: Build the Trunk of PostgreSQL
runs-on: ${{ github.repository_owner == 'cloudnative-pg' && 'ubuntu-latest-16-cores' || 'ubuntu-24.04' }}
permissions:
contents: read
packages: write
outputs:
pg_image: ${{ env.PG_IMAGE }}
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@v6
- 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
env:
INPUT_CNPG_BRANCH: ${{ github.event.inputs.cnpg_branch }}
INPUT_TEST_DEPTH: ${{ github.event.inputs.test_depth }}
INPUT_FEATURE_TYPE: ${{ github.event.inputs.feature_type }}
run: |
if [[ -n "${INPUT_CNPG_BRANCH}" ]]; then
echo "CNPG_BRANCH=${INPUT_CNPG_BRANCH}" >> $GITHUB_ENV
fi
if [[ -n "${INPUT_TEST_DEPTH}" ]]; then
echo "TEST_DEPTH=${INPUT_TEST_DEPTH}" >> $GITHUB_ENV
fi
if [[ -n "${INPUT_FEATURE_TYPE}" ]]; then
echo "FEATURE_TYPE=${INPUT_FEATURE_TYPE}" >> $GITHUB_ENV
fi
- name: Log in to the GitHub Container registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build and push
uses: docker/bake-action@v7
id: build
env:
environment: production
registry: ghcr.io/${{ github.repository_owner }}
revision: ${{ github.sha }}
pgMajor: ${{ env.PG_MAJOR }}
with:
push: true
# Get a list of the images that were built and pushed. We only care about a single tag for each image.
- name: Generated images
id: images
env:
BUILD_METADATA: ${{ steps.build.outputs.metadata }}
run: |
echo "PG_IMAGE=$(echo "${BUILD_METADATA}" | jq -r '.["minimal"].["image.name"]' | grep -oP '[^,]*\d{12}[^,]*')" >> $GITHUB_ENV
call-reusable-e2e:
if: github.event_name == 'schedule'
needs:
- build-pg
uses: ./.github/workflows/reusable-e2e.yml
permissions:
packages: write
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 }}