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
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Maintained by the MongoDB APIx-Integrations team
* @mongodb-labs/APIx-Integrations
61 changes: 61 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Bug report
description: Something unexpected happen? Report an error, crash, or an incorrect behavior here.
title: "[Bug]: <your-title>"
body:
- type: markdown
attributes:
value: |
Thank you for opening an issue. **These GitHub issues** are only for community reporting and assistance; as such, we don't have a guaranteed SLA.

**If your issue relates to Terraform itself**, please open it in the [Terraform repository](https://github.com/hashicorp/terraform/issues).

**If you have an active MongoDB Atlas Support contract**, the best way for us to assist you with the Terraform MongoDB Atlas Provider is through a support ticket.

**Please note:** In order for us to provide the best experience in supporting our customers, we kindly ask to make sure that all the following sections are correctly filled with all the required information.
Our support will prioritise issues that contain all the required information that follows the [one-click reproducible issues principle](../../README.md#one-click-reproducible-issues-principle).

- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the bug you encountered. If the issue has been reported add a reaction, i.e. +1, to the issue.
options:
- label: I have searched the existing issues
required: true

- type: textarea
id: current_behaviour
attributes:
label: Current Behavior
description: A concise description of what you're experiencing.
validations:
required: true

- type: textarea
attributes:
label: Steps To Reproduce
description: Steps to reproduce the behaviour.
placeholder: |
1. In this environment...
2. With this config...
3. Run '...'
4. See error...
validations:
required: true

- type: textarea
id: logs
attributes:
label: Logs
description: Additional logs that can help us investigate the issue. This will be automatically formatted into code, so no need for backticks.
render: txt
validations:
required: false

- type: checkboxes
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/mongodb-labs/atlas-cli-plugin-terraform/blob/master/CODE_OF_CONDUCT.md)
options:
- label: I agree to follow this project's Code of Conduct
required: true
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
blank_issues_enabled: true
contact_links:
- name: Terraform MongoDB Atlas Provider Feature Request
url: https://feedback.mongodb.com/forums/924145-atlas?category_id=370723
about: Request a feature or up-vote an existing suggestion!
- name: MongoDB Atlas Support
url: https://support.mongodb.com/
about: Support is provided under MongoDB Atlas support plans. Please submit support questions within the Atlas UI.
- name: MongoDB Atlas
url: https://www.mongodb.com/cloud/atlas
about: Learn more about MongoDB Atlas
18 changes: 18 additions & 0 deletions .github/actionlint-matcher.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"problemMatcher": [
{
"owner": "actionlint",
"severity": "warning",
"pattern": [
{
"regexp": "^(?:\\x1b\\[\\d+m)?(.+?)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*: (?:\\x1b\\[\\d+m)*(.+?)(?:\\x1b\\[\\d+m)* \\[(.+?)\\]$",
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this for?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

like in TF, it's for the actionlinter in code-health to show the errors inline in the files in GH UI, more info: https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md

"file": 1,
"line": 2,
"column": 3,
"message": 4,
"code": 5
}
]
}
]
}
20 changes: 20 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 2
updates:
- package-ecosystem: gomod
directory: "/"
schedule:
interval: weekly
day: tuesday
commit-message:
prefix: "chore"
reviewers:
- "mongodb-labs/apix-integrations"
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
day: tuesday
commit-message:
prefix: "chore"
reviewers:
- "mongodb-labs/apix-integrations"
10 changes: 10 additions & 0 deletions .github/pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 1
labels:
- label: "breaking-change"
title: "!"
- label: "enhancement"
title: "feat:*"
- label: "enhancement"
title: "feature:*"
- label: "bug"
title: "fix:*"
26 changes: 26 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## Description

Please include a summary of the fix/feature/change, including any relevant motivation and context.

Link to any related issue(s):

## Type of change:

