-
Notifications
You must be signed in to change notification settings - Fork 178
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: Automatically updates Terraform version used in repository and test-suite #2755
Merged
Merged
Changes from 15 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
edd9e45
add script to update tf versions in test suite
maastha 110335e
minor
maastha 3bb43e4
Merge branch 'master' into CLOUDP-243394-tf-versions
maastha da652f7
temp
maastha fe11597
Revert "temp"
maastha 4a7fbbb
minor
maastha 57f36d1
update patch version
maastha 3d5325a
temp rename workflow
maastha 46144ec
temp
maastha 819ced9
updated
maastha dcf7d83
minor
maastha b57fa1c
minor
maastha 931162c
minor
maastha edbd63a
clean
maastha 9a69c16
cleanup
maastha 9dabbd9
Update scripts/update-tf-version-in-repository.sh
maastha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2024 MongoDB Inc | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
set -euo pipefail | ||
|
||
# example value of TF_VERSIONS_ARR='["1.9.x", "1.8.x", "1.7.x"]' | ||
TF_VERSIONS_ARR=$(./scripts/get-terraform-supported-versions.sh "false") | ||
|
||
TEST_SUITE_YAML_FILE=".github/workflows/test-suite.yml" | ||
TOOL_VERSIONS_FILE=".tool-versions" | ||
DOC_SCRIPT="scripts/generate-doc.sh" | ||
DOC_ALL_SCRIPT="scripts/generate-docs-all.sh" | ||
|
||
LATEST_TF_VERSION=$(echo "$TF_VERSIONS_ARR" | sed -E 's/^\["([^"]+).*/\1/') | ||
|
||
# Update Terraform versions in test-suite.yml | ||
sed -i.bak -E "/^ *terraform_matrix:/,/^ *provider_matrix:/ s|(default: ')[^']*(')|\1$TF_VERSIONS_ARR\2|" "$TEST_SUITE_YAML_FILE" | ||
|
||
sed -i.bak -E "s|schedule_terraform_matrix: '.*'|schedule_terraform_matrix: '[\"$LATEST_TF_VERSION\"]'|" "$TEST_SUITE_YAML_FILE" | ||
|
||
# Update patch version occurences | ||
maastha marked this conversation as resolved.
Show resolved
Hide resolved
|
||
LATEST_TF_PATCH_VERSION=$(./scripts/get-terraform-supported-versions.sh "latest") | ||
|
||
# Update Terraform versions in .tool-versions | ||
sed -i.bak -E "s|^(terraform) [0-9]+\.[0-9]+\.[0-9]+|\1 $LATEST_TF_PATCH_VERSION|" "$TOOL_VERSIONS_FILE" | ||
# Update Terraform versions in generate-doc scripts | ||
sed -i.bak -E "/TF_VERSION=/ s/[0-9]+\.[0-9]+\.[0-9]+/$LATEST_TF_PATCH_VERSION/g" "$DOC_SCRIPT" | ||
sed -i.bak -E "/TF_VERSION=/ s/[0-9]+\.[0-9]+\.[0-9]+/$LATEST_TF_PATCH_VERSION/g" "$DOC_ALL_SCRIPT" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] would be nice to use
./scripts/get-terraform-supported-versions.sh "latest"
and do the LATEST_TF_VERSION logic in the script