Skip to content

Conversation

migmartri
Copy link
Member

Add support for the creation of OCI CAS backends, including switch between defaults.

  • You can now have registered more than one CAS backend, only one will be set as default though
  • If you register a backend and set it as default, a confirmation prompt will be shown to the user and if accepted, a DB transaction will replace the current default to the new one.
# add a default backend
$ chainloop cas-backend add oci --repo us-central1-docker.pkg.dev/axiomatic-grove-366622/chainloop-demo-org --username _json_key --password "$(cat ...)" --description "my first CAS Backend" --default

┌──────────────────────────────────────┬──────────────────────────────────────────────────────────────────────┬──────────┬─────────┐
│ ID                                   │ BACKEND                                                              │ PROVIDER │ DEFAULT │
├──────────────────────────────────────┼──────────────────────────────────────────────────────────────────────┼──────────┼─────────┤
│ ffb3d549-9561-4b0b-8136-a7783923904c │ us-central1-docker.pkg.dev/axiomatic-grove-366622/chainloop-demo-org │ OCI      │ true    │
│                                      │ my first CAS Backend                                                 │          │         │
└──────────────────────────────────────┴──────────────────────────────────────────────────────────────────────┴──────────┴─────────┘

# add a second backend which will replace the previous one
$ chainloop cas-backend add oci --repo us-central1-docker.pkg.dev/axiomatic-grove-366622/chainloop-demo-org --username _json_key --password "$(cat ...)" --description "Second Backend" --default

Please confirm to override y/N: 
y
┌──────────────────────────────────────┬──────────────────────────────────────────────────────────────────────┬──────────┬─────────┐
│ ID                                   │ BACKEND                                                              │ PROVIDER │ DEFAULT │
├──────────────────────────────────────┼──────────────────────────────────────────────────────────────────────┼──────────┼─────────┤
│ c2717c0c-e4e4-4700-8168-c12ff2cf833a │ us-central1-docker.pkg.dev/axiomatic-grove-366622/chainloop-demo-org │ OCI      │ true    │
│                                      │ second BBackend                                                      │          │         │
└──────────────────────────────────────┴──────────────────────────────────────────────────────────────────────┴──────────┴─────────┘

# it has replaced the previous one
$ chainloop cas-backend list
┌──────────────────────────────────────┬──────────────────────────────────────────────────────────────────────┬──────────┬─────────┐
│ ID                                   │ BACKEND                                                              │ PROVIDER │ DEFAULT │
├──────────────────────────────────────┼──────────────────────────────────────────────────────────────────────┼──────────┼─────────┤
│ c2717c0c-e4e4-4700-8168-c12ff2cf833a │ us-central1-docker.pkg.dev/axiomatic-grove-366622/chainloop-demo-org │ OCI      │ true    │
│                                      │ second BBackend                                                      │          │         │
├──────────────────────────────────────┼──────────────────────────────────────────────────────────────────────┼──────────┼─────────┤
│ ffb3d549-9561-4b0b-8136-a7783923904c │ us-central1-docker.pkg.dev/axiomatic-grove-366622/chainloop-demo-org │ OCI      │ false   │
│                                      │ my first CAS Backend                                                 │          │         │
├──────────────────────────────────────┼──────────────────────────────────────────────────────────────────────┼──────────┼─────────┤

Refs #223

Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
@migmartri migmartri requested a review from danlishka July 13, 2023 10:57
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
Copy link
Member

@danlishka danlishka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks!

@migmartri migmartri merged commit 63d89d5 into chainloop-dev:main Jul 13, 2023
@migmartri migmartri deleted the add-cmd branch July 13, 2023 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants