diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml deleted file mode 100644 index b0b8c02ad6..0000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ /dev/null @@ -1,72 +0,0 @@ ---- -name: 🐛 Bug Report -description: Report a reproducible bug in the current release of NetBox -labels: ["type: bug"] -body: - - type: markdown - attributes: - value: > - **NOTE:** This form is only for reporting _reproducible bugs_ in a current NetBox - installation. If you're having trouble with installation or just looking for - assistance with using NetBox, please visit our - [discussion forum](https://github.com/netbox-community/netbox/discussions) instead. - - type: dropdown - attributes: - label: Deployment Type - description: > - How are you running NetBox? (For issues with the Docker image, please go to the - [netbox-docker](https://github.com/netbox-community/netbox-docker) repo.) - options: - - Self-hosted - - NetBox Cloud - validations: - required: true - - type: input - attributes: - label: NetBox Version - description: What version of NetBox are you currently running? - placeholder: v3.7.3 - validations: - required: true - - type: dropdown - attributes: - label: Python Version - description: What version of Python are you currently running? - options: - - "3.8" - - "3.9" - - "3.10" - - "3.11" - validations: - required: true - - type: textarea - attributes: - label: Steps to Reproduce - description: > - Describe in detail the exact steps that someone else can take to - reproduce this bug using the current stable release of NetBox. Begin with the - creation of any necessary database objects and call out every operation being - performed explicitly. If reporting a bug in the REST API, be sure to reconstruct - the raw HTTP request(s) being made: Don't rely on a client library such as - pynetbox. Additionally, **do not rely on the demo instance** for reproducing - suspected bugs, as its data is prone to modification or deletion at any time. - placeholder: | - 1. Click on "create widget" - 2. Set foo to 12 and bar to G - 3. Click the "create" button - validations: - required: true - - type: textarea - attributes: - label: Expected Behavior - description: What did you expect to happen? - placeholder: A new widget should have been created with the specified attributes - validations: - required: true - - type: textarea - attributes: - label: Observed Behavior - description: What happened instead? - placeholder: A TypeError exception was raised - validations: - required: true diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000000..466be6c0cd --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,57 @@ +name: Bug Report +description: File a bug report +labels: ["Type: Bug", "Status: Triage"] +body: + - type: markdown + attributes: + value: > + Thanks for taking the time to fill out this bug report! Before submitting your issue, please make + sure you are using the latest version of the charm. If not, please switch to this image prior to + posting your report to make sure it's not already solved. + - type: textarea + id: bug-description + attributes: + label: Bug Description + description: > + If applicable, add screenshots to help explain the problem you are facing. + validations: + required: true + - type: textarea + id: reproduction + attributes: + label: To Reproduce + description: > + Please provide a step-by-step instruction of how to reproduce the behavior. + placeholder: | + 1. `juju deploy ...` + 2. `juju relate ...` + 3. `juju status --relations` + validations: + required: true + - type: textarea + id: environment + attributes: + label: Environment + description: > + We need to know a bit more about the context in which you run the charm. + - Are you running Juju locally, on lxd, in multipass or on some other platform? + - What track and channel you deployed the charm from (i.e. `latest/edge` or similar). + - Version of any applicable components, like the juju snap, the model controller, lxd, microk8s, and/or multipass. + validations: + required: true + - type: textarea + id: logs + attributes: + label: Relevant log output + description: > + Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. + Fetch the logs using `juju debug-log --replay` and `kubectl logs ...`. Additional details available in the juju docs + at https://juju.is/docs/olm/juju-logs + render: shell + validations: + required: true + - type: textarea + id: additional-context + attributes: + label: Additional context + diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index 2ad52023e7..0000000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1,18 +0,0 @@ -# Reference: https://help.github.com/en/github/building-a-strong-community/configuring-issue-templates-for-your-repository#configuring-the-template-chooser -blank_issues_enabled: false -contact_links: - - name: 📖 Contributing Policy - url: https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md - about: "Please read through our contributing policy before opening an issue or pull request." - - name: ❓ Discussion - url: https://github.com/netbox-community/netbox/discussions - about: "If you're just looking for help, try starting a discussion instead." - - name: 🌎 Correct a Translation - url: https://explore.transifex.com/netbox-community/netbox/ - about: "Spot an incorrect translation? You can propose a fix on Transifex." - - name: 💡 Plugin Idea - url: https://plugin-ideas.netbox.dev - about: "Have an idea for a plugin? Head over to the ideas board!" - - name: 💬 Community Slack - url: https://netdev.chat - about: "Join #netbox on the NetDev Community Slack for assistance with installation issues and other problems." diff --git a/.github/ISSUE_TEMPLATE/deprecation.yaml b/.github/ISSUE_TEMPLATE/deprecation.yaml deleted file mode 100644 index 27e13e5c0e..0000000000 --- a/.github/ISSUE_TEMPLATE/deprecation.yaml +++ /dev/null @@ -1,24 +0,0 @@ ---- -name: 🗑️ Deprecation -description: The removal of an existing feature or resource -labels: ["type: deprecation"] -body: - - type: textarea - attributes: - label: Proposed Changes - description: > - Describe in detail the proposed changes. What is being removed? - validations: - required: true - - type: textarea - attributes: - label: Justification - description: Please provide justification for the proposed change(s). - validations: - required: true - - type: textarea - attributes: - label: Impact - description: List all areas of the application that will be affected by this change. - validations: - required: true diff --git a/.github/ISSUE_TEMPLATE/documentation_change.yaml b/.github/ISSUE_TEMPLATE/documentation_change.yaml deleted file mode 100644 index cb097d579d..0000000000 --- a/.github/ISSUE_TEMPLATE/documentation_change.yaml +++ /dev/null @@ -1,39 +0,0 @@ ---- -name: 📖 Documentation Change -description: Suggest an addition or modification to the NetBox documentation -labels: ["type: documentation"] -body: - - type: dropdown - attributes: - label: Change Type - description: What type of change are you proposing? - options: - - Addition - - Correction - - Removal - - Cleanup (formatting, typos, etc.) - validations: - required: true - - type: dropdown - attributes: - label: Area - description: To what section of the documentation does this change primarily pertain? - options: - - Features - - Installation/upgrade - - Getting started - - Configuration - - Customization - - Integrations/API - - Plugins - - Administration - - Development - - Other - validations: - required: true - - type: textarea - attributes: - label: Proposed Changes - description: Describe the proposed changes and why they are necessary. - validations: - required: true diff --git a/.github/ISSUE_TEMPLATE/enhancement_proposal.yml b/.github/ISSUE_TEMPLATE/enhancement_proposal.yml new file mode 100644 index 0000000000..b2348b9fbf --- /dev/null +++ b/.github/ISSUE_TEMPLATE/enhancement_proposal.yml @@ -0,0 +1,17 @@ +name: Enhancement Proposal +description: File an enhancement proposal +labels: ["Type: Enhancement", "Status: Triage"] +body: + - type: markdown + attributes: + value: > + Thanks for taking the time to fill out this enhancement proposal! Before submitting your issue, please make + sure there isn't already a prior issue concerning this. If there is, please join that discussion instead. + - type: textarea + id: enhancement-proposal + attributes: + label: Enhancement Proposal + description: > + Describe the enhancement you would like to see in as much detail as needed. + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml deleted file mode 100644 index bc99999c0c..0000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.yaml +++ /dev/null @@ -1,59 +0,0 @@ ---- -name: ✨ Feature Request -description: Propose a new NetBox feature or enhancement -labels: ["type: feature"] -body: - - type: markdown - attributes: - value: > - **NOTE:** This form is only for submitting well-formed proposals to extend or modify - NetBox in some way. If you're trying to solve a problem but can't figure out how, or if - you still need time to work on the details of a proposed new feature, please start a - [discussion](https://github.com/netbox-community/netbox/discussions) instead. - - type: input - attributes: - label: NetBox version - description: What version of NetBox are you currently running? - placeholder: v3.7.3 - validations: - required: true - - type: dropdown - attributes: - label: Feature type - options: - - Data model extension - - New functionality - - Change to existing functionality - validations: - required: true - - type: textarea - attributes: - label: Proposed functionality - description: > - Describe in detail the new feature or behavior you are proposing. Include any specific changes - to work flows, data models, and/or the user interface. The more detail you provide here, the - greater chance your proposal has of being discussed. Feature requests which don't include an - actionable implementation plan will be rejected. - validations: - required: true - - type: textarea - attributes: - label: Use case - description: > - Explain how adding this functionality would benefit NetBox users. What need does it address? - validations: - required: true - - type: textarea - attributes: - label: Database changes - description: > - Note any changes to the database schema necessary to support the new feature. For example, - does the proposal require adding a new model or field? (Not all new features require database - changes.) - - type: textarea - attributes: - label: External dependencies - description: > - List any new dependencies on external libraries or services that this new feature would - introduce. For example, does the proposal require the installation of a new Python package? - (Not all new features introduce new dependencies.) diff --git a/.github/ISSUE_TEMPLATE/housekeeping.yaml b/.github/ISSUE_TEMPLATE/housekeeping.yaml deleted file mode 100644 index 7778713953..0000000000 --- a/.github/ISSUE_TEMPLATE/housekeeping.yaml +++ /dev/null @@ -1,24 +0,0 @@ ---- -name: 🏡 Housekeeping -description: A change pertaining to the codebase itself (developers only) -labels: ["type: housekeeping"] -body: - - type: markdown - attributes: - value: > - **NOTE:** This template is for use by maintainers only. Please do not submit - an issue using this template unless you have been specifically asked to do so. - - type: textarea - attributes: - label: Proposed Changes - description: > - Describe in detail the new feature or behavior you'd like to propose. - Include any specific changes to work flows, data models, or the user interface. - validations: - required: true - - type: textarea - attributes: - label: Justification - description: Please provide justification for the proposed change(s). - validations: - required: true diff --git a/.github/ISSUE_TEMPLATE/translation.yaml b/.github/ISSUE_TEMPLATE/translation.yaml deleted file mode 100644 index d07bc399d4..0000000000 --- a/.github/ISSUE_TEMPLATE/translation.yaml +++ /dev/null @@ -1,37 +0,0 @@ ---- -name: 🌍 Translation -description: Request support for a new language in the user interface -labels: ["type: translation"] -body: - - type: markdown - attributes: - value: > - **NOTE:** This template is used only for proposing the addition of *new* languages. Please do - not use it to request changes to existing translations. - - type: input - attributes: - label: Language - description: What is the name of the language in English? - validations: - required: true - - type: input - attributes: - label: ISO 639-1 code - description: > - What is the two-letter [ISO 639-1 code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) - assigned to the language? - validations: - required: true - - type: dropdown - attributes: - label: Volunteer - description: Are you a fluent speaker of this language **and** willing to contribute a translation map? - options: - - "Yes" - - "No" - validations: - required: true - - type: textarea - attributes: - label: Comments - description: Any other notes you would like to share diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 0bbbe90c70..618cc2f906 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,17 +1,37 @@ - IF YOUR PULL REQUEST DOES NOT REFERENCE AN ISSUE WHICH HAS BEEN ASSIGNED - TO YOU, IT WILL BE CLOSED AUTOMATICALLY. + - Please specify your assigned issue number on the line below. ---> -### Fixes: #1234 +### Overview - + + +### Rationale + + + +### Juju Events Changes + + + +### Module Changes + + + +### Library Changes + + + +### Checklist + +- [ ] The [charm style guide](https://juju.is/docs/sdk/styleguide) was applied +- [ ] The [contributing guide](https://github.com/canonical/is-charms-contributing-guide) was applied +- [ ] The changes are compliant with [ISD054 - Manging Charm Complexity](https://discourse.charmhub.io/t/specification-isd014-managing-charm-complexity/11619) +- [ ] The documentation is generated using `src-docs` +- [ ] The documentation for charmhub is updated. +- [ ] The PR is tagged with appropriate label (`urgent`, `trivial`, `complex`) + + diff --git a/.github/workflows/bot_pr_approval.yaml b/.github/workflows/bot_pr_approval.yaml new file mode 100644 index 0000000000..e38c5841dd --- /dev/null +++ b/.github/workflows/bot_pr_approval.yaml @@ -0,0 +1,9 @@ +name: Provide approval for bot PRs + +on: + pull_request: + +jobs: + bot_pr_approval: + uses: canonical/operator-workflows/.github/workflows/bot_pr_approval.yaml@main + secrets: inherit diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ed8c65b7d2..05d4fa63e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,5 @@ -name: CI -on: [push, pull_request] +name: CI. Original NetBox Tests +on: [workflow_dispatch] permissions: contents: read jobs: diff --git a/.github/workflows/comment.yaml b/.github/workflows/comment.yaml new file mode 100644 index 0000000000..26ac226df8 --- /dev/null +++ b/.github/workflows/comment.yaml @@ -0,0 +1,12 @@ +name: Comment on the pull request + +on: + workflow_run: + workflows: ["Tests"] + types: + - completed + +jobs: + comment-on-pr: + uses: canonical/operator-workflows/.github/workflows/comment.yaml@main + secrets: inherit diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml new file mode 100644 index 0000000000..47b924e9ee --- /dev/null +++ b/.github/workflows/integration_tests.yml @@ -0,0 +1,17 @@ +name: Integration tests + +on: + pull_request: + +jobs: + integration-tests: + uses: canonical/operator-workflows/.github/workflows/integration_test.yaml@main + secrets: inherit + with: + trivy-image-config: "trivy.yaml" + juju-channel: 3.1/stable + channel: 1.28-strict/stable + rockcraft-repository: weiiwang01/rockcraft + rockcraft-ref: feat-12f-django + charmcraft-repository: weiiwang01/charmcraft + charmcraft-ref: feat-12f-django diff --git a/.github/workflows/issues.yaml b/.github/workflows/issues.yaml new file mode 100644 index 0000000000..138fe821bc --- /dev/null +++ b/.github/workflows/issues.yaml @@ -0,0 +1,11 @@ +name: Sync issues to Jira + +on: + issues: + # available via github.event.action + types: [opened, reopened, closed] + +jobs: + issues-to-jira: + uses: canonical/operator-workflows/.github/workflows/jira.yaml@main + secrets: inherit diff --git a/.github/workflows/lock.yml b/.github/workflows/lock.yml deleted file mode 100644 index ad3bf5d758..0000000000 --- a/.github/workflows/lock.yml +++ /dev/null @@ -1,23 +0,0 @@ -# lock-threads (https://github.com/marketplace/actions/lock-threads) -name: 'Lock threads' - -on: - schedule: - - cron: '0 3 * * *' - workflow_dispatch: - -permissions: - issues: write - pull-requests: write - discussions: write - -jobs: - lock: - runs-on: ubuntu-latest - steps: - - uses: dessant/lock-threads@v5 - with: - issue-inactive-days: 90 - pr-inactive-days: 30 - discussion-inactive-days: 180 - issue-lock-reason: 'resolved' diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml deleted file mode 100644 index 22de146a2b..0000000000 --- a/.github/workflows/stale.yml +++ /dev/null @@ -1,45 +0,0 @@ -# close-stale-issues (https://github.com/marketplace/actions/close-stale-issues) -name: 'Close stale issues/PRs' - -on: - schedule: - - cron: '0 4 * * *' - workflow_dispatch: - -permissions: - issues: write - pull-requests: write - -jobs: - stale: - - runs-on: ubuntu-latest - steps: - - uses: actions/stale@v8 - with: - close-issue-message: > - This issue has been automatically closed due to lack of activity. In an - effort to reduce noise, please do not comment any further. Note that the - core maintainers may elect to reopen this issue at a later date if deemed - necessary. - close-pr-message: > - This PR has been automatically closed due to lack of activity. - days-before-stale: 90 - days-before-close: 30 - exempt-issue-labels: 'status: accepted,status: blocked,status: needs milestone' - operations-per-run: 100 - remove-stale-when-updated: false - stale-issue-label: 'pending closure' - stale-issue-message: > - This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. NetBox - is governed by a small group of core maintainers which means not all opened - issues may receive direct feedback. **Do not** attempt to circumvent this - process by "bumping" the issue; doing so will result in its immediate closure - and you may be barred from participating in any future discussions. Please see - our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md). - stale-pr-label: 'pending closure' - stale-pr-message: > - This PR has been automatically marked as stale because it has not had - recent activity. It will be closed automatically if no further action is - taken. diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000000..2ab371f6e7 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,12 @@ +name: Tests + +on: + pull_request: + +jobs: + unit-tests: + uses: canonical/operator-workflows/.github/workflows/test.yaml@main + secrets: inherit + with: + shellcheck-working-directory: "./charm" + docs-working-directory: "./charm" diff --git a/.licenserc.yaml b/.licenserc.yaml new file mode 100644 index 0000000000..e8c9a137b4 --- /dev/null +++ b/.licenserc.yaml @@ -0,0 +1,21 @@ +header: + license: + spdx-id: Apache-2.0 + copyright-owner: Canonical Ltd. + content: | + Copyright [year] [owner] + See LICENSE file for licensing details. + paths: + - 'charm/**' + paths-ignore: + - '**/*.cfg' + - '**/*.conf' + - '**/*.j2' + - '**/*.json' + - '**/*.md' + - '**/*.rule' + - '**/*.tmpl' + - '**/*.txt' + - 'charm/.gitignore' + - 'charm/lib/**' + comment: on-failure diff --git a/.woke.yaml b/.woke.yaml new file mode 100644 index 0000000000..8e5dfd5f9f --- /dev/null +++ b/.woke.yaml @@ -0,0 +1,11 @@ +ignore_files: + - netbox + - docs +rules: + # Ignore "master" - While https://github.com/canonical/redis-k8s-operator/pull/78 + # is not merged + - name: master + # Ignore "grandfathered" used by SAML configuration. + - name: grandfathered + # Ignore "whitelist" used by NetBox. + - name: whitelist diff --git a/.wokeignore b/.wokeignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000000..e3e8c01b2b --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1 @@ +* @canonical/is-charms \ No newline at end of file diff --git a/charm/.gitignore b/charm/.gitignore new file mode 100644 index 0000000000..a26d707f9b --- /dev/null +++ b/charm/.gitignore @@ -0,0 +1,9 @@ +venv/ +build/ +*.charm +.tox/ +.coverage +__pycache__/ +*.py[cod] +.idea +.vscode/ diff --git a/charm/CONTRIBUTING.md b/charm/CONTRIBUTING.md new file mode 100644 index 0000000000..288f0216cc --- /dev/null +++ b/charm/CONTRIBUTING.md @@ -0,0 +1,33 @@ +# Contributing + +To make contributions to this charm, you'll need a working [development setup](https://juju.is/docs/sdk/dev-setup). + +You can create an environment for development with `tox`: + +```shell +tox devenv -e integration +source venv/bin/activate +``` + +## Testing + +This project uses `tox` for managing test environments. There are some pre-configured environments +that can be used for linting and formatting code when you're preparing contributions to the charm: + +```shell +tox run -e format # update your code according to linting rules +tox run -e lint # code style +tox run -e unit # unit tests +tox run -e integration # integration tests +tox # runs 'format', 'lint', and 'unit' environments +``` + +## Build the charm + +Build the charm in this git repository using: + +```shell +charmcraft pack +``` + +