-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from no10ds/fix/v7-migration
Add fixes to the migration script and docs
- Loading branch information
Showing
11 changed files
with
142 additions
and
104 deletions.
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
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 |
---|---|---|
|
@@ -13,38 +13,43 @@ To execute it, you'll need to decide: | |
|
||
### Prerequisites | ||
|
||
#### Infrastructure changes | ||
|
||
The v7.0.0 infrastructure changes need to be applied to your rAPId instance. | ||
|
||
Update the version of the rAPId terraform module that you are using and apply the terraform. | ||
|
||
#### Local requirements | ||
|
||
You will need the ability to run `Batect`, the requirements for which are listed [here](https://batect.dev/docs/getting-started/requirements/). | ||
|
||
### Steps: | ||
|
||
#### Make the infrastructure changes | ||
|
||
The v7 infrastructure changes need to be applied to your rAPId instance. | ||
|
||
1. Add the `layers` variable to the rAPId cluster module. `layers` will be a list of the layers you wish to use in your rAPId instance. You can omit this if you just want to use the `default` layer. | ||
2. Change the rAPId module source to: | ||
`[email protected]:no10ds/rapid.git//infrastructure/modules/rapid` | ||
3. Update both the application_version and ui_version variables to `v7.0.4` | ||
|
||
Apply these changes. | ||
|
||
#### Clone the repo | ||
|
||
To do this, run: | ||
|
||
`git clone -b v7.0.0 [email protected]:no10ds/rapid.git` | ||
`git clone -b v7.0.4 [email protected]:no10ds/rapid.git` | ||
|
||
#### Set your environment variables | ||
|
||
Within the rAPId repo, set the following variables in the `.env` file to match those of your rAPId instance and AWS account: | ||
|
||
``` | ||
# rAPId instance variables | ||
- AWS_REGION= | ||
- DATA_BUCKET= | ||
- RESOURCE_PREFIX= | ||
AWS_REGION= | ||
DATA_BUCKET= | ||
RESOURCE_PREFIX= | ||
# AWS environment variables | ||
- AWS_ACCESS_KEY_ID= | ||
- AWS_SECRET_ACCESS_KEY= | ||
- AWS_SESSION_TOKEN= | ||
AWS_ACCESS_KEY_ID= | ||
AWS_SECRET_ACCESS_KEY= | ||
AWS_SESSION_TOKEN= | ||
``` | ||
|
||
#### Run the migration script | ||
|
This file was deleted.
Oops, something went wrong.
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,9 @@ | ||
output "athena_workgroup_name" { | ||
value = module.data_workflow.athena_workgroup_name | ||
description = "The name of the Query workgroup for Athena" | ||
} | ||
|
||
output "catalogue_db_name" { | ||
value = module.data_workflow.catalogue_db_name | ||
description = "The name of the Glue Catalogue database" | ||
} |
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,63 @@ | ||
import re | ||
import argparse | ||
|
||
|
||
def create_changelog(): | ||
with open("./docs/changelog.md", "r") as changelog_file: | ||
changelog_lines = changelog_file.readlines() | ||
|
||
parsed_lines = [] | ||
|
||
adding = False | ||
|
||
for line in changelog_lines: | ||
if re.match( | ||
# Match for the release version number e.g. ## v7.0.0 | ||
f"##\s+v\d+\.\d+\.\d+", # noqa: F541, W605 | ||
line, | ||
): | ||
adding = not adding | ||
if adding: | ||
parsed_lines.append(line) | ||
|
||
if not parsed_lines: | ||
raise Exception( | ||
"It looks like there is no release information in the changelog. Please check it." | ||
) | ||
else: | ||
with open("latest_release_changelog.md", "w+") as latest_changelog: | ||
latest_changelog.writelines(parsed_lines) | ||
|
||
|
||
def ask_yes_no_question(question): | ||
while True: | ||
answer = input(f"{question} (yes/no): ").strip().lower() | ||
if answer == "yes" or answer == "y": | ||
return True | ||
elif answer == "no" or answer == "n": | ||
print("Please fix this before continuing.") | ||
exit(1) | ||
else: | ||
print("Please answer yes or no.") | ||
|
||
|
||
def check(): | ||
ask_yes_no_question("Have you updated the application and ui version in Terraform?") | ||
ask_yes_no_question("Have you updated the changelog for this release?") | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser() | ||
|
||
parser.add_argument( | ||
"--operation", | ||
help="The operation to carry out", | ||
required=True, | ||
choices=["check", "create-changelog"], | ||
) | ||
args = parser.parse_args() | ||
match args.operation: | ||
case "create-changelog": | ||
create_changelog() | ||
case "check": | ||
check() |