`bbs2gh migrate-repo` should only require the Bitbucket username and password when it needs to talk to the Bitbucket API
As of #1057, we require --bbs-server-url to be provided for all variants of bbs2gh migrate-repo - even ones where we don't need to talk to the Bitbucket Server's API (i.e. the upload-and-import flow and the import-only flow).
We have started requiring the URL because we need it to communicate to the GitHub API which repo to pick from the archive when running the migration (see #1057 for more context).
This has the unwanted side effect that we now also require the Bitbucket Server username and password to be configured for all of the variants - even those ones that don't need to talk to the Bitbucket Server's API, and so won't use the username and password.
https://github.com/github/gh-gei/blob/d5bcc2b6c872517847a5dd857a99419baf334325/src/bbs2gh/Commands/MigrateRepo/MigrateRepoCommand.cs#L224-L231
We should improve this logic so that the Bitbucket username and password is only required for command variants which will talk to the Bitbucket API.
@timrogers we're hitting this bug as we try to migrate a couple of repositories from our internet-disconnected Bitbucket server instance using the --archive-path option and not the "default" end-to-end flow. Specifically with the following error:
[2024-03-22 14:34:48] [ERROR] OctoshiftCLI.OctoshiftCliException: --bbs-username and --bbs-password can only be provided with --bbs-server-url.
at OctoshiftCLI.BbsToGithub.Commands.MigrateRepo.MigrateRepoCommandArgs.ValidateNoGenerateOptions()
at OctoshiftCLI.BbsToGithub.Commands.MigrateRepo.MigrateRepoCommandArgs.Validate(OctoLogger log)
at OctoshiftCLI.Extensions.CommandExtensions.RunHandler[TArgs,THandler](TArgs args, ServiceProvider sp, CommandBase`2 command)
Is there an ETA for fixing this (i.e. make the --bbs-user/pass options not required when --archive-path is specified) so we're able to migrate these repositories?
@kutsal Thanks for flagging this issue! I'm no longer working on GitHub Enterprise Importer, so I'll CC in @boylejj who has taken over from me.
If you give a dummy --bbs-username and --bbs-password, does that work as a workaround? Or are you totally blocked?
Hi! I'm hitting the same issue. I tried providing dummy values for the username/password, but got the same
--bbs-username and --bbs-password can only be provided with --bbs-server-url
even though --bbs-server-url is also set.
@kutsal have you figured out any workaround for this?
EDIT: this was a problem with the CLI arguments, setting dummy BBS_USERNAME and BBS_PASSWORD works past that error, but now I get
Either Azure storage connection (--azure-storage-connection-string or AZURE_STORAGE_CONNECTION_STRING env. variable) or AWS S3 connection (--aws-bucket-name, --aws-access-key (or AWS_ACCESS_KEY_ID env. variable), --aws-secret-key (or AWS_SECRET_ACCESS_KEY env.variable)) must be provided.
Which seems completely irrelevant because I already have the archive locally and don't need to upload it anywhere. Is the blob-storage step absolutely unavoidable in the migration process?
(I just found https://github.com/github/gh-gei/issues/1198, but there's no reply there)
EDIT: this was a problem with the CLI arguments, setting dummy BBS_USERNAME and BBS_PASSWORD works past that error, but now I get
@laughedelic That sounds strange. Are you able to share a full example command that triggers the error, but doesn't trigger it with the environment variables, with any sensitive details redacted?
Which seems completely irrelevant because I already have the archive locally and don't need to upload it anywhere. Is the blob-storage step absolutely unavoidable in the migration process?
I'm afraid it is - the way that your data gets transferred to GitHub.com is via blob storage - even if you already have the archive locally on your machine.
Hi @timrogers! Sure, here's the command I was trying to run initially:
gh bbs2gh migrate-repo \
--github-pat "$(gh auth token)" \
--archive-path '...' \
--bbs-server-url '...' \
--bbs-project '...' \
--bbs-repo '...' \
--bbs-username 'laughedelic' \
--bbs-password 'pswd' \
--github-org '...' \
--github-repo '...' \
--keep-archive \
--target-repo-visibility private
Which results in "--bbs-username and --bbs-password can only be provided with --bbs-server-url". Then I changed it to
export BBS_USERNAME='laughedelic'
export BBS_PASSWORD='pswd'
gh bbs2gh migrate-repo \
--github-pat "$(gh auth token)" \
--archive-path '...' \
--bbs-server-url '...' \
--bbs-project '...' \
--bbs-repo '...' \
--github-org '...' \
--github-repo '...' \
--keep-archive \
--target-repo-visibility private
and ran into the blob-storage requirement.
Thanks for the explanation, it wasn't clear to me from the docs alone. I will try to proceed with an S3 bucket.
I was able to repro this, looks like a bug to me.
Any updates
I have notified our engineering team and they're looking into it.