From 55c304b7e731adc54e1d6a7954c5c7761aa518d2 Mon Sep 17 00:00:00 2001 From: Scott Patten Date: Thu, 6 Apr 2023 21:04:00 +0000 Subject: [PATCH] Prepare v0.1.1 (#57) --- CHANGELOG.md | 9 ++++- Cargo.lock | 2 +- Cargo.toml | 2 +- docs/README.md | 2 ++ docs/subcommands/fix.md | 77 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 89 insertions(+), 3 deletions(-) create mode 100644 docs/subcommands/fix.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 13d8a09..b0603bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## v0.1.1 + +Add `broker fix` + +`broker fix` tests your connection to FOSSA and your `git` integrations and gives you advice on how to fix any problems it encounters. + +For more information on `broker fix`, see the [`broker fix` subcommand documentation](https://github.com/fossas/broker/blob/main/docs/subcommands/fix.md). ## v0.1.0 @@ -18,4 +25,4 @@ Broker MVP release - Creating the Broker data location. - Creating example Broker config files. -See the [Broker User Manual](./docs/README.md) for more help using Broker. +See the [Broker User Manual](https://github.com/fossas/broker/blob/main/docs/README.md) for more help using Broker. diff --git a/Cargo.lock b/Cargo.lock index b4e6093..73f0867 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -182,7 +182,7 @@ dependencies = [ [[package]] name = "broker" -version = "0.1.0" +version = "0.1.1" dependencies = [ "aho-corasick", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index b6a321e..ac9064d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "broker" -version = "0.1.0" +version = "0.1.1" edition = "2021" description = "The bridge between FOSSA and internal DevOps services" readme = "README.md" diff --git a/docs/README.md b/docs/README.md index 66313e2..cd1ea4b 100644 --- a/docs/README.md +++ b/docs/README.md @@ -32,6 +32,8 @@ Initialize an empty configuration file and database. Diagnose possible issues in the local runtime environment that may be preventing Broker from scanning projects and sending their metadata to FOSSA. +For more information, see the [`fix` subcommand documentation](./subcommands/fix.md). + ### `run` Boots Broker using the local config file, scanning the projects on diff --git a/docs/subcommands/fix.md b/docs/subcommands/fix.md new file mode 100644 index 0000000..0e94435 --- /dev/null +++ b/docs/subcommands/fix.md @@ -0,0 +1,77 @@ +# The `fix` subcommand + +The `fix` subcommand can be used to help you diagnose problems with your connection to fossa and with your connection to your integrations. + +To use it, simple run `broker fix`. This will test `broker`'s ability to connect to each of your integrations and FOSSA's servers. + +If all goes well, you will see something like this: + +``` +Diagnosing connections to configured repositories + +✅ https://github.com/fossas/broker.git +✅ https://github.com/fossas/fossa-cli.git + +Diagnosing connection to FOSSA + +✅ check fossa API connection with no auth required +✅ check fossa API connection with auth required +``` + +If there are problems, then we will report the problem and give you instructions on how to fix or diagnose the problem. + +For example, here is some output with two problems. The first problem is an error while trying to connect to https://github.com/fossas/fossa-cli.git. The second is while trying to make an authenticated connection to the FOSSA API. + +`broker` will give you some information about the problem and some commands that you can run to understand and diagnose the source of the problem. In this case, both problems were caused by incorrect API keys and can be fixed by changing the authentication information in `broker`'s `config.yml`. + +``` +Diagnosing connections to configured repositories + +✅ https://github.com/fossas/broker.git +❌ https://github.com/fossas/fossa-cli.git + +Diagnosing connection to FOSSA + +✅ check fossa API connection with no auth required +❌ check fossa API connection with auth required + +Errors found while checking integrations + +❌ https://github.com/fossas/fossa-cli.git + +We encountered an error while trying to connect to your git remote at https://github.com/fossas/fossa-cli.git. + +We were unable to connect to this repository. Please make sure that the authentication info and the remote are set correctly in your config.yml file. + +You are using HTTP basic authentication for this remote. This method of authentication encodes the username and password as a base64 string and then passes that to git using the "http.extraHeader" parameter. To debug this, please make sure that the following commands work. + +You generate the base64 encoded username and password by joining them with a ":" and then base64 encoding them. If your username was "pat" and your password was "password123", then you would base64 encode "pat:password123". For example, you can use a command like this: + +echo -n ":" | base64 + +Once you have the base64 encoded username and password, use them in a command like this: + +git -c "http.extraHeader=Authorization: Basic " https://github.com/fossas/fossa-cli.git + +Full error message from git: + +run command: git +args: ["-c", "credential.helper=", "-c", "http.extraHeader=AUTHORIZATION: Basic ", "ls-remote", "--quiet", "https://github.com/fossas/fossa-cli.git"] +env: ["GIT_TERMINAL_PROMPT=0", "GCM_INTERACTIVE=never", "GIT_ASKPASS="] +status: 128 +stdout: '' +stderr: 'fatal: could not read Username for 'https://github.com': terminal prompts disabled' + + +Errors found while checking connection to FOSSA + +❌ Error checking connection to FOSSA: GET to fossa endpoint https://staging.int.fossa.io/api/cli/organization with authentication required + +We received an "Unauthorized" status response from FOSSA. This can mean that the fossa_integration_key configured in your config.yml file is not correct. You can obtain a FOSSA API key by going to Settings => Integrations => API in the FOSSA application. + +The URL we attempted to connect to was https://staging.int.fossa.io/api/cli/organization. Please make sure you can make a request to that URL. For example, try this curl command: + +curl -H "Authorization: Bearer " https://staging.int.fossa.io/api/cli/organization + +Full error message: HTTP status client error (401 Unauthorized) for url (https://staging.int.fossa.io/api/cli/organization) +```