Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Cortex CLI Developer guide

# Testing
The CLI uses [just](https://just.systems/man/en/) for automation operations.
Just is a make alternative that aims to remove make's complexities and just be
a command runner.

To test the full project:
```
just test-all
```

Run just to see a list of possible recipes.
```
$ just
Available recipes:
help
test testname # Run a single test, ie: just test tests/test_catalog.py
test-all # Run all tests
test-import # Run import test, a pre-requisite for any tests that rely on test data.
test-parallel # Run tests that can run in parallel
test-serial # Run tests that have to run sequentially
```

## Sequential and parallel tests
Most tests can run in a parallel but a handful have dependencies that can impact other tests,
for example changing the scope of CORTEX_API_KEY, so they have to run sequentially.

The `test-all` target runs all the tests that can be run in parallel, followed by those that
have to run sequentially.

# Commit messages
The CLI uses [git-changelog](https://pypi.org/project/git-changelog/) to dynamically generate
the [HISTORY.md](./HISTORY.md) file.

Prefix commits with the words listed in the [Basic convention](https://pawamoy.github.io/git-changelog/usage/#basic-convention)
section of the git-changelog documentation.

Commits that don't use one of these words will be ignored when generating the history.

This project will use the following:
- add
- fix
- change
- remove

# Build process
- Create a feature branch for all changes.
- Merge feature branch to staging branch.
- Multiple changes can be merged to staging and included in a push to main or the single change can be merged to main.
- The merge to main will trigger a new version to be created.
- Versions are automatically bumped using [github-tag-action](https://github.com/anothrNick/github-tag-action).
- Bumping is based on the merge commit message, defaulting to bumping the patch version.
- To bump the minor version, use "#minor" in the commit message.
- To bump the major version, use "#major" in the commit message.
- Merge to main triggers the [publish](https://github.com/cortexapps/cli/actions/workflows/publish.yml) GitHub Actions workflow.

# Updating Poetry dependencies
To update poetry dependencies run:
```
poetry update
poetry lock
```

Commit these files.

TODO: see how other python projects keep dependencies up to date. It probably makes sense to run this on an
automated basis every 30 days or so to ensure the project is up-to-date and contains available security and
vulnerability fixes.

# Security

# Updating the homebrew recipe
TODO
465 changes: 423 additions & 42 deletions HISTORY.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def add_multiple(

data = json.loads("".join([line for line in file_input]))

r = client.put("api/v1/aws/configurations", data=data)
r = client.put("api/v1/azure-devops/configurations", data=data)
print_json(data=r)

@app.command()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def add(
# remove any data elements that are None - can only be is_default
data = {k: v for k, v in data.items() if v is not None}

r = client.post("api/v1/azure-devops/configuration", data=data)
r = client.post("api/v1/azure-resources/configuration", data=data)
print_json(data=r)

@app.command()
Expand All @@ -81,7 +81,7 @@ def add_multiple(

data = json.loads("".join([line for line in file_input]))

r = client.put("api/v1/aws/configurations", data=data)
r = client.put("api/v1/azure-resources/configurations", data=data)
print_json(data=r)

@app.command()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def add_multiple(

data = json.loads("".join([line for line in file_input]))

r = client.put("api/v1/aws/configurations", data=data)
r = client.put("api/v1/circleci/configurations", data=data)
print_json(data=r)

@app.command()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def add_multiple(

data = json.loads("".join([line for line in file_input]))

r = client.put("api/v1/aws/configurations", data=data)
r = client.put("api/v1/coralogix/configurations", data=data)
print_json(data=r)

@app.command()
Expand Down
2 changes: 1 addition & 1 deletion cortexapps_cli/commands/integrations_commands/datadog.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def add_multiple(

data = json.loads("".join([line for line in file_input]))

r = client.put("api/v1/aws/configurations", data=data)
r = client.put("api/v1/datadog/configurations", data=data)
print_json(data=r)

@app.command()
Expand Down
2 changes: 1 addition & 1 deletion cortexapps_cli/commands/integrations_commands/gitlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def add_multiple(

data = json.loads("".join([line for line in file_input]))

r = client.put("api/v1/aws/configurations", data=data)
r = client.put("api/v1/gitlab/configurations", data=data)
print_json(data=r)

@app.command()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def add_multiple(

data = json.loads("".join([line for line in file_input]))

r = client.put("api/v1/aws/configurations", data=data)
r = client.put("api/v1/incidentio/configurations", data=data)
print_json(data=r)

@app.command()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def add_multiple(

data = json.loads("".join([line for line in file_input]))

r = client.put("api/v1/aws/configurations", data=data)
r = client.put("api/v1/launchdarkly/configurations", data=data)
print_json(data=r)

@app.command()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def add_multiple(

data = json.loads("".join([line for line in file_input]))

r = client.put("api/v1/aws/configurations", data=data)
r = client.put("api/v1/newrelic/configurations", data=data)
print_json(data=r)

@app.command()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def add_multiple(

data = json.loads("".join([line for line in file_input]))

r = client.put("api/v1/aws/configurations", data=data)
r = client.put("api/v1/pagerduty/configurations", data=data)
print_json(data=r)

@app.command()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def add_multiple(

data = json.loads("".join([line for line in file_input]))

r = client.put("api/v1/aws/configurations", data=data)
r = client.put("api/v1/sonarqube/configurations", data=data)
print_json(data=r)

@app.command()
Expand Down