Skip to content

Commit a28166d

Browse files
committed
ci: Make compute resources for CI configurable
See prior commit for an explanation for the goal of the change and why it had to be split into two commits. Reviewed-by: Daniel Gustafsson <[email protected]> Reviewed-by: Nazir Bilal Yavuz <[email protected]> Discussion: https://postgr.es/m/[email protected] Backpatch: 15-, where CI support was added
1 parent 19cc965 commit a28166d

File tree

3 files changed

+90
-45
lines changed

3 files changed

+90
-45
lines changed

.cirrus.tasks.yml

-45
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@
55

66

77
env:
8-
# Source of images / containers
9-
GCP_PROJECT: pg-ci-images
10-
IMAGE_PROJECT: $GCP_PROJECT
11-
CONTAINER_REPO: us-docker.pkg.dev/${GCP_PROJECT}/ci
12-
DISK_SIZE: 25
13-
148
# The lower depth accelerates git clone. Use a bit of depth so that
159
# concurrent tasks and retrying older jobs have a chance of working.
1610
CIRRUS_CLONE_DEPTH: 500
@@ -29,45 +23,6 @@ env:
2923
PG_TEST_EXTRA: kerberos ldap ssl load_balance
3024

3125

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-
7126
# What files to preserve in case tests fail
7227
on_failure_ac: &on_failure_ac
7328
log_artifacts:

.cirrus.yml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# CI configuration file for CI utilizing cirrus-ci.org
2+
#
3+
# For instructions on how to enable the CI integration in a repository and
4+
# further details, see src/tools/ci/README
5+
#
6+
#
7+
# The actual CI tasks are defined in .cirrus.tasks.yml. To make the compute
8+
# resources for CI configurable on a repository level, the "final" CI
9+
# configuration is the combination of:
10+
#
11+
# 1) the contents of this file
12+
#
13+
# 2) if defined, the contents of the file referenced by the, repository
14+
# level, REPO_CI_CONFIG_GIT_URL variable (see
15+
# https://cirrus-ci.org/guide/programming-tasks/#fs for the accepted
16+
# format)
17+
#
18+
# 3) .cirrus.tasks.yml
19+
#
20+
# This composition is done by .cirrus.star
21+
22+
23+
env:
24+
# Source of images / containers
25+
GCP_PROJECT: pg-ci-images
26+
IMAGE_PROJECT: $GCP_PROJECT
27+
CONTAINER_REPO: us-docker.pkg.dev/${GCP_PROJECT}/ci
28+
DISK_SIZE: 25
29+
30+
31+
# Define how to run various types of tasks.
32+
33+
# VMs provided by cirrus-ci. Each user has a limited number of "free" credits
34+
# for testing.
35+
cirrus_community_vm_template: &cirrus_community_vm_template
36+
compute_engine_instance:
37+
image_project: $IMAGE_PROJECT
38+
image: family/$IMAGE_FAMILY
39+
platform: $PLATFORM
40+
cpu: $CPUS
41+
disk: $DISK_SIZE
42+
43+
44+
default_linux_task_template: &linux_task_template
45+
env:
46+
PLATFORM: linux
47+
<<: *cirrus_community_vm_template
48+
49+
50+
default_freebsd_task_template: &freebsd_task_template
51+
env:
52+
PLATFORM: freebsd
53+
<<: *cirrus_community_vm_template
54+
55+
56+
default_windows_task_template: &windows_task_template
57+
env:
58+
PLATFORM: windows
59+
<<: *cirrus_community_vm_template
60+
61+
62+
# macos workers provided by cirrus-ci
63+
default_macos_task_template: &macos_task_template
64+
env:
65+
PLATFORM: macos
66+
macos_instance:
67+
image: $IMAGE
68+
69+
70+
# Contents of REPO_CI_CONFIG_GIT_URL, if defined, will be inserted here,
71+
# followed by the contents .cirrus.tasks.yml. This allows
72+
# REPO_CI_CONFIG_GIT_URL to override how the task types above will be
73+
# executed, e.g. using a custom compute account or permanent workers.

src/tools/ci/README

+17
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,20 @@ messages. Currently the following controls are available:
6565

6666
Only runs CI on operating systems specified. This can be useful when
6767
addressing portability issues affecting only a subset of platforms.
68+
69+
70+
Using custom compute resources for CI
71+
=====================================
72+
73+
When running a lot of tests in a repository, cirrus-ci's free credits do not
74+
suffice. In those cases a repository can be configured to use other
75+
infrastructure for running tests. To do so, the REPO_CI_CONFIG_GIT_URL
76+
variable can be configured for the repository in the cirrus-ci web interface,
77+
at https://cirrus-ci.com/github/<user or organization>. The file referenced
78+
(see https://cirrus-ci.org/guide/programming-tasks/#fs) by the variable can
79+
overwrite the default execution method for different operating systems,
80+
defined in .cirrus.yml, by redefining the relevant yaml anchors.
81+
82+
Custom compute resources can be provided using
83+
- https://cirrus-ci.org/guide/supported-computing-services/
84+
- https://cirrus-ci.org/guide/persistent-workers/

0 commit comments

Comments
 (0)