No description
  • Python 99.4%
  • Shell 0.6%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
tusooa 3e436c95f4
Use reporter for build start/end notify
Summary:
Originally, we used to use a build step to notify Phorge of the status of builds. There is one problem with it: When there is no available worker, Phorge does not know the build link. This commit changes it to use a dedicated reporter, so the link can be displayed even if there is no available worker.

Type: add

Test Plan: Run a build and verify you can see the artifact link immediately, and you can see the status when the build ends.

Reviewers: O2 lilybuild

Differential Revision: https://iron.lily-is.land/D302
2026-04-25 22:45:19 -04:00
buildbot@2e65c0d2ae Validate CI file via gitlab's json schema 2025-01-18 19:32:40 -05:00
lilybuild Use reporter for build start/end notify 2026-04-25 22:45:19 -04:00
master Add ci to build container images 2025-04-30 20:36:21 -04:00
volume-helper Add ci to build container images 2025-04-30 20:36:21 -04:00
.arcconfig Add arcconfig 2025-05-18 23:41:09 -04:00
.gitignore Add artifact link support 2025-10-12 08:19:16 -04:00
.gitlab-ci.yml Clarify license info 2026-01-26 17:09:23 -05:00
.gitmodules Add a build tool to run CI in a container 2025-01-10 16:53:55 -05:00
build-master.sh Clarify license info 2026-01-26 17:09:23 -05:00
build-volume-helper.sh Clarify license info 2026-01-26 17:09:23 -05:00
build-worker.sh Clarify license info 2026-01-26 17:09:23 -05:00
Containerfile.master Clarify license info 2026-01-26 17:09:23 -05:00
Containerfile.volume-helper Clarify license info 2026-01-26 17:09:23 -05:00
Containerfile.worker Clarify license info 2026-01-26 17:09:23 -05:00
LICENSE Clarify license info 2026-01-26 17:09:23 -05:00
README.md Clarify license info 2026-01-26 17:09:23 -05:00

lilybuild

Runs pipeline jobs in containers.

Focus will be given to podman containers.

Motivation

This originates as a trial to replace the current workflow in GitLab CI/CD on [Lily Islands][https://lily-is.land]. Using GitLab is unethical because (1) its official instance, gitlab.com, imposes a region lock by restricting users in regions under the rule of the Peking government from using their account on gitlab.com, and asking them migrate to another service provided by JiHu 1 2 3; and (2) said company tries to threaten to sue GitLab CE users in order to ask them to pay, despite the software is free/libre. 4

If you are currently using GitLab, or are considering doing so, either their SaaS version, or a self-hosted version, we strongly recommend that you think twice.

Main objectives include:

  • Parse GitLab CI file, and run them as buildbot builds, inside containers.
  • Run CI from both a PR-style forge (forgejo) and a diff-style forge (phorge) at the same time, and unifying them.

Deployment

Only LilyBuildConfig is required. All others are optional.

lilybuild.config.LilyBuildConfig (main entry point)

Requirements:

  • Buildbot Workers, using image from Containerfile.worker For the current moment:
    • The lilybuild directory in this repository needs to be mounted to /lilybuild inside the container
    • A ssh key pair without password needs to be available in /secrets/lilybuild-volume-helper-key{,.pub} inside the container
    • An image built by Containerfile.volume-helper is available under the name defined in volume_helper_image in lilybuild/podman-helper
  • Repository urls (can be from any forge (of course, you can use GitLab with it, but not using it can be a highly ethical choice.))
lbc = LilyBuildConfig(
    c,
    ['workername1', 'workername2'],
    # The ones below are only needed if you need status report for phorge OR need to use `arc patch` to fetch the source.
    # Can be overriden by individual repos.
    phorge_base_url='https://other.server.example/',
    phorge_token=util.Secret('phorge-token'),
)

lbc.configure_factory_and_builder()
lbc.add_repo(
    1, # repo id
    'https://server.example/owner/repo', # canonical url
    alternative_urls=['git@other.server.example:owner/repo'], # can be empty
    do_poll=False, # set to True if you don't have a change hook
)
# add other repos
lbc.configure_pipeline_defs()

Builders

LilyBuildConfig creates 3 builders: lilybuild, lilybuild-job, lilybuild-force.

lilybuild runs a pipeline definition parsed from the CI file. It triggers lilybuild-job, which runs a single job as defined by the CI file. lilybuild-force allows you to run a pipeline on any defined repository by the "force" button. You may want to restrict who can force build.

Phorge sources

If the build comes from a Phorge change hook (TODO: document how to setup such a hook), it will try to fetch from the staging area defined in Phorge. If there is no staging area, or the staging area does not contain that diff (for example, because the user chooses to skip staging in arc diff, or the diff was submitted on the web form, probably to prevent a security patch from leaking too early), it will checkout from the canonical repo url, then try to run arc patch to fetch the source code.

If the build does not come from a Phorge change hook, it will fetch normally via the canonical repo url.

Requiring approval

By default, if the source code is fetched via arc patch, an approval is needed to run the pipeline (assuming anyone who can push to staging area is trusted). The approval is done by rebuilding the build. (TODO: make this configurable)

lilybuild.auth.ForgejoAuth

An auth provider for forgejo.

Use:

# Allow users to login via forgejo
c['www']['auth'] = ForgejoAuth('https://forgejo.server.example/', CLIENT_ID, CLIENT_SECRET)

lilybuild.auth.ForgejoAuthz

An authz provider that gives rights to people who have access to a forgejo repository to control the builds in that repository (rebuild/stop).

Must use ForgejoAuth as the auth provider.

This class extends buildbot.www.authz.authz.Authz and accepts any arguments accepted by it.

Use:

c['www']['authz'] = ForgejoAuthz(
    base_url='https://forgejo.server.example/',
    access_token=util.Secret('forgejo-authz-token'), # This needs to be a token of an **admin account** either of the forgejo server, or of all the registered repositories, and with `read:repository` access.
    # any other options...
)

License

This is licensed under the same one as buildbot, i.e. GPL v2.