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

Create the initial version of the OpenCTI charm #2

Merged
merged 35 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
07170cf
add opencti rock
weiiwang01 Dec 2, 2024
11dbfc8
Add basic charm
weiiwang01 Dec 9, 2024
4f210cf
Fix linting issues
weiiwang01 Dec 9, 2024
1dbcebf
Update config description
weiiwang01 Dec 9, 2024
a948dcb
Fix linting issues
weiiwang01 Dec 9, 2024
e990cd3
Fix linting issues
weiiwang01 Dec 9, 2024
3632067
Fix linting issues
weiiwang01 Dec 9, 2024
22077d2
Fix linting issues
weiiwang01 Dec 9, 2024
676b9a0
Fix tests
weiiwang01 Dec 10, 2024
dc9ce01
Add license headers
weiiwang01 Dec 10, 2024
d1c0c05
Update runner
weiiwang01 Dec 10, 2024
38db050
Improved start-up callback
weiiwang01 Dec 10, 2024
8a1264b
Use github hosted runners
weiiwang01 Dec 10, 2024
0caebdc
Update rockcraft.yaml
weiiwang01 Dec 10, 2024
020665a
Debug
weiiwang01 Dec 10, 2024
336b84c
Remove unnecessary files
weiiwang01 Dec 10, 2024
702add8
Remove unnecessary files
weiiwang01 Dec 10, 2024
1f2b5c5
Fix charm.py
weiiwang01 Dec 11, 2024
403aa75
Remove debug info
weiiwang01 Dec 11, 2024
4dbc03a
Stop callback in callback itself
weiiwang01 Dec 11, 2024
e494868
clean up requirements.txt
weiiwang01 Dec 11, 2024
875e116
Update documents
weiiwang01 Dec 11, 2024
9387460
Update unit tests
weiiwang01 Dec 11, 2024
61e7daa
Apply suggestions from review comments
weiiwang01 Dec 12, 2024
ab0eb50
Apply suggestions from review comments
weiiwang01 Dec 18, 2024
88ae9c1
Merge platform/graphql and platform/graphql-deps in rockcraft.yaml
weiiwang01 Dec 18, 2024
a781a43
Add missing stage-snaps and stage-packages
weiiwang01 Dec 18, 2024
758231a
Apply suggestions from review comments
weiiwang01 Dec 20, 2024
06bce03
Cleanup secrets
weiiwang01 Dec 20, 2024
f99ae13
Fix linting issues
weiiwang01 Dec 20, 2024
f5e2459
Update .trivyignore
weiiwang01 Dec 20, 2024
5a6e508
Update linting
weiiwang01 Jan 7, 2025
3de4d69
Update .trivyignore
weiiwang01 Jan 7, 2025
5eb4d6c
Revert "Update .trivyignore"
weiiwang01 Jan 7, 2025
b4ab9cd
Update copyright years
weiiwang01 Jan 7, 2025
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
22 changes: 0 additions & 22 deletions .github/workflows/integration_test.yaml

This file was deleted.

13 changes: 11 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,14 @@ jobs:
uses: canonical/operator-workflows/.github/workflows/test.yaml@main
secrets: inherit
with:
self-hosted-runner: true
self-hosted-runner-label: "edge"
self-hosted-runner: false
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For our team, I think we should generally use self-hosted runners on "edge".

On the other hand, I think "edge" does have more wait time than GitHub runner under Canonical org.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the wait time for self-hosted runners is too long. I am currently rapidly developing the charm and will switch to the self-hosted runner once the charm is more stable. Thanks!

integration-tests:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the test.yaml and integration_test.yaml combined?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It saves one workflow file and makes it easier to check CI failures since unit tests and integration tests are in the same job tab.

uses: canonical/operator-workflows/.github/workflows/integration_test.yaml@main
secrets: inherit
with:
channel: 1.29-strict/stable
charmcraft-channel: latest/edge
juju-channel: 3.6/stable
microk8s-addons: "dns ingress rbac storage"
pre-run-script: tests/integration/prepare.sh
self-hosted-runner: false
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the self-hosted runner comment above.

16 changes: 15 additions & 1 deletion .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,29 @@ header:
- '**'
paths-ignore:
- '.github/**'
- '**/.gitkeep'
- '**/*.cfg'
- '**/*.conf'
- '**/*.j2'
- '**/*.json'
- '**/*.md'
- '**/*.rule'
- '**/*.tmpl'
- '**/*.txt'
- '.codespellignore'
- '.dockerignore'
- '.flake8'
- '.jujuignore'
- '.gitignore'
- '.licenserc.yaml'
- '.trivyignore'
- '.woke.yaml'
- '.woke.yml'
- 'CODEOWNERS'
- 'icon.svg'
- 'LICENSE'
- 'trivy.yaml'
- 'pyproject.toml'
- 'trivy.yaml'
- 'zap_rules.tsv'
- 'lib/**'
comment: on-failure
6 changes: 6 additions & 0 deletions .trivyignore
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of linting of "not present anymore, can be safely removed.".
I think we should check to see if these are needed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think most of them are false alarms. Maybe we should upgrade the workflow. Thanks!

jdkandersson marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# cross-spawn (package.json)
CVE-2024-21538

Check notice on line 2 in .trivyignore

View workflow job for this annotation

GitHub Actions / integration-tests / Scan Image (ghcr.io-canonical-opencti-d91e8594be65b5b4eabccb19eec1fcb3159ff237-_6.4.1_amd64.tar)

CVE-2024-21538 not present anymore, can be safely removed.
# esbuild
CVE-2024-24790

Check notice on line 4 in .trivyignore

View workflow job for this annotation

GitHub Actions / integration-tests / Scan Image (ghcr.io-canonical-opencti-d91e8594be65b5b4eabccb19eec1fcb3159ff237-_6.4.1_amd64.tar)

CVE-2024-24790 not present anymore, can be safely removed.
CVE-2023-45288

Check notice on line 5 in .trivyignore

View workflow job for this annotation

GitHub Actions / integration-tests / Scan Image (ghcr.io-canonical-opencti-d91e8594be65b5b4eabccb19eec1fcb3159ff237-_6.4.1_amd64.tar)

CVE-2023-45288 not present anymore, can be safely removed.
CVE-2024-34156

Check notice on line 6 in .trivyignore

View workflow job for this annotation

GitHub Actions / integration-tests / Scan Image (ghcr.io-canonical-opencti-d91e8594be65b5b4eabccb19eec1fcb3159ff237-_6.4.1_amd64.tar)

CVE-2024-34156 not present anymore, can be safely removed.
2 changes: 2 additions & 0 deletions .woke.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ignore_files:
- lib/charms/redis_k8s/v0/redis.py
103 changes: 94 additions & 9 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,98 @@
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
# This file configures Charmcraft.
# See https://juju.is/docs/sdk/charmcraft-config for guidance.

name: opencti
title: OpenCTI Charm
summary: OpenCTI charm.
links:
documentation: https://discourse.charmhub.io
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be updated to a valid discourse topic.

On the content-cache-operator, not updating this line to a valid topic in the initial commit has caused the issues with upload-docs workflow in future PRs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are right, changed to point to the README for now until we have the documentation page

issues: https://github.com/canonical/opencti-operator/issues
source: https://github.com/canonical/opencti-operator
contact: https://launchpad.net/~canonical-is-devops

description: |
A [Juju](https://juju.is/) [charm](https://juju.is/docs/olm/charmed-operators)
for deploying and managing the [OpenCTI](https://filigran.io/solutions/open-cti/)
open-source threat intelligence platform in your systems.

This charm simplifies the configuration and maintenance of OpenCTI across a
range of environments, organize your cyber threat intelligence to enhance
and disseminate actionable insights.

config:
yhaliaw marked this conversation as resolved.
Show resolved Hide resolved
options:
admin-user:
type: string
jdkandersson marked this conversation as resolved.
Show resolved Hide resolved
description: |
OpenCTI admin user email and password.
The content of this configuration should be a Juju user secret ID.
The Juju user secret should contain two fields, `email` and `password`,
where `email` is the admin user email, and `password` is the admin user password.
Use the following commands to create a Juju user secret for this configuration:
`juju add-secret opencti-admin-user [email protected] password#file=/path/to/password.txt`
`juju grant-secret opencti-admin-user opencti`

requires:
opensearch-client:
interface: opensearch_client
optional: false
limit: 1
redis:
interface: redis
optional: false
limit: 1
amqp:
interface: rabbitmq
optional: false
limit: 1
s3:
interface: s3
optional: false
limit: 1
ingress:
interface: ingress
optional: false
limit: 1
logging:
interface: loki_push_api
optional: true

provides:
metrics-endpoint:
interface: prometheus_scrape
optional: true
grafana-dashboard:
interface: grafana_dashboard
optional: true

peers:
opencti-peer:
interface: opencti_peer

type: charm
bases:
- build-on:
- name: ubuntu
channel: "22.04"
run-on:
- name: ubuntu
channel: "22.04"
base: [email protected]
build-base: [email protected]
platforms:
amd64:
parts:
charm:
build-snaps:
- rustup
override-build: |
rustup default stable
craftctl default
build-packages:
- libffi-dev
- libssl-dev
- pkg-config

containers:
opencti:
resource: opencti-image
resources:
opencti-image:
type: oci-image
description: OCI image for the OpenCTI platform/worker.

assumes:
- juju >= 3.4
16 changes: 0 additions & 16 deletions config.yaml

This file was deleted.

Loading
Loading