Page MenuHomeSoftware Heritage

cli.db: Open init-admin subcmd to initialize superuser-level scripts
ClosedPublic

Authored by ardumont on Oct 28 2020, 6:35 PM.

Details

Summary

In staging, the db is already created by puppet (with necessary users, etc...).

The current create database cli swh db create does not work currently. The
subsequent steps of postgresql extensions installation is required though (and
it's currently stuck on the creation step failing).

This commit allows to use the init-admin to just install those extensions (and
eventually add/update existing/new ones).

In future diffs, we could also fallback to the postgresql image ability to
create the database during its initialization (and then drop the current `if db
exists` instruction in our entrypoint scripts). D4377 demonstrates such a
behavior \o/

Related to T2736

Test Plan

current tox is happy

(I'll investigate later on how properly test those cli T2741 -> D4381).

Diff Detail

Event Timeline

Build has FAILED

Patch application report for D4374 (id=15476)

Rebasing onto eefe1b6336...

Current branch diff-target is up to date.
Changes applied before test
commit 4ceba9dcef6967535fc6aee5b3ad11ce7cee0a48
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Wed Oct 28 18:27:46 2020 +0100

    cli.db: Open init-admin subcmd to initialize superuser-level scripts
    
    In staging, the db is already created by puppet, the current create database
    stanza forced within the create-db cannot work.
    
    Ths subsequent steps of postgresql extensions installation is required though.
    
    This will allow it.
    
    Related to T2736

Link to build: https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/119/
See console output for more information: https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/119/console

Build is green

Patch application report for D4374 (id=15477)

Rebasing onto eefe1b6336...

Current branch diff-target is up to date.
Changes applied before test
commit ac5e815466492311a70f3c1d5ddb4180b1fc11ef
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Wed Oct 28 18:27:46 2020 +0100

    cli.db: Open init-admin subcmd to initialize superuser-level scripts
    
    In staging, the db is already created by puppet, the current create database
    stanza forced within the create-db cannot work.
    
    Ths subsequent steps of postgresql extensions installation is required though.
    
    This will allow it.
    
    Related to T2736

See https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/120/ for more details.

Drop spurious logging instructions

Build is green

Patch application report for D4374 (id=15478)

Rebasing onto eefe1b6336...

Current branch diff-target is up to date.
Changes applied before test
commit 745448399ebda14f08a9286b08fb6dd008d9504b
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Wed Oct 28 18:27:46 2020 +0100

    cli.db: Open init-admin subcmd to initialize superuser-level scripts
    
    In staging, the db is already created by puppet, the current create database
    stanza forced within the create-db cannot work.
    
    Ths subsequent steps of postgresql extensions installation is required though.
    
    This will allow it.
    
    Related to T2736

See https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/121/ for more details.

ardumont edited the test plan for this revision. (Show Details)
olasd edited reviewers, added: douardda, olasd; removed: Reviewers.
olasd added a subscriber: olasd.

In regards to D4377, I guess adding this command makes sense.

This revision is now accepted and ready to land.Oct 29 2020, 4:18 PM