2016-07-23 17:00:38 +02:00
|
|
|
BEGIN TRANSACTION;
|
|
|
|
|
2021-01-05 10:20:34 +01:00
|
|
|
CREATE TABLE SchemaVersion (
|
|
|
|
version INTEGER NOT NULL
|
|
|
|
);
|
|
|
|
|
2016-07-23 17:00:38 +02:00
|
|
|
CREATE TABLE Specifications (
|
Add support for multiple inputs.
* Makefile.am (dist_sql_DATA): Add src/sql/upgrade-1.sql.
* bin/cuirass.in (show-help, %options, main): Remove the LOAD-PATH option that
was used afterwards as %GUIX-PACKAGE-PATH.
* bin/evaluate.in (absolutize, input-checkout, spec-source, spec-load-path,
spec-package-path, format-checkouts): New procedures.
(%not-colon): Remove variable.
(main): Take the load path, package path and PROC from the checkouts that
result from the inputs. Format the checkouts before sending them to the
procedure. Remove the LOAD-PATH argument.
* doc/cuirass.texi (Overview, Database schema): Document the changes.
* examples/{guix-jobs.scm, hello-git.scm, hello-singleton.scm,
hello-subset.scm, random.scm}: Adapt to the new specification format.
* examples/guix-track-git.scm (package->spec): Rename to PACKAGE->INPUT.
(package->git-tracked): Replace FETCH-REPOSITORY with FETCH-INPUT and handle
the new format of its return value.
* examples/random-jobs.scm (make-random-jobs): Rename RANDOM to CHECKOUT.
Rename the checkout from 'random (which is a specification) to 'cuirass (which
is a checkout resulting from an input).
* src/cuirass/base.scm (fetch-repository): Rename to fetch-input. Rename SPEC
to INPUT. Return a checkout object instead of returning two values.
(evaluate): Take a list of CHECKOUTS and COMMITS as arguments, instead of
SOURCE. Remove TOKENIZE and LOAD-PATH. Pass the CHECKOUTS instead of the
SOURCE to "evaluate". Remove %GUIX-PACKAGE-PATH. Build the EVAL object
instead of getting it from "evaluate".
(compile?, fetch-inputs, compile-checkouts): New procedures.
(process-specs): Fetch all inputs instead of only fetching one repository.
The result of that fetching operation is a list of CHECKOUTS whose COMMITS are
used as a STAMP.
(%guix-package-path, set-guix-package-path): Remove them.
* src/cuirass/database.scm (db-add-input, db-get-inputs): New procedures.
(db-add-specification, db-get-specifications): Adapt to the new specification
format. Add/get all inputs as well.
(db-add-evaluation): Rename REVISION to COMMITS. Store COMMITS as space
separated commit hashes.
(db-get-builds): Rename REPO_NAME to NAME.
(db-get-stamp): Rename COMMIT to STAMP. Return #f when there is no STAMP.
(db-add-stamp): Rename COMMIT to STAMP. Deal with DB-GET-STAMP's new return
value.
(db-get-evaluations): Rename REVISION to COMMITS. Tokenize COMMITS.
* src/cuirass/utils.scm (%non-blocking): Export it.
* src/schema.sql (Inputs): New table that refers to the Specifications table.
(Specifications): Move input related fields to the Inputs table. Rename
REPO_NAME to NAME. Rename ARGUMENTS to PROC_ARGS. Rename FILE to PROC_FILE.
Add LOAD_PATH_INPUTS, PACKAGE_PATH_INPUTS and PROC_INPUT fields that refer to
the Inputs table.
(Stamps): Rename REPO_NAME to NAME.
(Evaluations): Rename REPO_NAME to NAME. Rename REVISION to COMMITS.
(Specifications_index): Replace with Inputs_index.
* src/sql/upgrade-1.sql: New file.
* tests/database.scm (example-spec, make-dummy-eval, sqlite-exec): Adapt to
the new specifications format. Rename REVISION to COMMITS.
* tests/http.scm (evaluations-query-result, fill-db): Idem.
2018-06-26 11:18:23 +02:00
|
|
|
name TEXT NOT NULL PRIMARY KEY,
|
2021-03-03 15:25:04 +01:00
|
|
|
build TEXT NOT NULL,
|
|
|
|
channels TEXT NOT NULL,
|
|
|
|
build_outputs TEXT NOT NULL,
|
|
|
|
notifications TEXT NOT NULL,
|
2021-04-08 15:37:43 +02:00
|
|
|
period INTEGER NOT NULL DEFAULT 0,
|
2021-02-22 11:12:00 +01:00
|
|
|
priority INTEGER NOT NULL DEFAULT 0,
|
2021-03-03 15:25:04 +01:00
|
|
|
systems TEXT NOT NULL
|
2016-07-26 00:36:12 +02:00
|
|
|
);
|
|
|
|
|
2016-07-23 17:00:38 +02:00
|
|
|
CREATE TABLE Evaluations (
|
2021-01-05 10:20:34 +01:00
|
|
|
id SERIAL PRIMARY KEY,
|
2016-11-13 01:54:41 +01:00
|
|
|
specification TEXT NOT NULL,
|
2020-09-10 14:25:19 +02:00
|
|
|
status INTEGER NOT NULL,
|
2020-09-06 13:03:08 +02:00
|
|
|
timestamp INTEGER NOT NULL,
|
|
|
|
checkouttime INTEGER NOT NULL,
|
|
|
|
evaltime INTEGER NOT NULL,
|
2021-03-09 19:13:44 +01:00
|
|
|
FOREIGN KEY (specification) REFERENCES Specifications(name) ON DELETE CASCADE
|
2016-07-16 18:16:39 +02:00
|
|
|
);
|
|
|
|
|
2021-01-05 10:20:34 +01:00
|
|
|
CREATE TABLE Checkouts (
|
|
|
|
specification TEXT NOT NULL,
|
|
|
|
revision TEXT NOT NULL,
|
|
|
|
evaluation INTEGER NOT NULL,
|
2021-03-03 15:25:04 +01:00
|
|
|
channel TEXT NOT NULL,
|
2021-01-05 10:20:34 +01:00
|
|
|
directory TEXT NOT NULL,
|
|
|
|
timestamp INTEGER NOT NULL,
|
|
|
|
PRIMARY KEY (specification, revision),
|
2021-03-09 19:13:44 +01:00
|
|
|
FOREIGN KEY (evaluation) REFERENCES Evaluations(id) ON DELETE CASCADE,
|
|
|
|
FOREIGN KEY (specification) REFERENCES Specifications(name) ON DELETE CASCADE
|
2017-07-31 19:25:28 +02:00
|
|
|
);
|
|
|
|
|
2016-07-23 17:00:38 +02:00
|
|
|
CREATE TABLE Builds (
|
2021-01-05 10:20:34 +01:00
|
|
|
id SERIAL PRIMARY KEY,
|
2020-01-24 20:47:43 +01:00
|
|
|
derivation TEXT NOT NULL UNIQUE,
|
2016-07-27 13:21:11 +02:00
|
|
|
evaluation INTEGER NOT NULL,
|
database: Merge Derivations into Builds table.
Fixes <https://bugs.gnu.org/32190>.
* Makefile.am (dist_sql_DATA): Add 'src/sql/upgrade-2.sql'.
* doc/cuirass.texi (Derivations): Remove section.
(Builds): Update accordingly. Add columns from the Derivations table.
(Outputs): Replace 'id' with 'derivation'.
* src/cuirass/base.scm (evaluate): Don't add jobs to the Derivations table.
(build-packages): Add columns that were in the Derivations table before. Only
build the derivations that were successfully registered, that is, those that
didn't exist in the Builds table. Give a derivation instead of a build id to
DB-GET-BUILD. Compute the number of failed jobs based on the derivations that
were added to the table, instead of the jobs.
* src/cuirass/database.scm (db-add-derivation, db-get-derivation): Remove
exported procedures.
(db-add-build): Catch SQLITE_CONSTRAINT_PRIMARYKEY error, which means that two
jobs produced the same derivation, and return #f in that case. Add columns
that were in the Derivations table before. Use 'derivation' as primary key
for the Outputs table.
(db-get-outputs): Use 'derivation' as identifier, instead of 'build-id'.
(filters->order): Replace 'id' with 'rowid'.
(db-get-builds): Add a 'derivation' filter. Replace 'id' with 'rowid'.
Remove the 'INNER JOIN Derivations'. Replace Derivations with Builds. Return
'derivation' in first position to make it clear that it's the primary key.
Pass DERIVATION instead of ID to DB-GET-OUTPUTS.
(db-get-build): Allow to take a derivation as argument. Use NUMBER? to
differentiate between derivations and ids.
(db-get-pending-derivations): Remove the 'SELECT DISTINCT' clause now that
derivations are unique. Remove the 'INNER JOIN Builds'.
(db-get-evaluations-build-summary, db-get-builds-min, db-get-builds-max):
Replace 'id' with 'rowid'.
* src/schema.sql (Derivations): Remove table.
(Outputs): Replace Builds.id with Builds.derivation.
(Builds): Use 'derivation' as primary key. Remove the 'id' column. Add
'job_name', 'system', 'nix_name' columns that were in the Derivations table
before.
(Builds_Derivations_index): Rename to Builds_index. Update accordingly.
(Derivations_index): Remove index.
* src/sql/upgrade-2.sql: New file with SQL queries to upgrade the database.
* tests/database.scm (make-dummy-job, make-dummy-derivation): Remove
procedures.
(make-dummy-build): Add columns that were in MAKE-DUMMY-DERIVATION. Get the
DRV parameter to be mandatory because it's a primary key.
(%id): Remove parameter.
("db-add-derivation", "db-get-derivation"): Remove tests.
("db-add-build"): Expect #f, because it adds twice the same derivation. Pass
the derivation argument to MAKE-DUMMY-BUILD.
("db-update-build-status!"): Rename 'id' to 'derivation'. Pass the derivation
argument to MAKE-DUMMY-BUILD. Remove the DB-ADD-DERIVATION call.
("db-get-builds", "db-get-pending-derivations"): Pass the derivation argument
to MAKE-DUMMY-BUILD. Remove the DB-ADD-DERIVATION calls.
* tests/http.scm ("fill-db"): Remove DERIVATION1 and DERIVATION2, and put
their content in BUILD1 and BUILD2. Remove the DB-ADD-DERIVATION calls.
2018-08-01 00:03:12 +02:00
|
|
|
job_name TEXT NOT NULL,
|
|
|
|
system TEXT NOT NULL,
|
Add remote build support.
* src/cuirass/remote.scm: New file.
* src/cuirass/remote-server.scm: New file.
* src/cuirass/remote-worker.scm: New file.
* bin/remote-server.in: New file.
* bin/remote-worker.in: New file.
* Makefile.am (bin_SCRIPTS): Add new binaries,
(dist_pkgmodule_DATA): add new files,
(EXTRA_DIST): add new binaries,
(bin/remote-server, bin/remote-worker): new targets.
* .gitignore: Add new binaries.
* bin/cuirass.in (%options): Add "--build-remote" option,
(show-help): document it,
(main): honor it.
* src/cuirass/base.scm (with-build-offload-thread): New macro,
(%build-remote?, %build-offload-channel): new parameters,
(make-build-offload-thread): new procedure,
(build-derivations/offload): new procedure,
(restart-builds): use it to offload builds when %build-remote? is set,
(build-packages): ditto.
2020-12-02 11:13:33 +01:00
|
|
|
worker TEXT, --optional, worker performing the build.
|
database: Merge Derivations into Builds table.
Fixes <https://bugs.gnu.org/32190>.
* Makefile.am (dist_sql_DATA): Add 'src/sql/upgrade-2.sql'.
* doc/cuirass.texi (Derivations): Remove section.
(Builds): Update accordingly. Add columns from the Derivations table.
(Outputs): Replace 'id' with 'derivation'.
* src/cuirass/base.scm (evaluate): Don't add jobs to the Derivations table.
(build-packages): Add columns that were in the Derivations table before. Only
build the derivations that were successfully registered, that is, those that
didn't exist in the Builds table. Give a derivation instead of a build id to
DB-GET-BUILD. Compute the number of failed jobs based on the derivations that
were added to the table, instead of the jobs.
* src/cuirass/database.scm (db-add-derivation, db-get-derivation): Remove
exported procedures.
(db-add-build): Catch SQLITE_CONSTRAINT_PRIMARYKEY error, which means that two
jobs produced the same derivation, and return #f in that case. Add columns
that were in the Derivations table before. Use 'derivation' as primary key
for the Outputs table.
(db-get-outputs): Use 'derivation' as identifier, instead of 'build-id'.
(filters->order): Replace 'id' with 'rowid'.
(db-get-builds): Add a 'derivation' filter. Replace 'id' with 'rowid'.
Remove the 'INNER JOIN Derivations'. Replace Derivations with Builds. Return
'derivation' in first position to make it clear that it's the primary key.
Pass DERIVATION instead of ID to DB-GET-OUTPUTS.
(db-get-build): Allow to take a derivation as argument. Use NUMBER? to
differentiate between derivations and ids.
(db-get-pending-derivations): Remove the 'SELECT DISTINCT' clause now that
derivations are unique. Remove the 'INNER JOIN Builds'.
(db-get-evaluations-build-summary, db-get-builds-min, db-get-builds-max):
Replace 'id' with 'rowid'.
* src/schema.sql (Derivations): Remove table.
(Outputs): Replace Builds.id with Builds.derivation.
(Builds): Use 'derivation' as primary key. Remove the 'id' column. Add
'job_name', 'system', 'nix_name' columns that were in the Derivations table
before.
(Builds_Derivations_index): Rename to Builds_index. Update accordingly.
(Derivations_index): Remove index.
* src/sql/upgrade-2.sql: New file with SQL queries to upgrade the database.
* tests/database.scm (make-dummy-job, make-dummy-derivation): Remove
procedures.
(make-dummy-build): Add columns that were in MAKE-DUMMY-DERIVATION. Get the
DRV parameter to be mandatory because it's a primary key.
(%id): Remove parameter.
("db-add-derivation", "db-get-derivation"): Remove tests.
("db-add-build"): Expect #f, because it adds twice the same derivation. Pass
the derivation argument to MAKE-DUMMY-BUILD.
("db-update-build-status!"): Rename 'id' to 'derivation'. Pass the derivation
argument to MAKE-DUMMY-BUILD. Remove the DB-ADD-DERIVATION call.
("db-get-builds", "db-get-pending-derivations"): Pass the derivation argument
to MAKE-DUMMY-BUILD. Remove the DB-ADD-DERIVATION calls.
* tests/http.scm ("fill-db"): Remove DERIVATION1 and DERIVATION2, and put
their content in BUILD1 and BUILD2. Remove the DB-ADD-DERIVATION calls.
2018-08-01 00:03:12 +02:00
|
|
|
nix_name TEXT NOT NULL,
|
2016-07-27 13:21:11 +02:00
|
|
|
log TEXT NOT NULL,
|
2017-07-31 19:25:28 +02:00
|
|
|
status INTEGER NOT NULL,
|
2021-02-01 11:44:35 +01:00
|
|
|
last_status INTEGER,
|
2021-02-02 11:56:28 +01:00
|
|
|
weather INTEGER,
|
Add remote build support.
* src/cuirass/remote.scm: New file.
* src/cuirass/remote-server.scm: New file.
* src/cuirass/remote-worker.scm: New file.
* bin/remote-server.in: New file.
* bin/remote-worker.in: New file.
* Makefile.am (bin_SCRIPTS): Add new binaries,
(dist_pkgmodule_DATA): add new files,
(EXTRA_DIST): add new binaries,
(bin/remote-server, bin/remote-worker): new targets.
* .gitignore: Add new binaries.
* bin/cuirass.in (%options): Add "--build-remote" option,
(show-help): document it,
(main): honor it.
* src/cuirass/base.scm (with-build-offload-thread): New macro,
(%build-remote?, %build-offload-channel): new parameters,
(make-build-offload-thread): new procedure,
(build-derivations/offload): new procedure,
(restart-builds): use it to offload builds when %build-remote? is set,
(build-packages): ditto.
2020-12-02 11:13:33 +01:00
|
|
|
priority INTEGER NOT NULL DEFAULT 0,
|
|
|
|
max_silent INTEGER NOT NULL DEFAULT 0,
|
|
|
|
timeout INTEGER NOT NULL DEFAULT 0,
|
2017-07-31 19:25:28 +02:00
|
|
|
timestamp INTEGER NOT NULL,
|
|
|
|
starttime INTEGER NOT NULL,
|
|
|
|
stoptime INTEGER NOT NULL,
|
2021-03-09 19:13:44 +01:00
|
|
|
FOREIGN KEY (evaluation) REFERENCES Evaluations(id) ON DELETE CASCADE
|
2021-01-05 10:20:34 +01:00
|
|
|
);
|
|
|
|
|
2021-04-08 10:49:41 +02:00
|
|
|
CREATE TABLE Jobs (
|
|
|
|
name TEXT NOT NULL,
|
|
|
|
evaluation INTEGER NOT NULL,
|
|
|
|
build INTEGER NOT NULL,
|
2021-04-14 15:05:00 +02:00
|
|
|
status INTEGER NOT NULL, --caches Builds.status
|
|
|
|
system TEXT NOT NULL, --caches Builds.system
|
2021-04-08 10:49:41 +02:00
|
|
|
PRIMARY KEY (evaluation, build),
|
|
|
|
FOREIGN KEY (build) REFERENCES Builds(id) ON DELETE CASCADE,
|
|
|
|
FOREIGN KEY (evaluation) REFERENCES Evaluations(id) ON DELETE CASCADE
|
|
|
|
);
|
|
|
|
|
2021-01-05 10:20:34 +01:00
|
|
|
CREATE TABLE Outputs (
|
|
|
|
derivation TEXT NOT NULL,
|
|
|
|
name TEXT NOT NULL,
|
|
|
|
path TEXT NOT NULL PRIMARY KEY,
|
|
|
|
FOREIGN KEY (derivation) REFERENCES Builds(derivation) ON DELETE CASCADE
|
2016-07-16 18:16:39 +02:00
|
|
|
);
|
2016-07-23 17:00:38 +02:00
|
|
|
|
2020-09-14 14:25:23 +02:00
|
|
|
CREATE TABLE Metrics (
|
2021-01-05 10:20:34 +01:00
|
|
|
id SERIAL,
|
|
|
|
field TEXT NOT NULL,
|
2020-09-14 14:25:23 +02:00
|
|
|
type INTEGER NOT NULL,
|
|
|
|
value DOUBLE PRECISION NOT NULL,
|
|
|
|
timestamp INTEGER NOT NULL,
|
|
|
|
PRIMARY KEY (field, type)
|
|
|
|
);
|
|
|
|
|
2020-06-10 15:58:11 +02:00
|
|
|
CREATE TABLE BuildProducts (
|
2021-01-05 10:20:34 +01:00
|
|
|
id SERIAL,
|
2020-06-10 15:58:11 +02:00
|
|
|
build INTEGER NOT NULL,
|
|
|
|
type TEXT NOT NULL,
|
|
|
|
file_size BIGINT NOT NULL,
|
|
|
|
checksum TEXT NOT NULL,
|
|
|
|
path TEXT NOT NULL,
|
2021-01-05 10:20:34 +01:00
|
|
|
PRIMARY KEY (build, path),
|
|
|
|
FOREIGN KEY (build) REFERENCES Builds(id) ON DELETE CASCADE
|
2020-06-10 15:58:11 +02:00
|
|
|
);
|
|
|
|
|
2021-03-11 10:27:13 +01:00
|
|
|
CREATE TABLE Notifications (
|
2021-01-05 10:20:34 +01:00
|
|
|
id SERIAL PRIMARY KEY,
|
2019-10-21 23:43:16 +02:00
|
|
|
type TEXT NOT NULL,
|
2021-03-11 10:27:13 +01:00
|
|
|
build INTEGER NOT NULL,
|
|
|
|
FOREIGN KEY (build) REFERENCES Builds(id) ON DELETE CASCADE
|
2019-10-21 23:43:16 +02:00
|
|
|
);
|
|
|
|
|
Add remote build support.
* src/cuirass/remote.scm: New file.
* src/cuirass/remote-server.scm: New file.
* src/cuirass/remote-worker.scm: New file.
* bin/remote-server.in: New file.
* bin/remote-worker.in: New file.
* Makefile.am (bin_SCRIPTS): Add new binaries,
(dist_pkgmodule_DATA): add new files,
(EXTRA_DIST): add new binaries,
(bin/remote-server, bin/remote-worker): new targets.
* .gitignore: Add new binaries.
* bin/cuirass.in (%options): Add "--build-remote" option,
(show-help): document it,
(main): honor it.
* src/cuirass/base.scm (with-build-offload-thread): New macro,
(%build-remote?, %build-offload-channel): new parameters,
(make-build-offload-thread): new procedure,
(build-derivations/offload): new procedure,
(restart-builds): use it to offload builds when %build-remote? is set,
(build-packages): ditto.
2020-12-02 11:13:33 +01:00
|
|
|
CREATE TABLE Workers (
|
|
|
|
name TEXT NOT NULL PRIMARY KEY,
|
|
|
|
address TEXT NOT NULL,
|
2021-01-30 14:18:59 +01:00
|
|
|
machine TEXT NOT NULL,
|
Add remote build support.
* src/cuirass/remote.scm: New file.
* src/cuirass/remote-server.scm: New file.
* src/cuirass/remote-worker.scm: New file.
* bin/remote-server.in: New file.
* bin/remote-worker.in: New file.
* Makefile.am (bin_SCRIPTS): Add new binaries,
(dist_pkgmodule_DATA): add new files,
(EXTRA_DIST): add new binaries,
(bin/remote-server, bin/remote-worker): new targets.
* .gitignore: Add new binaries.
* bin/cuirass.in (%options): Add "--build-remote" option,
(show-help): document it,
(main): honor it.
* src/cuirass/base.scm (with-build-offload-thread): New macro,
(%build-remote?, %build-offload-channel): new parameters,
(make-build-offload-thread): new procedure,
(build-derivations/offload): new procedure,
(restart-builds): use it to offload builds when %build-remote? is set,
(build-packages): ditto.
2020-12-02 11:13:33 +01:00
|
|
|
systems TEXT NOT NULL,
|
|
|
|
last_seen INTEGER NOT NULL
|
|
|
|
);
|
|
|
|
|
2020-10-07 11:49:30 +02:00
|
|
|
-- XXX: All queries targeting Builds and Outputs tables *must* be covered by
|
|
|
|
-- an index. It is also preferable for the other tables.
|
2020-06-09 22:46:49 +02:00
|
|
|
CREATE INDEX Builds_status_index ON Builds (status);
|
2020-09-28 17:47:19 +02:00
|
|
|
CREATE INDEX Builds_evaluation_index ON Builds (evaluation, status);
|
2020-11-25 15:49:04 +01:00
|
|
|
CREATE INDEX Builds_job_name_timestamp on Builds(job_name, timestamp);
|
2021-01-05 10:20:34 +01:00
|
|
|
CREATE INDEX Builds_nix_name ON Builds (nix_name);
|
2020-10-06 18:26:28 +02:00
|
|
|
CREATE INDEX Builds_timestamp_stoptime on Builds(timestamp, stoptime);
|
2020-10-07 11:49:30 +02:00
|
|
|
CREATE INDEX Builds_stoptime on Builds(stoptime DESC);
|
|
|
|
CREATE INDEX Builds_stoptime_id on Builds(stoptime DESC, id DESC);
|
|
|
|
CREATE INDEX Builds_status_ts_id on Builds(status DESC, timestamp DESC, id ASC);
|
2021-01-05 10:20:34 +01:00
|
|
|
CREATE INDEX Builds_priority_timestamp on Builds(priority ASC, timestamp DESC);
|
2021-02-02 11:56:28 +01:00
|
|
|
CREATE INDEX Builds_weather_evaluation ON Builds (weather, evaluation);
|
2020-10-07 11:49:30 +02:00
|
|
|
|
2021-04-06 15:15:18 +02:00
|
|
|
CREATE INDEX Jobs_name ON Jobs (name);
|
2021-04-14 15:05:00 +02:00
|
|
|
CREATE INDEX Jobs_system_status ON Jobs (system, status);
|
2021-04-06 15:15:18 +02:00
|
|
|
|
2020-09-28 17:47:19 +02:00
|
|
|
CREATE INDEX Evaluations_status_index ON Evaluations (id, status);
|
|
|
|
CREATE INDEX Evaluations_specification_index ON Evaluations (specification, id DESC);
|
2020-10-07 11:49:30 +02:00
|
|
|
|
2020-06-09 22:46:49 +02:00
|
|
|
CREATE INDEX Outputs_derivation_index ON Outputs (derivation);
|
2020-10-07 11:49:30 +02:00
|
|
|
|
2016-07-23 17:00:38 +02:00
|
|
|
COMMIT;
|