Skip to content

Commit

Permalink
Prepare v0.1.1 (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
spatten authored Apr 6, 2023
1 parent a1eb9d6 commit 55c304b
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 3 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 2 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
77 changes: 77 additions & 0 deletions docs/subcommands/fix.md
Original file line number Diff line number Diff line change
@@ -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 "<username>:<password>" | base64
Once you have the base64 encoded username and password, use them in a command like this:
git -c "http.extraHeader=Authorization: Basic <base64 encoded username and password>" https://github.com/fossas/fossa-cli.git
Full error message from git:
run command: git
args: ["-c", "credential.helper=", "-c", "http.extraHeader=AUTHORIZATION: Basic <REDACTED>", "ls-remote", "--quiet", "https://github.com/fossas/fossa-cli.git"]
env: ["GIT_TERMINAL_PROMPT=0", "GCM_INTERACTIVE=never", "GIT_ASKPASS=<REMOVED>"]
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 <your fossa api key>" 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)
```

0 comments on commit 55c304b

Please sign in to comment.