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

chore: Automates changing Terraform supported versions in provider documentation #2058

Merged
merged 11 commits into from Mar 22, 2024

Conversation

maastha
Copy link
Collaborator

@maastha maastha commented Mar 21, 2024

Description

Automate changing Terraform supported versions on documentation. This PR:

  • adds script to update website/docs/index.html.markdown with supported TF version information
  • adds github action to run the job daily and trigger a PR if any changes

Link to any related issue(s): CLOUDP-237003

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.
  • Breaking change (fix or feature that would cause existing functionality to not work as expected). Please, add the "breaking change" label to the PR.
  • This change requires a documentation update
  • Documentation fix/enhancement

Required Checklist:

  • I have signed the MongoDB CLA
  • I have read the contribution guidelines
  • 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 defined an isolated PR with a relevant title as it will be used in the auto-generated changelog.
  • 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.

Testing

Test PR created from workflow on forked repository: maastha#1

Further comments

Modified existing script to take an argument to output different types of supported version information:

scripts git:(CLOUDP-237003-automate-matrix-doc) ✗ ./get-terraform-supported-versions.sh true
[
  {
    "version": "v1.7.0",
    "published_at": "2024-01-17T19:59:32Z",
    "end_support_date": "2026-01-31T19:59:32Z"
  },
  {
    "version": "v1.6.0",
    "published_at": "2023-10-04T17:11:35Z",
    "end_support_date": "2025-10-31T17:11:35Z"
  },
  {
    "version": "v1.5.0",
    "published_at": "2023-06-12T10:13:09Z",
    "end_support_date": "2025-06-30T10:13:09Z"
  },
  {
    "version": "v1.4.0",
    "published_at": "2023-03-08T18:13:32Z",
    "end_support_date": "2025-03-31T18:13:32Z"
  },
  {
    "version": "v1.3.0",
    "published_at": "2022-09-21T13:59:25Z",
    "end_support_date": "2024-09-30T13:59:25Z"
  },
  {
    "version": "v1.2.0",
    "published_at": "2022-05-18T21:47:47Z",
    "end_support_date": "2024-05-31T21:47:47Z"
  }
]


➜  scripts git:(CLOUDP-237003-automate-matrix-doc) ✗ ./get-terraform-supported-versions.sh false
["1.7.x","1.6.x","1.5.x","1.4.x","1.3.x","1.2.x"]

@maastha maastha marked this pull request as ready for review March 22, 2024 13:10
@maastha maastha requested a review from a team as a code owner March 22, 2024 13:10
fi
;;
esac
01 | 03 | 05 | 07 | 08 | 10 | 12)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

formatted

@oarbusi
Copy link
Collaborator

oarbusi commented Mar 22, 2024

I would change the PR title to chore since this is an internal improvement not a customer facing feature

@maastha maastha changed the title feat: Automates changing Terraform supported versions in provider documentation chore: Automates changing Terraform supported versions in provider documentation Mar 22, 2024
@maastha maastha merged commit b07a93f into master Mar 22, 2024
51 checks passed
@maastha maastha deleted the CLOUDP-237003-automate-matrix-doc branch March 22, 2024 15:26
@@ -189,7 +191,7 @@ For more information on configuring and managing programmatic API Keys see the [
| 1.4.x | 2023-03-08 | 2025-03-31 | 2025-03-31 |
| 1.3.x | 2022-09-21 | 2024-09-30 | 2024-09-30 |
| 1.2.x | 2022-05-18 | 2024-05-31 | 2024-05-31 |

<!-- MATRIX_PLACEHOLDER_END -->
Copy link
Member

@lantoli lantoli Mar 22, 2024

Choose a reason for hiding this comment

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

a nice test would be to have this empty in the PR and see how tomorrow the PR is generated to create the table

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tried running the job manually in the fork and PR was created maastha#1
WDYT?

@@ -0,0 +1,30 @@
name: Update Terraform Compatibility Matrix documentation
Copy link
Member

Choose a reason for hiding this comment

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

as we're already in the TF repo, I would remove it from the file and title

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't fully agree, just using "compatibility matrix" could refer to terraform, terraform plugin framework, terraform provider, etc and cause confusion.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree with @oarbusi I don't think it's redundant

@@ -14,26 +14,35 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set -euo pipefail

Copy link
Member

Choose a reason for hiding this comment

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

same, I would remove TF from filename

@@ -0,0 +1,102 @@
#!/usr/bin/env bash
Copy link
Collaborator

Choose a reason for hiding this comment

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

Another big shell script 😅 Did you consider using python?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah I essentially re-used the existing script

Copy link
Member

Choose a reason for hiding this comment

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

or Go as @AgustinBettati did for the one in CFN listing CFN versions in regions ;-)
Go templates are nice.

a great topic you may want to bring to next tech meeting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants