Skip to content

Commit

Permalink
Fix/release process (#74)
Browse files Browse the repository at this point in the history
* see if sdk_test can be brought back

* quick fix

* misspelt step

* more fixes

* Fixing action uncomment blocks

* make separate release processes for api and sdk

* Creating separate make commands for the api and sdk releases, contain execution using if condition

* Split markdown files for changelog

* delete old changelog

* docs process updated

* reorganise changelog order

* adding quick fix to setup.py

* fix comments

* final fix

* resolve comments

* update docs

* fix

* Update contributing.md
  • Loading branch information
MotwaniM authored Feb 6, 2024
1 parent 535d863 commit adeab27
Show file tree
Hide file tree
Showing 11 changed files with 190 additions and 75 deletions.
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ CUSTOM_USER_NAME_REGEX="regex_expression"
RAPID_CLIENT_ID=
RAPID_CLIENT_SECRET=
RAPID_URL=

# UI Specific
NEXT_PUBLIC_API_URL=
NEXT_PUBLIC_API_URL_PROXY=
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,12 @@ jobs:
- name: SDK Test
run: make sdk-test

# TODO: Add back in
# - name: SDK Test Deploy
# run: make sdk-release-test
- name: Set env variable
run: echo "TEST_SDK_VERSION=$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV

- name: SDK Test Deploy
run: make sdk-release-test

ui-dev:
needs:
- setup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:

jobs:
setup:
if: github.event.release.name == 'api release'
runs-on: self-hosted
steps:
- name: Checkout
Expand Down Expand Up @@ -34,34 +35,6 @@ jobs:
- name: API Tag and Upload Release Image
run: make api-tag-and-upload-release-image

sdk-release:
needs:
- setup
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Populate .env with additional vars
run: |
echo TWINE_USERNAME=${{ secrets.TWINE_USERNAME }} >> .env
echo TWINE_PASSWORD=${{ secrets.TWINE_PASSWORD }} >> .env
echo TWINE_NON_INTERACTIVE=true >> .env
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'

- name: Setup Python Environment
run: |
make sdk-setup
source sdk/.venv/bin/activate
- name: SDK Release
run: make sdk-release

ui-release:
needs:
- setup
Expand Down Expand Up @@ -91,7 +64,6 @@ jobs:
needs:
- setup
- api-release
- sdk-release
- ui-release
runs-on: self-hosted
steps:
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/release_sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: rAPId Release

on:
release:
types: [released]

jobs:
setup:
if: github.event.release.name == 'sdk release'
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Log commit SHA
run: echo $GITHUB_SHA

sdk-release:
needs:
- setup
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Populate .env with additional vars
run: |
echo TWINE_USERNAME=${{ secrets.TWINE_USERNAME }} >> .env
echo TWINE_PASSWORD=${{ secrets.TWINE_PASSWORD }} >> .env
echo TWINE_NON_INTERACTIVE=true >> .env
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'

- name: Setup Python Environment
run: |
make sdk-setup
source sdk/.venv/bin/activate
- name: SDK Release
run: make sdk-release

cleanup:
needs:
- setup
- sdk-release
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Clean Docker Context
if: always()
run: make clean-pipeline-docker-context
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -186,20 +186,20 @@ ui-release:

ui-zip-and-release: ui-zip-contents ui-release ## Zip and release prod static ui site


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

@python release.py --operation create-changelog --type ${type}
@gh release create ${version} -F latest_release_changelog_${type}.md -t "${type} release"
@rm -rf latest_release_changelog_${type}.md

# Migration --------------------
##
migrate-v7: ## Run the migration
@cd api/; ./batect migrate-v7 -- --layer ${layer} --all-layers ${all-layers}

serve-docs:
mkdocs serve
29 changes: 10 additions & 19 deletions docs/changelog.md → docs/changelog/api.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# API Changelog

# Changelog

## v7.0.8 / v0.1.6 (sdk) - _2023-11-15_
## v7.0.8 - _2023-11-15_

### Fixes

- Issue with date types when editing a schema on the UI because of no option to apply format column and therefore getting an _all fields are required_ error.
- Tweaked UI design when adding permissions to subject.
- SDK not uploading a Pandas Dataframe with a date field set correctly.
- Updated NextJS and Zod package version.

### Features
Expand All @@ -17,11 +18,10 @@

- https://github.com/no10ds/rapid/issues/57

## v7.0.7 / v0.1.5 (sdk) - _2023-11-07_
## v7.0.7 - _2023-11-07_

### Fixes

- Issue within the sdk `upload_and_create_dataset` function where schema metadata wasn't being correctly overridden.
- Hitting maximum security group rules for the load balancer.
- Documentation improvements and removes any references to the old deprecated repositories.

Expand All @@ -32,7 +32,7 @@
- https://github.com/no10ds/rapid/issues/54
- https://github.com/no10ds/rapid/issues/51

## v7.0.6 / v0.1.4 (sdk) - _2023-10-18_
## v7.0.6 - _2023-10-18_

### Features

Expand All @@ -41,17 +41,10 @@

### Fixes

- Fixed an issue with the sdk not showing schemas were created successfully due to a wrong response code.
- Where dataset info was being called on columns with a date type, this was causing an issue with the Pydantic validation.
- Tweaked the documentation to implement searching for column heading style guide to match what the API returns in the error message.

## v7.0.5 / v0.1.3 (sdk) - _2023-09-20_

### Fixes

- Fix the behaviour of the dataset pattern functions in the SDK.

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

### Features

Expand All @@ -63,26 +56,25 @@
- Updated terraform default `application_version` and `ui_version` variables.
- Migration script and documentation.

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

### Fixes

- 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_
## v7.0.2 - _2023-09-14_

### Fixes

- Update UI repo references.

## v7.0.1 / v0.1.2 (sdk) - _2023-09-13_
## v7.0.1 - _2023-09-13_

### Fixes

- Date types were being stored as strings which caused issues when querying with Athena. They are now stored as date types.
- Rename the rAPId sdk method `generate_info` to `fetch_dataset_info` and remove an unnecessary argument.

## v7.0.0 / v0.1.1 (sdk) - _2023-09-12_
## v7.0.0 - _2023-09-12_

### Features

Expand All @@ -96,7 +88,6 @@
### Breaking Changes

- All dataset endpoints will be prefixed with `layer`. Typically going from `domain/dataset` to `layer/domain/dataset`.
- All sdk functions that interact with datasets will now require an argument for layer.

### Migration

Expand Down
75 changes: 75 additions & 0 deletions docs/changelog/sdk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# SDK Changelog

## v0.1.6 - _2023-11-15_

### Fixes

- SDK not uploading a Pandas Dataframe with a date field set correctly.

### Closes relevant GitHub issues

- https://github.com/no10ds/rapid/issues/57

## v0.1.5 - _2023-11-07_

### Fixes

- Issue within the sdk `upload_and_create_dataset` function where schema metadata wasn't being correctly overridden.
- Documentation improvements and removes any references to the old deprecated repositories.


## v0.1.4 - _2023-10-18_

### Features

- Clients can now be created and deleted via the sdk.

### Fixes

- Fixed an issue with the sdk not showing schemas were created successfully due to a wrong response code.
- Where dataset info was being called on columns with a date type, this was causing an issue with the Pydantic validation.
- Tweaked the documentation to implement searching for column heading style guide to match what the API returns in the error message.

## v0.1.3 - _2023-09-20_

### Fixes

- Fix the behaviour of the dataset pattern functions in the SDK.

## v0.1.2 - _2023-09-13_

### Fixes

- Date types were being stored as strings which caused issues when querying with Athena. They are now stored as date types.
- Rename the rAPId sdk method `generate_info` to `fetch_dataset_info` and remove an unnecessary argument.

## v0.1.1- _2023-09-12_

### Features

- Layers have been introduced to rAPId. These are now the highest level of grouping for your data. They allow you to separate your data into areas that relate to the layers in your data architecture e.g `raw`, `curated`, `presentation`. You will need to specify your layers when you create or migrate a rAPId instance.
- All the code is now in this monorepo. The previous [Infrastructure](https://github.com/no10ds/rapid-infrastructure), [UI](https://github.com/no10ds/rapid-ui) and [API](https://github.com/no10ds/rapid-api) repos are now deprecated. This will ease the use and development of rAPId.
- Schemas are now stored in DynamoDB, rather than S3. This offers speed and usability improvements, as well as making rAPId easier to extend.
- Code efficiency improvements. There were several areas in rAPId where we were executing costly operations that caused performance to degrade at scale. We've fixed these inefficiencies, taking us from O(n²) -> O(n) in these areas.
- Glue Crawlers have been removed, with Athena tables are created directly by the API instead. Data is now available to query immediately after it is uploaded, rather than the previous wait (approximately 3 mins) while crawlers ran. It also offers scalability benefits because without crawlers we are not dependant on the number of free IPs within the subnet.
- Improved UI testing with Playwright.

### Breaking Changes

- All dataset endpoints will be prefixed with `layer`. Typically going from `domain/dataset` to `layer/domain/dataset`.
- All sdk functions that interact with datasets will now require an argument for layer.

### Migration

- 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.8...HEAD
[v7.0.8 / v0.1.6 (sdk)]: https://github.com/no10ds/rapid/v7.0.7...v7.0.8
[v7.0.7 / v0.1.5 (sdk)]: https://github.com/no10ds/rapid/v7.0.6...v7.0.7
[v7.0.6 / v0.1.4 (sdk)]: https://github.com/no10ds/rapid/v7.0.5...v7.0.6
[v7.0.5 / v0.1.3 (sdk)]: https://github.com/no10ds/rapid/v7.0.4...v7.0.5
[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
12 changes: 7 additions & 5 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ rAPId has several core components that are all versioned when a release is creat
3. A public pypi package of the built rAPId-sdk that provides an easy and pythonic way to interact with the API.
4. A terraform module that can be used to create the AWS services necessary for running the various components of rAPId.

Performing a release involves tagging the repository with a new version number so that the API image, UI, SDK and Terraform all get versioned.
Performing a release involves tagging the repository with a new version number so that the API image, UI, SDK and Terraform all get versioned. Note that the API and SDK can be versioned and released independently, so you can conserve the API version number if just releasing an update to the SDK.

### Prerequisites

Expand All @@ -172,11 +172,13 @@ Performing a release involves tagging the repository with a new version number s

### Steps

1. Decide on the new version number following the [semantic versioning approach](https://semver.org/)
1. Decide on the new version number for the API and the UI and/or the SDK following the [semantic versioning approach](https://semver.org/).
2. Update and commit the Changelog (you can follow
the [template](https://github.com/no10ds/rapid/blob/main/changelog_release_template/md))
3. Run `make release commit=<commit_hash> version=vX.X.X`
the [template](https://github.com/no10ds/rapid/blob/main/changelog_release_template/md)). You'll need to separate SDK and API changes into their respective changelogs, under docs/changelog.
1. Bundle API, UI and terraform changes as part of the API changelog.
2. Insert SDK changes into the SDK changelog.
3. Run `make release commit=<commit_hash> type=<sdk|api> version=vX.X.X`

> Ensure the version number follows the format `vX.X.X` with full-stops in the same places
> Ensure the version number follows the format `vX.X.X` with full-stops in the same places for both API and SDK changes.
Now the release pipeline will run automatically, build all images and packages off that version of the code and tag it within GitHub.
5 changes: 3 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ nav:
- sdk/api/items/schema.md
- Patterns:
- sdk/api/patterns/data.md
- Releases: changelog.md
- Migration: migration.md
- Contributing: contributing.md

- Changelog:
- changelog/sdk.md
- changelog/api.md
plugins:
- search
- mkdocstrings:
Expand Down
Loading

0 comments on commit adeab27

Please sign in to comment.