Skip to content
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

bbs2gh migrate-repo should only require the Bitbucket username and password when it needs to talk to the Bitbucket API #1064

Open
timrogers opened this issue Jul 11, 2023 · 8 comments
Labels
bug Something isn't working

Comments

@timrogers
Copy link
Contributor

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.

if (args.BbsServerUrl.HasValue())
{
var bbsApiFactory = sp.GetRequiredService<BbsApiFactory>();
bbsApi = args.Kerberos
? bbsApiFactory.CreateKerberos(args.BbsServerUrl, args.NoSslVerify)
: bbsApiFactory.Create(args.BbsServerUrl, args.BbsUsername, args.BbsPassword, args.NoSslVerify);
}

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 timrogers added the bug Something isn't working label Jul 11, 2023
@kutsal
Copy link

kutsal commented Mar 22, 2024

@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?

@timrogers
Copy link
Contributor Author

@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?

@laughedelic
Copy link

laughedelic commented May 28, 2024

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 #1198, but there's no reply there)

@timrogers
Copy link
Contributor Author

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.

@laughedelic
Copy link

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.

@dylan-smith
Copy link
Collaborator

I was able to repro this, looks like a bug to me.

Image

@Kumar-Sekar
Copy link

Any updates

@boylejj
Copy link

boylejj commented Jun 12, 2024

I have notified our engineering team and they're looking into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants