Skip to content

Commit

Permalink
feat: migrate opencti from helm-charts
Browse files Browse the repository at this point in the history
  • Loading branch information
ialejandro committed Jun 2, 2024
1 parent d2852fa commit aed7222
Show file tree
Hide file tree
Showing 55 changed files with 2,872 additions and 0 deletions.
88 changes: 88 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Bug report
description: Create a bug report
title: "[opencti] Bug title"
labels: [bug]
body:
- type: markdown
attributes:
value: Please be cautious with the sensitive information/logs while filing the issue.

- type: textarea
id: description
attributes:
label: Describe the bug a clear and concise description of what the bug is.
validations:
required: true

- type: input
id: helm-version
attributes:
label: What's your helm version?
description: Output of `#~ helm version`
validations:
required: true

- type: input
id: kubectl-version
attributes:
label: What's your kubectl version?
description: Output of `#~ kubectl version`
validations:
required: true

- type: input
id: chart-version
attributes:
label: Chart version
description: Enter the version of the chart that you encountered this bug.
validations:
required: true

- type: textarea
id: explain-bug
attributes:
label: Explain bug
description: Explain what happened.
validations:
required: false

- type: textarea
id: expected-result
attributes:
label: What you expected to happen?
description: Enter what you expected to happen.
validations:
required: false

- type: textarea
id: reproduce-bug
attributes:
label: How to reproduce it?
description: Explain step-by-step if is possible.
validations:
required: false

- type: textarea
id: chart-values
attributes:
label: Enter the changed values of values.yaml?
description: Please enter only values which differ from the defaults. Enter `NONE` if nothing's changed.
placeholder: 'key: value'
validations:
required: false

- type: textarea
id: helm-command
attributes:
label: Enter the command that you execute when chart failing/misfunctioning
description: Enter the command as-is as how you executed.
placeholder: helm install [RELEASE] opencti/opencti --version [VERSION] -f values.yaml --debug
validations:
required: true

- type: textarea
id: more-info
attributes:
label: More info
validations:
required: false
40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Feature request
description: Suggest an idea to improve this project
title: "[opencti] Feature title"
labels: [enhancement]
body:
- type: markdown
attributes:
value: Thanks for taking the time to fill out this bug report!

- type: textarea
id: description
attributes:
label: Is your feature request related to a problem?
description: Description of what the problem is.
validations:
required: true

- type: textarea
id: proposals
attributes:
label: Describe the solution you'd like
description: Description of what you want to happen.
validations:
required: true

- type: textarea
id: improves
attributes:
label: Describe alternatives you've considered
description: Description of any alternative solutions or features you've considered. If nothing, please enter `NONE`
validations:
required: true

- type: textarea
id: more-info
attributes:
label: Additional context
description: Add any other context or screenshots about the feature request here.
validations:
required: false
32 changes: 32 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!--
Before you submit this PR we'd like to make sure you are aware of our technical requirements and best practices:
* https://github.com/devops-ia/helm-charts/blob/main/CONTRIBUTING.md#technical-requirements
* https://helm.sh/docs/chart_best_practices/
Following our best practices right from the start will accelerate the review process and help get your PR merged quicker.
When updates to your PR are requested, please add new commits and do not squash the history.
This will make it easier to identify new changes. The PR will be squashed anyways when it is merged.
For fast feedback, please @-mention maintainers that are listed in the Chart.yaml file.
PR Steps:
1) Please make sure you test your changes before you push them.
2) Once pushed, GitHub Actions will run across your changes and do some initial checks and linting.
3) These checks run very quickly.
4) Please check the results.
5) We would like these checks to pass before we even continue reviewing your changes.
-->
#### What this PR does / why we need it:

#### Which issue this PR fixes
*(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*
- fixes #

#### Special notes for your reviewer:

#### Checklist
<!-- [Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.] -->
- [ ] [DCO](https://github.com/devops-ia/helm-opencti/blob/main/CONTRIBUTING.md#sign-off-your-work) signed
- [ ] Chart version bumped
45 changes: 45 additions & 0 deletions .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Lint and Test Charts

on: pull_request

jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: v3.13.0

- uses: actions/setup-python@v4
with:
python-version: 3.x
check-latest: true

- name: Set up chart-testing
uses: helm/chart-testing-action@v2

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --config ct.yaml)
if [[ -n "${changed}" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Run chart-testing (lint)
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --config ct.yaml

- name: Create kind cluster
if: steps.list-changed.outputs.changed == 'true'
uses: helm/kind-action@v1

- name: Run chart-testing (install)
if: steps.list-changed.outputs.changed == 'true'
run: ct install --config ct.yaml
67 changes: 67 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Release charts

on:
push:
branches:
- main

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Get chart verison
id: chart_version
run: |
echo "CHART_VERSION=$(cat opencti/Chart.yaml | awk -F"[ ',]+" '/version:/{print $2}' | head -1)" >> $GITHUB_OUTPUT
- name: Check if tag exists
id: tag_exists
run: |
TAG_EXISTS=true
if ! [ $(git tag -l "v${{ steps.chart_version.outputs.CHART_VERSION }}") ]; then
TAG_EXISTS=false
fi
echo TAG_EXISTS=$TAG_EXISTS >> $GITHUB_OUTPUT
- name: Tag release
id: tag_version
uses: mathieudutour/[email protected]
with:
custom_tag: ${{ steps.chart_version.outputs.CHART_VERSION }}
github_token: ${{ secrets.GITHUB_TOKEN }}
tag_prefix: v
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'

- name: Add repositories
run: |
helm dependency list opencti 2> /dev/null | tail +2 | head -n -1 | awk '{ print "helm repo add " $1 " " $3 }' | while read cmd; do $cmd; done
- name: Create release
uses: ncipollo/release-action@v1
with:
body: ${{ steps.tag_version.outputs.changelog }}
name: ${{ steps.tag_version.outputs.new_tag }}
prerelease: ${{ contains(steps.chart_version.outputs.CHART_VERSION, '-') }}
tag: ${{ steps.tag_version.outputs.new_tag }}
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'

- name: Publish Helm chart
uses: stefanprodan/helm-gh-pages@master
with:
branch: gh-pages
charts_dir: .
charts_url: https://devops-ia.github.io/helm-opencti
linting: true
target_dir: .
token: ${{ secrets.GITHUB_TOKEN }}
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.tgz
Chart.lock
41 changes: 41 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# How to contribute to OpenCTI Helm Chart

This document provides guidelines for contributing to the *OpenCTI Helm Chart* project.

## How can I contribute?

### Did you find a bug?

* **Ensure the bug has not already been reported** by searching on GitHub under [Issues](https://github.com/devops-ia/helm-opencti/issues).
* If you cannot find an open issue addressing the problem, [open a new one](https://github.com/devops-ia/helm-opencti/issues/new). Include a **title and clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the unexpected behavior.
* Use the relevant bug report templates to create the issue, if available.

### Do you intend to add a new feature or change an existing one?

* Please discuss first ([open an issue](https://github.com/devops-ia/helm-opencti/issues)) before starting any significant pull request (e.g., implementing features, refactoring code) to avoid spending time on something that might not be merged.
* Adhere to the project's coding conventions (indentation, accurate comments, etc.) and any other requirements (such as test coverage, documentation).

## Styleguides

### YAML Styleguide

All YAML files must adhere to the following style guide:

* Indentation: Use 2 spaces for indentation.
* No trailing spaces.
* Use hyphens for list items.
* Use camelCase for key names.
* Ensure there are no syntax errors.

Additional rules:

* Always use double quotes for strings.
* Keep lines to a maximum of 80 characters.
* Ensure proper alignment of nested elements.

### Git Commit Messages

* Use the present tense ("Add feature" not "Added feature").
* Use the imperative mood ("Move cursor to..." not "Moves cursor to...").
* Limit the first line to 72 characters or less.
* Reference issues and pull requests liberally after the first line.
1 change: 1 addition & 0 deletions GUIDELINES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TBD
Loading

0 comments on commit aed7222

Please sign in to comment.