Repository navigation
feat(releases): a nightly channel for self-hosting - #13659
Conversation
The Trivy scan owned the nightly.yml file name, which the nightly build channel needs. Its schedule also moves to 01:30 UTC so it runs after the build rather than alongside it.
Builds one image a day from the newest CI-green commit on the active release branch, so a fix can reach self-hosters the night it lands instead of waiting for the next patch. Resolves the build rather than trusting the tip: walks back through recent green CI runs, skips when nothing has moved since the last nightly, and derives the version from the branch's own APP_VERSION_STABLE so the tag is a prerelease of the patch it is heading for. The bare nightly tag only follows the newest line, and a guard refuses any tag outside appwrite/appwrite -- Cloud's appwrite/ce pipeline is not part of this channel.
AGENTS.md blocks a release on a fresh install and an upgrade from the previous stable with realistic data, and CI covered neither -- there was no migrate step anywhere in the pipeline. That gate was a person's day per release, which is a direct incentive to batch fixes instead of shipping them. Both now run on release branches and on demand. The upgrade job starts the previous published stable from the compose file and env that version shipped, seeds through the public API, switches to the candidate on the same volumes, migrates, and asserts the data survived -- then migrates a second time to prove idempotency. Seeding covers the shapes a migration is most likely to mangle: empty strings, 4000-character values, unicode, relationships, and row permissions that differ from the table's. The baseline comes from Docker Hub rather than git tags, because an image nobody can pull is not an upgrade anyone can perform.
A patch bump touches APP_VERSION_STABLE, four install snippets in README.md, three in README-CN.md, and Migration::$versions, and nothing checked that they agree. `release X.Y.Z` writes all of them from one version number, and tests/unit/Release/MetadataTest.php fails when they drift apart again. The task also refuses to map a patch to a new migration class: a fix needing a schema change is a minor, which is what keeps a nightly user able to roll back to yesterday's build.
Opting into nightly already worked through _APP_VERSION, since every service resolves its own image tag, but it left self-hosters to work out that the tag has to stay rolling. --channel=nightly derives X.Y-nightly from the stable version so the install tracks the minor line instead of freezing on one build.
Records the tag contract for both channels, the four rules the nightly channel rests on, the weekly patch train, and how a self-hoster opts in. Also points the release checklist at the new task and CI gates, and drops the reference to app/views/install/compose.phtml, which no longer exists.
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
Verification was 20-odd hand-written assertions behind an assert helper and a failure counter. It is now one projected snapshot, taken before the upgrade and diffed after it -- shorter, and the failure output is a diff of what changed rather than a list of lines. The projection keeps only the fields the seed put in, so an upgrade is still free to add fields to a model. Writes are behind --write so the read-only comparison can run after every migrate; previously the second run diffed against rows the first run had written. The previous-stable resolver was a 89-line python script and is now four lines of shell: sort the published tags together with the target and take what lands before it. Same answers on live Docker Hub data (2.0.0 -> 1.9.6, 2.1.0 -> 2.0.0), and no python in CI. Also moves the candidate's compose env to the job level instead of repeating it on seven steps, and renames USER so the scripts stop shadowing the shell's own variable. 315 lines down from 477.
Adding $channel as the ninth parameter of Install::action() put a string where Upgrade::action() already had bool $migrate, and an override may only add optional parameters, not change the type of an existing position. Every process that boots the platform died on the incompatible declaration, which is why the whole pipeline went red rather than one job. $channel also has to reach performInstallation(), a different method, so it now travels on $this the way $topology already does instead of being read out of scope. Also yields the README data provider, per Rector's YieldDataProviderRector.
tests/unit/Release/MetadataTest.php could not do its job: unit tests run inside the appwrite container, whose /usr/src/code holds only app, dev, public, src and vendor. The READMEs are neither copied into the image nor mounted by the override, so reading them returned false and the test failed for a reason that had nothing to do with the metadata. The file-level pins now live in a Check release metadata step in the Checks job, which runs on the runner where the files are. The one assertion that is genuinely about code -- no version mapped ahead of APP_VERSION_STABLE -- moves to MigrationVersionsTest, next to the existing assertion about that same map. Also loosens the console pin check: main pins 1.1.78-self-hosted, so a build suffix is valid where a floating tag is not.
|
Simplified the nightly resolve step — the "has this already been published?" logic is now one git check instead of two mechanisms.
nightly.yml: 270 → 187 lines. |
The workflow asked "has this already shipped?" twice: the nightly-<branch> marker tag answered it for the commit, and a Docker Hub tag lookup answered it for the day. Keep the marker, drop the registry call and its status-code handling -- a same-day rebuild now reuses the day's tag instead of taking a run-number suffix, so that tag is one a day rather than immutable. Also drops guards that guard nothing: the walk-back loop over green runs (gh already returns the newest green run, and release branches are not force pushed), the branch-name mismatch warning, and the step refusing to publish anywhere but appwrite/appwrite -- the tags are built from the hardcoded IMAGE env six lines above it.
AGENTS.md rules out preg_* in new code. Version parsing, the migration map lookup and the console pin all read fine with explode, ctype_digit, str_contains and strcspn.
The upgrade gate read the previous stable out of Docker Hub's 100 most recent tags. The nightly channel now pushes a tag a day to that same repository, so within weeks the stables fall out of that window and the gate fails to find a baseline it can upgrade from. Git tags carry every release, sort by semver and are already here from fetch-depth: 0 -- which also makes the explicit tag fetch redundant. Also stops the crash-loop check from accepting exited containers. Every service in the default profile is long-running, so an exited one is a service that stopped serving.
|
Two follow-ups after another read of the gates: Upgrade baseline resolution would have broken once nightly runs. The gate resolved the previous stable from Docker Hub's 100 most recent tags. Nightly pushes one new tag a day (plus refreshing two rolling ones) to Crash-loop check accepted exited containers. Also dropped the four |
upgrade-lib.sh existed only to be sourced by the two scripts either side of it, and both run in the same job. One upgrade.sh with seed and verify subcommands says the same thing without the indirection, the shellcheck source directives or the unused-variable suppression the split forced. Also waits on the signal that means ready. /health/version answers before the platform schema is initialized -- the e2e jobs already poll /account for a 401 for exactly this reason -- so the gate could start seeding against a database that was not there yet. That also makes the install gate's separate version step redundant.
|
On whether the gate needs three scripts: the content does, the file split didn't.
What I did not cut, and why: every seeded shape is one the gate asserts on and one AGENTS.md names — empty string, 4000-char value, unicode, relationship, row permissions differing from the table's, plus a user and a file. The One bug fixed on the way: |
The workflow read APP_VERSION_STABLE out of the resolved commit, validated its shape and bumped the patch, all to name a tag. Nothing reads that name: migrate keys off the constant compiled into the image and the VERSION build arg only sets _APP_VERSION, so 2.0.x can simply publish 2.0-nightly.<date>. That also drops the failure mode where a release candidate on the branch stopped the channel. Drops the nightly-<branch> marker tag with it, and the write access and tag push it needed. Skipping an unchanged branch was the wrong instinct: a daily rebuild is how the channel picks up base image security fixes, which is most of what a nightly is for. nightly.yml is now 148 lines, from 270 when the channel was added.
Everything that was not the build itself is gone: the resolve job and the outputs plumbing between it and the build, the skip path (a release branch with no green CI run is an error worth seeing, not a quiet no-op), the workflow_dispatch branch input and the branch validation it needed, and the IMAGE indirection -- the one place a tag is written now names the repository it publishes to. Dropping the branch input means only the active release branch is built, so an X.Y-nightly tag stops moving when a newer line opens. That is what the channel is for. nightly.yml is 89 lines, from 270 when the channel was added.
The install and upgrade gates, upgrade.sh and the release task are release process, not the nightly channel: nothing here imports them, and they were 80% of a diff meant to answer "should we publish nightly builds?". They are unchanged in #13692. What stays is the channel itself -- nightly.yml, --channel on install and upgrade, and the docs that describe them -- plus the *.x push trigger, which nightly needs so there are green CI runs on release branches to resolve.
|
…d tag A nightly image reports _APP_VERSION=X.Y-nightly.<date>, the tag it was pulled under. Both channels were derived from that value, so an install or upgrade run from inside a nightly image got the wrong tag either way: --channel nightly could not read a minor line out of it and fell back to the bare nightly tag, which jumps minors, and --channel stable wrote the dated nightly tag straight back, leaving the install on nightly. Take the release compiled into the image instead whenever the tag names a channel. Both channels already derive from it, so nightly pins to its own line and stable returns to the release the image was built from.
str_contains($version, 'nightly') claimed any tag with the word in it, so a self-hoster running their own customer-nightly-fix image would have had it replaced with APP_VERSION_STABLE and persisted to .env, quietly pulling a different image than the one they asked for. Match what nightly.yml actually publishes instead: nightly, X.Y-nightly and X.Y-nightly.<date>.
Self-hosters who want to track the active release branch currently have to build it themselves. This adds a nightly channel: one build a day of the newest CI-green commit on the active release branch, published to
appwrite/appwrite.or
--channel nightlyoninstall/upgrade.What it publishes
X.Y-nightly.<date>X.Y-nightlynightlyX.Ycomes from the branch name. The tag is a label, not a version the product reads:migratekeys offAPP_VERSION_STABLEcompiled into the image, and theVERSIONbuild arg only sets_APP_VERSION.How it stays safe
'*.x'replacing the hardcoded1.9.x.appwrite/appwriteonly, in one hardcoded line. Cloud builds fromcl-*tags throughpublish.ymland is untouched.The workflow is 89 lines and keeps no state: no marker tags, no registry lookups, no write access to the repo.
security-scan.ymlis the oldnightly.yml(the Trivy scan) renamed, so the name could describe the channel.Split out
The release gates and the
releasemetadata task moved to #13692 — they are release process, unrelated to this channel, and were most of the original diff.