Loading
Fix three gaps in the dev base on a stable branch
Three fixes for the dev base on a stable branch, one commit each.
Closes #17 (closed)
- Gitaly's
go.modis read at the tag a stable branch pins.up --base dev --gitlab-version <N>-stable-eestopped at its Gitaly step. On a stable branchGITALY_SERVER_VERSIONholds a release such as19.3.3, where the default branch holds a commit SHA. Gitaly tags that releasev19.3.3, so the files API answered 404 forgo.modat the bare value.dev-gitaly-go.shnow applies the rule TestEnv checks Gitaly out by,Gitlab::TaskHelpers#get_version: avbefore a bare release or release candidate, any other value unchanged. - PostgreSQL runs at the major the cloned ref's CI pins. The bootstrap installed the operating system's default server, PostgreSQL 18, while the build image's
pg_dumpis built for the ref'sPG_VERSION, 17 on19-3-stable-eeand19-4-stable-ee.pg_dumprefuses a newer server, sodb:migratemigrated and then aborted in its schema dump. A PostgreSQL 18 dump also names NOT NULL constraints that the committedstructure.sqldoes not, so it never matched the file. The bootstrap now readsPG_VERSIONwith the resolver it already uses forDEFAULT_CI_IMAGE(dev-ci-image.sh --var PG_VERSION) and installs the operating system'spostgresql<major>-serverand-contrib. When the ref gives no major or the operating system packages none, it keeps the default and saysFALLBACK. It warns when the image'spg_dumpis older than the server, andjust drift-checkasserts the variable resolves. - Development has databases of its own.
config/database.ymlmade development an alias of test (development: *test), so aRAILS_ENV=developmentdb:migratestamped the test databasesenvironment=development. Rails refuses to purge a database last used by another environment, so the next spec run'smaintain_test_schema!could not reloadstructure.sql, and the specs ran on whatever schema the migrate left. Development now hasgitlabhq_development,gitlabhq_development_ci,gitlabhq_development_secandgitlabhq_geo_development, loaded by the unnameddb:create db:schema:loadwithSKIP_TEST_DATABASE=true, which covers Geo and leaves test alone. The nameddb:schema:load:geowould purge test's Geo database in any environment, so the bootstrap does not call it.config/database.ymlcarries no YAML alias, sincescripts/db_tasksdoes not parse one.
How a spec run reloads the test databases
sequenceDiagram
participant M as RAILS_ENV=development db:migrate
participant D as gitlabhq_development
participant S as db/structure.sql
participant R as rspec: maintain_test_schema!
participant T as gitlabhq_test
M->>D: migrate, record environment=development
M->>S: dump the new schema
R->>S: read, changed since test's last load
R->>T: purge, then load db/structure.sql
Note over D,T: before: development was test under another name<br/>so the migrate stamped gitlabhq_test environment=development<br/>and Rails refused the purgeWhat the simulation showed
A dev base built from this branch on 19-3-stable-ee, moved to 19-4-stable-ee for the last check, and torn down afterwards.
The checks, each with its control
| check | result | control |
|---|---|---|
up --base dev --gitlab-version 19-3-stable-ee |
finished in about 13 minutes with no manual step: Gitaly at v19.3.3 needs Go 1.25.0, then postgresql: server 17.11, the image's pg_dump 17.11, PG_VERSION 17, and no FALLBACK |
before: up stopped at the Gitaly step, the files API answering 404 for ref=19.3.3 |
RAILS_ENV=development rake db:migrate, then db:schema:dump |
both exit 0, db/structure.sql is rewritten, git diff --exit-code db/structure.sql exits 0, and git status is empty |
before, on PostgreSQL 18.6: the migrate's dump aborted with server version mismatch, and a pg_dump 18 dump differed from the committed file on about 2,570 CONSTRAINT <name> NOT NULL lines |
a scratch development migration adding a column, then rm -rf tmp/run/gitaly-*; bundle exec rspec spec/models/appearance_spec.rb |
after the migrate, the column is in gitlabhq_development only and test still reads environment=test. The spec run reloads test from the dumped structure.sql, test gains the column, and the file gives 65 examples, 0 failures, 4 pending |
before: the migrate stamped the shared databases development, and the reload was refused |
the clone moved to 19-4-stable-ee at c048f25e, then package_ingestion_task_spec.rb |
Gitaly at v19.4.1 needs Go 1.25.10, then 6 examples, 0 failures, and :74 alone twice more, 1 example, 0 failures each |
on PostgreSQL 18.6 the same commit failed :74. Its pluck has no ORDER BY, and the rows came back in another order. No major promises that order, 17 included |
just ci passes. Its offline self-test covers:
- the
vrule for a release, a release candidate and a SHA --varon a fixture tree and through the files API- the PostgreSQL install and its fallback
- a database file with two environments, no shared database, no alias, and the unnamed load
Reverting the v rule, the --var read or the split database file each turns its section red.
Claude Code wrote this change, its tests and this description, and ran the checks above in a simulated environment. Each commit carries the AI-Assisted: yes and AI-Tools: Claude Code trailers that CONTRIBUTING.md asks for.