doc PG 17 relnotes: add FETCH_COUNT item
[pgsql.git] / .cirrus.star
blob36233872d1e50837dfa3260ad77c3a63fb93ce43
1 """Additional CI configuration, using the starlark language. See
2 https://cirrus-ci.org/guide/programming-tasks/#introduction-into-starlark
4 See also the starlark specification at
5 https://github.com/bazelbuild/starlark/blob/master/spec.md
7 See also .cirrus.yml and src/tools/ci/README
8 """
10 load("cirrus", "env", "fs")
13 def main():
14     """The main function is executed by cirrus-ci after loading .cirrus.yml and can
15     extend the CI definition further.
17     As documented in .cirrus.yml, the final CI configuration is composed of
19     1) the contents of .cirrus.yml
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)
26     3) .cirrus.tasks.yml
27     """
29     output = ""
31     # 1) is evaluated implicitly
33     # Add 2)
34     repo_config_url = env.get("REPO_CI_CONFIG_GIT_URL")
35     if repo_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"
41     # Add 3)
42     output += config_from(".cirrus.tasks.yml")
44     return output
47 def config_from(config_src):
48     """return contents of config file `config_src`, surrounded by markers
49     indicating start / end of the included file
50     """
52     config_contents = fs.read(config_src)
53     config_fmt = """
55 ###
56 # contents of config file `{0}` start here
57 ###
58 {1}
59 ###
60 # contents of config file `{0}` end here
61 ###
62 """
63     return config_fmt.format(config_src, config_contents)