-
Notifications
You must be signed in to change notification settings - Fork 1
add mapping docs #245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
add mapping docs #245
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| # Creating a Syfon Bucket Scope Mapping | ||
|
|
||
| This fixes upload failures where Syfon can authenticate the request, but cannot | ||
| choose a storage bucket for the requested organization/project. | ||
|
|
||
| Example failure: | ||
|
|
||
| ```text | ||
| failed batch register/upload workflow: upload error: GET https://calypr-dev.ohsu.edu/data/upload/... status 400 body=invalid input: no bucket scope configured for organization "cbds" project "monorepos" | ||
| ``` | ||
|
|
||
| That error means the server is missing a bucket scope mapping for | ||
| `cbds/monorepos`. It is usually steward/admin setup, not a normal end-user file | ||
| problem. `git-drs` can create the mapping if the caller has an admin token for | ||
| the target Syfon server. | ||
|
|
||
| ## 1. Make Sure the Bucket Credential Exists | ||
|
|
||
| If the bucket credential is not already configured on Syfon, add it first: | ||
|
|
||
| ```bash | ||
| git drs bucket add calypr-dev \ | ||
| --bucket cbds \ | ||
| --region us-east-1 \ | ||
| --access-key "$AWS_ACCESS_KEY_ID" \ | ||
| --secret-key "$AWS_SECRET_ACCESS_KEY" \ | ||
| --s3-endpoint https://s3.amazonaws.com | ||
| ``` | ||
|
|
||
| Use the real bucket name, region, endpoint, and credentials for the environment. | ||
| The remote name, `calypr-dev` above, must resolve to the Syfon endpoint and | ||
| token, or you can pass `--url`, `--token`, or `--cred`. | ||
|
|
||
| ## 2. Add the Project Mapping | ||
|
|
||
| For the error above, create a project-specific mapping: | ||
|
|
||
| ```bash | ||
| git drs bucket add-project calypr-dev \ | ||
| --organization cbds \ | ||
| --project monorepos \ | ||
| --path s3://cbds/monorepos | ||
| ``` | ||
|
|
||
| `--path` is the storage root Syfon should use for that scope. The bucket is read | ||
| from the URL host (`cbds`), and the remaining path (`monorepos`) is stored as | ||
| the prefix. | ||
|
|
||
| If a mapping already exists and needs to be replaced, add `--force`. | ||
|
|
||
| ## 3. Retry the User Workflow | ||
|
|
||
| After the mapping exists, the user can retry: | ||
|
|
||
| ```bash | ||
| git drs push | ||
| ``` | ||
|
|
||
| No change to the tracked file is required. The upload URL request will include | ||
| `organization=cbds&project=monorepos`, and Syfon should now resolve that scope to | ||
| the configured bucket path. | ||
|
|
||
| ## When To Use an Organization Mapping | ||
|
|
||
| Use an organization mapping when every project in an organization should share a | ||
| common root: | ||
|
|
||
| ```bash | ||
| git drs bucket add-organization calypr-dev \ | ||
| --organization cbds \ | ||
| --path s3://cbds | ||
| ``` | ||
|
|
||
| Then add project mappings only when a project needs a specific subpath. For most | ||
| one-off upload failures, `add-project` is the least surprising fix. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When readers follow this section by first adding the organization mapping in the same repo and then running
git drs bucket add-project, the command fails unless--forceis passed:addScopechecksgitrepo.GetBucketMapping(org, project), and that helper falls back to the org-level mapping before returningok(cmd/bucket/main.go:200-203; internal/gitrepo/bucket_map.go:93-105). Please call out--forcehere; otherwise the documented path for adding a project subpath under an org mapping stops before creating the server scope.Useful? React with 👍 / 👎.