Merge ~cjwatson/launchpad:db-oci-push-rule into launchpad:db-devel

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 500cd210a2b1c882ee6190f6f2a2ead56e5f112a
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:db-oci-push-rule
Merge into: launchpad:db-devel
Diff against target: 44 lines (+38/-0)
1 file modified
database/schema/patch-2210-08-6.sql (+38/-0)
Reviewer Review Type Date Requested Status
William Grant db Approve
Tom Wardill (community) Approve
Review via email: mp+380948@code.launchpad.net

Commit message

Add OCIRegistryCredentials and OCIPushRule tables

To post a comment you must log in.
Revision history for this message
Tom Wardill (twom) :
review: Approve
Revision history for this message
William Grant (wgrant) wrote :

It might be worth noting that the "make use of" restriction is just on creating an OCIPushRule.

I'll take your word for it that "image name" is the appropriate term.

review: Approve (db)
~cjwatson/launchpad:db-oci-push-rule updated
500cd21... by Colin Watson

Clarify "make use of" for OCIRegistryCredentials

Revision history for this message
Colin Watson (cjwatson) wrote :

<cjwatson> tomwardill: do you have any opinion on William's half-question about image_name in https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/380948 ?
<tomwardill> image_name seems an appropriate variable name
<cjwatson> OK, good
<tomwardill> I feel like it's something that would be understood by an end user of this
<SpecialK|Canon> +1

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/database/schema/patch-2210-08-6.sql b/database/schema/patch-2210-08-6.sql
2new file mode 100644
3index 0000000..62c5d55
4--- /dev/null
5+++ b/database/schema/patch-2210-08-6.sql
6@@ -0,0 +1,38 @@
7+-- Copyright 2019 Canonical Ltd. This software is licensed under the
8+-- GNU Affero General Public License version 3 (see the file LICENSE).
9+
10+SET client_min_messages=ERROR;
11+
12+CREATE TABLE OCIRegistryCredentials (
13+ id serial PRIMARY KEY,
14+ owner integer NOT NULL REFERENCES Person,
15+ url text NOT NULL,
16+ credentials jsonb NOT NULL
17+);
18+
19+CREATE INDEX ociregistrycredentials__owner__idx
20+ ON OCIRegistryCredentials (owner);
21+
22+COMMENT ON TABLE OCIRegistryCredentials IS 'Credentials for pushing to an OCI registry.';
23+COMMENT ON COLUMN OCIRegistryCredentials.owner IS 'The owner of these credentials. Only the owner is entitled to create push rules using them.';
24+COMMENT ON COLUMN OCIRegistryCredentials.url IS 'The registry URL.';
25+COMMENT ON COLUMN OCIRegistryCredentials.credentials IS 'Encrypted credentials for pushing to the registry.';
26+
27+CREATE TABLE OCIPushRule (
28+ id serial PRIMARY KEY,
29+ recipe integer NOT NULL REFERENCES OCIRecipe,
30+ registry_credentials integer NOT NULL REFERENCES OCIRegistryCredentials,
31+ image_name text NOT NULL
32+);
33+
34+CREATE UNIQUE INDEX ocipushrule__recipe__registry_credentials__image_name__key
35+ ON OCIPushRule (recipe, registry_credentials, image_name);
36+CREATE INDEX ocipushrule__registry_credentials__idx
37+ ON OCIPushRule (registry_credentials);
38+
39+COMMENT ON TABLE OCIPushRule IS 'A rule for pushing builds of an OCI recipe to a registry.';
40+COMMENT ON COLUMN OCIPushRule.recipe IS 'The recipe for which the rule is defined.';
41+COMMENT ON COLUMN OCIPushRule.registry_credentials IS 'The registry credentials to use.';
42+COMMENT ON COLUMN OCIPushRule.image_name IS 'The intended name of the image on the registry.';
43+
44+INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 08, 6);

Subscribers

People subscribed via source and target branches

to status/vote changes: