Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 119ee6a

Browse files
committed
ci: Move execution method of tasks into yaml templates
This is done in preparation for making the compute resources for CI configurable. It also looks cleaner. Reviewed-by: Daniel Gustafsson <daniel@yesql.se> Discussion: https://postgr.es/m/20230808021541.7lbzdefvma7qmn3w@awork3.anarazel.de Backpatch: 15-, where CI support was added
1 parent 794e14e commit 119ee6a

File tree

1 file changed

+57
-28
lines changed

1 file changed

+57
-28
lines changed

.cirrus.yml

+57-28
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ env:
99
GCP_PROJECT: pg-ci-images
1010
IMAGE_PROJECT: $GCP_PROJECT
1111
CONTAINER_REPO: us-docker.pkg.dev/${GCP_PROJECT}/ci
12+
DISK_SIZE: 25
1213

1314
# The lower depth accelerates git clone. Use a bit of depth so that
1415
# concurrent tasks and retrying older jobs have a chance of working.
@@ -28,6 +29,45 @@ env:
2829
PG_TEST_EXTRA: kerberos ldap ssl load_balance
2930

3031

32+
# Define how to run various types of tasks.
33+
34+
# VMs provided by cirrus-ci. Each user has a limited number of "free" credits
35+
# for testing.
36+
cirrus_community_vm_template: &cirrus_community_vm_template
37+
compute_engine_instance:
38+
image_project: $IMAGE_PROJECT
39+
image: family/$IMAGE_FAMILY
40+
platform: $PLATFORM
41+
cpu: $CPUS
42+
disk: $DISK_SIZE
43+
44+
45+
default_linux_task_template: &linux_task_template
46+
env:
47+
PLATFORM: linux
48+
<<: *cirrus_community_vm_template
49+
50+
51+
default_freebsd_task_template: &freebsd_task_template
52+
env:
53+
PLATFORM: freebsd
54+
<<: *cirrus_community_vm_template
55+
56+
57+
default_windows_task_template: &windows_task_template
58+
env:
59+
PLATFORM: windows
60+
<<: *cirrus_community_vm_template
61+
62+
63+
# macos workers provided by cirrus-ci
64+
default_macos_task_template: &macos_task_template
65+
env:
66+
PLATFORM: macos
67+
macos_instance:
68+
image: $IMAGE
69+
70+
3171
# What files to preserve in case tests fail
3272
on_failure_ac: &on_failure_ac
3373
log_artifacts:
@@ -136,21 +176,18 @@ task:
136176
CPUS: 2
137177
BUILD_JOBS: 3
138178
TEST_JOBS: 3
179+
IMAGE_FAMILY: pg-ci-freebsd-13
180+
DISK_SIZE: 50
139181

140182
CCACHE_DIR: /tmp/ccache_dir
141183
CPPFLAGS: -DRELCACHE_FORCE_RELEASE -DCOPY_PARSE_PLAN_TREES -DWRITE_READ_PARSE_PLAN_TREES -DRAW_EXPRESSION_COVERAGE_TEST -DENFORCE_REGRESSION_TEST_NAME_RESTRICTIONS
142184
CFLAGS: -Og -ggdb
143185

186+
<<: *freebsd_task_template
187+
144188
depends_on: SanityCheck
145189
only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*freebsd.*'
146190

147-
compute_engine_instance:
148-
image_project: $IMAGE_PROJECT
149-
image: family/pg-ci-freebsd-13
150-
platform: freebsd
151-
cpu: $CPUS
152-
disk: 50
153-
154191
sysinfo_script: |
155192
id
156193
uname -a
@@ -250,6 +287,7 @@ task:
250287
CPUS: 4
251288
BUILD_JOBS: 4
252289
TEST_JOBS: 8 # experimentally derived to be a decent choice
290+
IMAGE_FAMILY: pg-ci-bullseye
253291

254292
CCACHE_DIR: /tmp/ccache_dir
255293
DEBUGINFOD_URLS: "https://debuginfod.debian.net"
@@ -282,15 +320,11 @@ task:
282320
LINUX_CONFIGURE_FEATURES: *LINUX_CONFIGURE_FEATURES
283321
LINUX_MESON_FEATURES: *LINUX_MESON_FEATURES
284322

323+
<<: *linux_task_template
324+
285325
depends_on: SanityCheck
286326
only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*linux.*'
287327

288-
compute_engine_instance:
289-
image_project: $IMAGE_PROJECT
290-
image: family/pg-ci-bullseye
291-
platform: linux
292-
cpu: $CPUS
293-
294328
ccache_cache:
295329
folder: ${CCACHE_DIR}
296330

@@ -430,6 +464,7 @@ task:
430464
# work OK. See
431465
# https://postgr.es/m/20220927040208.l3shfcidovpzqxfh%40awork3.anarazel.de
432466
TEST_JOBS: 8
467+
IMAGE: ghcr.io/cirruslabs/macos-ventura-base:latest
433468

434469
CIRRUS_WORKING_DIR: ${HOME}/pgsql/
435470
CCACHE_DIR: ${HOME}/ccache
@@ -440,12 +475,11 @@ task:
440475
CFLAGS: -Og -ggdb
441476
CXXFLAGS: -Og -ggdb
442477

478+
<<: *macos_task_template
479+
443480
depends_on: SanityCheck
444481
only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*(macos|darwin|osx).*'
445482

446-
macos_instance:
447-
image: ghcr.io/cirruslabs/macos-ventura-base:latest
448-
449483
sysinfo_script: |
450484
id
451485
uname -a
@@ -524,6 +558,7 @@ WINDOWS_ENVIRONMENT_BASE: &WINDOWS_ENVIRONMENT_BASE
524558
# Avoids port conflicts between concurrent tap test runs
525559
PG_TEST_USE_UNIX_SOCKETS: 1
526560
PG_REGRESS_SOCK_DIR: "c:/cirrus/"
561+
DISK_SIZE: 50
527562

528563
sysinfo_script: |
529564
chcp
@@ -547,16 +582,13 @@ task:
547582
# given that it explicitly prevents crash dumps from working...
548583
# 0x8001 is SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX
549584
CIRRUS_WINDOWS_ERROR_MODE: 0x8001
585+
IMAGE_FAMILY: pg-ci-windows-ci-vs-2019
586+
587+
<<: *windows_task_template
550588

551589
depends_on: SanityCheck
552590
only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*windows.*'
553591

554-
compute_engine_instance:
555-
image_project: $IMAGE_PROJECT
556-
image: family/pg-ci-windows-ci-vs-2019
557-
platform: windows
558-
cpu: $CPUS
559-
560592
setup_additional_packages_script: |
561593
REM choco install -y --no-progress ...
562594
@@ -598,12 +630,6 @@ task:
598630
# otherwise it'll be sorted before other tasks
599631
depends_on: SanityCheck
600632

601-
compute_engine_instance:
602-
image_project: $IMAGE_PROJECT
603-
image: family/pg-ci-windows-ci-mingw64
604-
platform: windows
605-
cpu: $CPUS
606-
607633
env:
608634
TEST_JOBS: 4 # higher concurrency causes occasional failures
609635
CCACHE_DIR: C:/msys64/ccache
@@ -617,6 +643,9 @@ task:
617643
# Start bash in current working directory
618644
CHERE_INVOKING: 1
619645
BASH: C:\msys64\usr\bin\bash.exe -l
646+
IMAGE_FAMILY: pg-ci-windows-ci-mingw64
647+
648+
<<: *windows_task_template
620649

621650
ccache_cache:
622651
folder: ${CCACHE_DIR}

0 commit comments

Comments
 (0)