- [ ] Bug fix (non-breaking change which fixes an issue). Please, add the "bug" label to the PR.
- [ ] New feature (non-breaking change which adds functionality). Please, add the "enhancement" label to the PR. A migration guide must be created or updated if the new feature will go in a major version.
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected). Please, add the "breaking change" label to the PR. A migration guide must be created or updated.
- [ ] This change requires a documentation update
- [ ] Documentation fix/enhancement

## Required Checklist:

- [ ] I have signed the [MongoDB CLA](https://www.mongodb.com/legal/contributor-agreement)
- [ ] I have read the [contributing guides](https://github.com/mongodb-labs/atlas-cli-plugin-terraform/blob/master/CONTRIBUTING.md)
- [ ] I have checked that this change does not generate any credentials and that **they are NOT accidentally logged anywhere**.
- [ ] I have added tests that prove my fix is effective or that my feature works per HashiCorp requirements
- [ ] I have added any necessary documentation (if appropriate)
- [ ] I have run make fmt and formatted my code
- [ ] If changes include deprecations or removals I have added appropriate changelog entries.
- [ ] If changes include removal or addition of 3rd party GitHub actions, I updated our internal document. Reach out to the APIx Integration slack channel to get access to the internal document.

## Further comments
43 changes: 43 additions & 0 deletions .github/workflows/code-health.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: 'Code Health'

on:
push:
branches:
- master
pull_request:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
permissions: {}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a
with:
go-version-file: 'go.mod'
- name: Build
run: make build
lint:
runs-on: ubuntu-latest
permissions: {}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Install Go
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a
with:
go-version-file: 'go.mod'
cache: false # see https://github.com/golangci/golangci-lint-action/issues/807
- name: golangci-lint
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8
with:
version: v1.63.4 # Also update GOLANGCI_VERSION variable in GNUmakefile when updating this version
- name: actionlint
run: |
make tools
echo "::add-matcher::.github/actionlint-matcher.json"
actionlint -color
shell: bash
- name: shellcheck
uses: bewuethr/shellcheck-action@d01912909579c4b1a335828b8fca197fbb8e0aa4
174 changes: 174 additions & 0 deletions .github/workflows/issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
---
name: Create JIRA ticket for new issues

# Creates and updates jira tickets that sync with GitHub Issues events.
on:
issues:
types: [opened, reopened, closed]
jobs:
jira_task:
name: Create Jira issue
if: github.event.action == 'opened'
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.APIX_BOT_PAT }}
steps:
- name: Create JIRA ticket
id: create
shell: bash
env:
ISSUE_NUMBER: ${{ github.event.issue.number }}
ISSUE_URL: ${{ github.event.issue.html_url }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
JIRA_ASSIGNEE: ${{ secrets.ASSIGNEE_JIRA_TICKET }}
run: |
json_response=$(curl --request POST \
--url 'https://jira.mongodb.org/rest/api/2/issue' \
--header 'Authorization: Bearer '"${JIRA_API_TOKEN}" \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"fields": {
"project": {
"id": "10984"
},
"summary": "HELP: GitHub Issue n. '"${ISSUE_NUMBER}"'",
"issuetype": {
"id": "12"
},
"customfield_12751": [{
"id": "25550"
}],
"description": "This ticket tracks the following GitHub issue: '"${ISSUE_URL}"'.",
"components": [
{
"id": "34035"
}
]
}
}')

echo "Response: ${json_response}"

JIRA_TICKET_ID=$(echo "${json_response}" | jq -r '.key')

echo "The following JIRA ticket has been created: ${JIRA_TICKET_ID}"
echo "jira-ticket-id=${JIRA_TICKET_ID}" >> "${GITHUB_OUTPUT}"
- name: Add comment
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043
with:
issue-number: ${{ github.event.issue.number }}
body: |
Thanks for opening this issue! Please make sure you've followed [our guidelines](https://github.com/mongodb/terraform-provider-mongodbatlas/issues/new?assignees=&labels=&projects=&template=Bug_Report.md) when opening the issue. In short, to help us reproduce the issue we need:
- Terraform configuration file used to reproduce the issue
- Terraform log files from the run where the issue occurred
- Terraform Atlas provider version used to reproduce the issue
- Terraform version used to reproduce the issue
- Confirmation if Terraform OSS, Terraform Cloud, or Terraform Enterprise deployment

The ticket [${{ steps.create.outputs.jira-ticket-id }}](https://jira.mongodb.org/browse/${{ steps.create.outputs.jira-ticket-id }}) was created for internal tracking.
reopen_jira_ticket:
name: Reopen JIRA ticket
if: github.event.action == 'reopened'
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.APIX_BOT_PAT }}
steps:
- name: Reopened JIRA ticket if exists
run: |
ISSUE_NUMBER=${{ github.event.issue.number }}
JIRA_API_TOKEN=${{ secrets.JIRA_API_TOKEN }}

