Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
rene00 committed Mar 16, 2021
1 parent 52fa053 commit 9db1711
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,3 @@ tags
.vscode
.DS_Store

# integration test helper
auth0-cli-config-generator
9 changes: 9 additions & 0 deletions commander.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,14 @@ tests:
auth0 apis list:
exit-code: 0

auth0 apps list:
exit-code: 0

auth0 logs:
exit-code: 0

auth0 actions list:
exit-code: 0

auth0 completion bash:
exit-code: 0
23 changes: 23 additions & 0 deletions docs/ci.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Continuous Integration

## Integration Tests

Integration tests can be run with:
```bash
make integration
```

`make integration` will build and run the `auth0-cli-config-generator` command which is responsible for ensuring that a valid auth0-cli config file exists before the integration tests run. If a valid auth0-cli config file doesn't exist, `auth0-cli-config-generator` will attempt to generate one based off command line flags or/and environment variables.

`make integration` will then use [commander](https://github.com/commander-cli/commander) to run tests defined in [commander.yaml](./commander.yaml)

To run intergration tests as part of a CI pipeline, several environment variables need to be exported first. When these variables are set, `auth0-cli-config-generator` will generate a valid auth0-cli config file being retrieving a token for the client, removing the need to run `auth0 login`:
```bash
export AUTH0_CLI_CLIENT_NAME="integration" \
AUTH0_CLI_CLIENT_DOMAIN="example-test-domain.au.auth0.com" \
AUTH0_CLI_CLIENT_ID="example-client-id" \
AUTH0_CLI_CLIENT_SECRET="example-client-secret" \
AUTH0_CLI_REUSE_CONFIG="false" \
AUTH0_CLI_OVERWRITE="true"
make integration
```
1 change: 1 addition & 0 deletions pkg/auth0-cli-config-generator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ func persistConfig(filePath string, c config, overwrite bool) error {
func main() {
var cmd = &cobra.Command{
Use: "auth0-cli-config-generator",
Short: "A tool that generates valid auth0-cli config files",
SilenceErrors: true,
SilenceUsage: true,
RunE: func(command *cobra.Command, args []string) error {
Expand Down

0 comments on commit 9db1711

Please sign in to comment.