Skip to content

Commit

Permalink
Merge pull request #37 from no10ds/feature/improve-release
Browse files Browse the repository at this point in the history
Improve the release process, update docs, add terraform outputs
  • Loading branch information
lcardno10 authored Sep 20, 2023
2 parents 25c822c + 03da315 commit 340221b
Show file tree
Hide file tree
Showing 10 changed files with 115 additions and 41 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,12 @@ ui-zip-and-release: ui-zip-contents ui-release ## Zip and release prod static ui

##
release:
@python release.py --operation check
@git checkout ${commit}
@git tag -a "${version}" -m "Release tag for version ${version}"
@git checkout -
@git push origin ${version}
@python get_latest_release_changelog.py
@python release.py --operation create-changelog
@gh release create ${version} -F latest_release_changelog.md
@rm -rf latest_release_changelog.md

Expand Down
4 changes: 3 additions & 1 deletion api/api/domain/dataset_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ def format_resource_query(self):
self.build_key_only_tags(),
self.build_generic_filter(SENSITIVITY, self.sensitivity),
self.build_generic_filter(LAYER, self.layer),
self.build_generic_filter(DOMAIN, self.domain),
self.build_generic_filter(
DOMAIN, self.domain.lower() if self.domain else None
),
]

@combine_conditions
Expand Down
25 changes: 20 additions & 5 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
# Changelog

## v7.0.3 / v0.1.2 (sdk) - _2023-09-14_
## v7.0.4 / v0.1.2 (sdk) - _2023-09-20_

### Features

- Improved release process
- Added Athena workgroup and database as outputs of the rAPId module.

### Fixes

- Updated terraform default `application_version` and `ui_version` variables.
- Migration script and documentation.

## v7.0.3 / v0.1.2 (sdk) - _2023-09-15_

### Fixes

- Migration script and docs tweaks.
- Fixes issue where permissions were not being correctly read and causing api functionality to fail


## v7.0.2 / v0.1.2 (sdk) - _2023-09-14_

Expand Down Expand Up @@ -39,7 +52,9 @@

- See the [migration doc](migration.md) for details on how to migrate to v7 from v6.

[Unreleased changes]: https://github.com/no10ds/rapid/compare/v7.0.2...HEAD
[v7.0.2 / v0.1.1 (sdk)]: https://github.com/no10ds/rapid/v7.0.1...v7.0.2
[v7.0.1 / v0.1.1 (sdk)]: https://github.com/no10ds/rapid/v7.0.0...v7.0.1
[Unreleased changes]: https://github.com/no10ds/rapid/compare/v7.0.4...HEAD
[v7.0.4 / v0.1.2 (sdk)]: https://github.com/no10ds/rapid/v7.0.3...v7.0.4
[v7.0.3 / v0.1.2 (sdk)]: https://github.com/no10ds/rapid/v7.0.2...v7.0.3
[v7.0.2 / v0.1.2 (sdk)]: https://github.com/no10ds/rapid/v7.0.1...v7.0.2
[v7.0.1 / v0.1.2 (sdk)]: https://github.com/no10ds/rapid/v7.0.0...v7.0.1
[v7.0.0 / v0.1.1 (sdk)]: https://github.com/no10ds/rapid/v7.0.0
8 changes: 4 additions & 4 deletions docs/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ You will need the ability to run `Batect`, the requirements for which are listed

#### Make the infrastructure changes

A v7.0.0 infrastructure changes need to be applied to your rAPId instance.
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.3`
3. Update both the application_version and ui_version variables to `v7.0.4`

Apply these changes
Apply these changes.

#### Clone the repo

To do this, run:

`git clone -b v7.0.3 [email protected]:no10ds/rapid.git`
`git clone -b v7.0.4 [email protected]:no10ds/rapid.git`

#### Set your environment variables

Expand Down
26 changes: 0 additions & 26 deletions get_latest_release_changelog.py

This file was deleted.

7 changes: 6 additions & 1 deletion infrastructure/blocks/data-workflow/output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ output "athena_query_output_bucket_arn" {

output "athena_workgroup_arn" {
value = module.data_workflow.athena_workgroup_arn
description = "Query workgroup for Athena"
description = "The ARN of the Query workgroup for Athena"
}

output "athena_workgroup_name" {
value = module.data_workflow.athena_workgroup_name
description = "The name of the Query workgroup for Athena"
}

output "schema_table_arn" {
Expand Down
7 changes: 6 additions & 1 deletion infrastructure/modules/data-workflow/output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ output "athena_query_result_output_bucket_arn" {

output "athena_workgroup_arn" {
value = aws_athena_workgroup.rapid_athena_workgroup.arn
description = "Query workgroup for Athena"
description = "The arn of the Query workgroup for Athena"
}

output "athena_workgroup_name" {
value = aws_athena_workgroup.rapid_athena_workgroup.name
description = "The name of the Query workgroup for Athena"
}

output "catalogue_db_name" {
Expand Down
9 changes: 9 additions & 0 deletions infrastructure/modules/rapid/outputs.tf
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"
}
4 changes: 2 additions & 2 deletions infrastructure/modules/rapid/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ variable "app-replica-count-max" {
variable "application_version" {
type = string
description = "The version number for the application image (e.g.: v1.0.4, v1.0.x-latest, etc.)"
default = "v6.2.1"
default = "v7.0.4"
}

variable "ui_version" {
type = string
description = "The version number for the static ui (e.g.: v1.0.0, etc.)"
default = "v6.0.1"
default = "v7.0.4"
}

variable "catalog_disabled" {
Expand Down
63 changes: 63 additions & 0 deletions release.py
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()

0 comments on commit 340221b

Please sign in to comment.