JIRA_QUERY="project = CLOUDP AND issuetype = Story AND resolution = Declined AND text ~ \"HELP: GitHub Issue n. $ISSUE_NUMBER\""

# URL encode the query
JIRA_URL=$(echo "$JIRA_QUERY" | jq -s -R -r @uri)

json_response=$(curl -s --request GET \
--url "https://jira.mongodb.org/rest/api/2/search?fields=id&jql=${JIRA_URL}" \
--header 'Authorization: Bearer '"${JIRA_API_TOKEN}" \
--header 'Accept: application/json')

JIRA_TICKET_ID=$(echo "${json_response}" | jq -r '.issues[0].id')
if [ -z "$JIRA_TICKET_ID" ]; then
echo "JIRA_TICKET_ID is not defined. Exiting the script."
exit 1
fi

JIRA_REOPENED_URL="https://jira.mongodb.org/rest/api/2/issue/${JIRA_TICKET_ID}/transitions"

json_response=$(curl -s --request POST \
--url "${JIRA_REOPENED_URL}" \
--header 'Authorization: Bearer '"${JIRA_API_TOKEN}" \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"transition": {
"id": 3
},
"update": {
"comment": [
{
"add": {
"body": "The related GitHub issue was reopened. Updated via automated process."
}
}
]
}
}')
echo "Response: ${json_response}"
close_jira_ticket:
name: Close JIRA ticket
if: github.event.action == 'closed'
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.APIX_BOT_PAT }}
steps:
- name: Close JIRA ticket if exists
run: |
ISSUE_NUMBER=${{ github.event.issue.number }}
JIRA_API_TOKEN=${{ secrets.JIRA_API_TOKEN }}

JIRA_QUERY="project = CLOUDP AND issuetype = Story AND resolution = Unresolved AND text ~ \"HELP: GitHub Issue n. $ISSUE_NUMBER\""

# URL encode the query
JIRA_URL=$(echo "$JIRA_QUERY" | jq -s -R -r @uri)

json_response=$(curl -s --request GET \
--url "https://jira.mongodb.org/rest/api/2/search?fields=id&jql=${JIRA_URL}" \
--header 'Authorization: Bearer '"${JIRA_API_TOKEN}" \
--header 'Accept: application/json')

JIRA_TICKET_ID=$(echo "${json_response}" | jq -r '.issues[0].id')
if [ -z "$JIRA_TICKET_ID" ]; then
echo "JIRA_TICKET_ID is not defined. Exiting the script."
exit 1
fi

JIRA_CLOSE_URL="https://jira.mongodb.org/rest/api/2/issue/${JIRA_TICKET_ID}/transitions"

json_response=$(curl -s --request POST \
--url "${JIRA_CLOSE_URL}" \
--header 'Authorization: Bearer '"${JIRA_API_TOKEN}" \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"transition": {
"id": 1371
},
"update": {
"comment": [
{
"add": {
"body": "The related GitHub issue was closed. Resolved via automated process."
}
}
]
},
"fields": {
"resolution": {
"name": "Declined"
}
}
}')
echo "Response: ${json_response}"
Loading
Loading