Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit19cc965

Browse files
committed
ci: Prepare to make compute resources for CI configurable
cirrus-ci will soon restrict the amount of free resources every user gets (ashave many other CI providers). For most users of CI that should not be anissue. But e.g. for cfbot it will be an issue.To allow configuring different resources on a per-repository basis, introduceinfrastructure for overriding the task execution environment. Unfortunatelythis is not entirely trivial, as yaml anchors have to be defined before theiruse, and cirrus-ci only allows injecting additional contents at the end of.cirrus.yml.To deal with that, move the definition of the CI tasks to.cirrus.tasks.yml. The main .cirrus.yml is loaded first, then, if defined, thefile referenced by the REPO_CI_CONFIG_GIT_URL variable, will be added,followed by the contents of .cirrus.tasks.yml. That allowsREPO_CI_CONFIG_GIT_URL to override the yaml anchors defined in .cirrus.yml.Unfortunately git's default merge / rebase strategy does not handle copiedfiles, just renamed ones. To avoid painful rebasing over this change, thiscommit just renames .cirrus.yml to .cirrus.tasks.yml, without adding a new.cirrus.yml. That's done in the followup commit, which moves the relevantportion of .cirrus.tasks.yml to .cirrus.yml. Until that is done,REPO_CI_CONFIG_GIT_URL does not fully work.The subsequent commit adds documentation for how to configure custom computeresources to src/tools/ci/READMEReviewed-by: Daniel Gustafsson <daniel@yesql.se>Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>Discussion:https://postgr.es/m/20230808021541.7lbzdefvma7qmn3w@awork3.anarazel.deBackpatch: 15-, where CI support was added
1 parentd7f2490 commit19cc965

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

‎.cirrus.star

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
"""Additional CI configuration, using the starlark language. See
2+
https://cirrus-ci.org/guide/programming-tasks/#introduction-into-starlark
3+
4+
See also the starlark specification at
5+
https://github.com/bazelbuild/starlark/blob/master/spec.md
6+
7+
See also .cirrus.yml and src/tools/ci/README
8+
"""
9+
10+
load("cirrus","env","fs")
11+
12+
13+
defmain():
14+
"""The main function is executed by cirrus-ci after loading .cirrus.yml and can
15+
extend the CI definition further.
16+
17+
As documented in .cirrus.yml, the final CI configuration is composed of
18+
19+
1) the contents of .cirrus.yml
20+
21+
2) if defined, the contents of the file referenced by the, repository
22+
level, REPO_CI_CONFIG_GIT_URL variable (see
23+
https://cirrus-ci.org/guide/programming-tasks/#fs for the accepted
24+
format)
25+
26+
3) .cirrus.tasks.yml
27+
"""
28+
29+
output=""
30+
31+
# 1) is evaluated implicitly
32+
33+
# Add 2)
34+
repo_config_url=env.get("REPO_CI_CONFIG_GIT_URL")
35+
ifrepo_config_url!=None:
36+
print("loading additional configuration from\"{}\"".format(repo_config_url))
37+
output+=config_from(repo_config_url)
38+
else:
39+
output+="\n# REPO_CI_CONFIG_URL was not set\n"
40+
41+
# Add 3)
42+
output+=config_from(".cirrus.tasks.yml")
43+
44+
returnoutput
45+
46+
47+
defconfig_from(config_src):
48+
"""return contents of config file `config_src`, surrounded by markers
49+
indicating start / end of the the included file
50+
"""
51+
52+
config_contents=fs.read(config_src)
53+
config_fmt="""
54+
55+
###
56+
# contents of config file `{0}` start here
57+
###
58+
{1}
59+
###
60+
# contents of config file `{0}` end here
61+
###
62+
"""
63+
returnconfig_fmt.format(config_src,config_contents)
File renamed without changes.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp