Skip to content

Commit

Permalink
Feature/doc (#103)
Browse files Browse the repository at this point in the history
* Create release_flow.md

* Update release_flow.md

* Create REAN_Platform_Deployment_Workflows.md

* Update README.md

* Update README.md

* Updated doc

* Update release_flow.md

removed the sub headings from the release workflow to avoid duplication
  • Loading branch information
rf-opssupport authored Oct 16, 2023
1 parent 0eed98c commit 205774b
Show file tree
Hide file tree
Showing 3 changed files with 164 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ This service supports following workflows.
### Highlights
- API currently supports client authentication using API keys.
- User authentication is also applicable for careplan and asset creators and admin.

* [Release Flow](docs/release_flow.md)

### Currently in progress
- Careplan service supports static careplan schedules, but support for dynamic scheduling of careplans is in progress. When complete, the scheduling will be driven by rule engine, events and participant responses.
Expand Down
111 changes: 111 additions & 0 deletions docs/release_docs/REAN_Platform_Deployment_Workflows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# REAN Platform Deployment Workflows

## PR-CI-CD

**Mode of Trigger:** Automated

The PR Workflow is triggered automatically whenever a Pull Request with a source branch as a `feature/*` branch is created against the target branch as the `develop` branch.

### PR Workflow Diagram
![PR-ci-cd_workflow](https://github.com/REAN-Foundation/reancare-service/blob/develop/assets/images/pr-ci-cd_workflow.png?raw=true)

### GitHub Action Workflow Run
![pr](https://github.com/REAN-Foundation/reancare-service/blob/develop/assets/images/Pr-ci-cd_example.png?raw=true)

### Jobs

The PR workflow employs two jobs:

#### CodeScan-ESLint
In this job, we analyze the code that the developer wrote against certain rules to identify any stylistic or programmatic errors.
* This job uses the [Super-linter](https://github.com/marketplace/actions/super-linter) action.
* It utilizes a static code analysis tool to detect problematic patterns within the application's source code.

#### Build-Docker-Image
In this job, we validate the Dockerfile and test the image build process to uncover any issues arising from recent code changes.
* This job uses [docker/build-push-action](https://github.com/marketplace/actions/build-and-push-docker-images).
* It generates a Docker image with an image tag using the branch name and the short SHA of the commit, such as `feature/test_5e38e33`.

## Dev-CI-CD

**Mode of Trigger:** Automated

The Dev Workflow is automatically initiated whenever a Pull Request is merged into the `develop` branch. This workflow encompasses building the applications and deploying the changes to the RF Platform Development environment.

### Dev Workflow Diagram
![Dev-ci-cd_workflow](https://github.com/REAN-Foundation/reancare-service/blob/develop/assets/images/dev-ci-cd_workflow.png?raw=true)

### GitHub Action Workflow Run
![dev](https://github.com/REAN-Foundation/reancare-service/blob/develop/assets/images/Dev-ci-cd_example.png?raw=true)

### Jobs

#### Deploy-ECS
The Deploy ECS job encompasses the following steps:

* It utilizes [docker/build-push-action](https://github.com/marketplace/actions/build-and-push-docker-images).
* This job functions within the 'dev' environment and logs into ECR using credentials. It then constructs a new ECR Docker image with an image tag derived from the branch name and the short SHA of the commit. For instance, `/careplan-service-dev-uat:develop_5e38e33`.
* Subsequently, the job generates a fresh version of the Amazon ECS task definition, integrating the new Docker image. The deployment of the Amazon ECS task definition is orchestrated using the Duplo API.

## UAT-CI-CD

**Mode of Trigger:** Automated

The UAT-CI-CD workflow can be activated through two methods:

1. Creating a Pull Request to merge into the `MAIN` branch.
2. Initiating a Pull Request from a branch prefixed with 'release/'.

### UAT Workflow Diagram
![uat-ci-cd_Workflow](https://github.com/REAN-Foundation/reancare-service/blob/develop/assets/images/uat-ci-cd_workflow.png?raw=true)

### GitHub Action Workflow Run
![uat](https://github.com/REAN-Foundation/reancare-service/blob/develop/assets/images/Uat-ci-cd_example.png?raw=true)

### Jobs

#### CodeScan-ESLint
The CodeScan ESLint job executes the following steps:

* It employs the [Super-linter](https://github.com/marketplace/actions/super-linter) action.
* Utilizing a static code analysis tool, this job identifies problematic patterns present in the application's source code.

#### Label_Checks
The Label Checks job performs the subsequent actions:

* It leverages [pull-request-label-checker](https://github.com/marketplace/actions/label-checker-for-pull-requests).
* Upon a Pull Request event, the job assesses whether the Pull Request bears one of the major, minor, or patch labels.

#### Deploy-ECS
The Deploy ECS job encompasses the ensuing steps:

* It employs [docker/build-push-action](https://github.com/marketplace/actions/build-and-push-docker-images).
* This job operates within the 'UAT' environment and authenticates to ECR using credentials. It proceeds to build a fresh ECR Docker image accompanied by an image tag derived from the branch name and the short SHA of the commit, such as `/careplan-service-dev-uat:develop_5e38e33`.
* Subsequently, the job generates a new version of the Amazon ECS task definition, incorporating the updated Docker image. The deployment of the Amazon ECS task definition is facilitated using the Duplo API.

## PROD-CI-CD

**Mode of Trigger:** Automated

The Prod Workflow is automatically initiated whenever a Pull Request is merged into the main branch. This workflow encompasses building the applications and deploying the changes to the RF Platform Production environment.

### Prod Workflow Diagram
![prod-ci-cd_Workflow](https://github.com/REAN-Foundation/reancare-service/blob/develop/assets/images/PROD-ci-cd_workflow.png?raw=true)

### GitHub Action Workflow Run
![prod](https://github.com/REAN-Foundation/reancare-service/blob/develop/assets/images/prod-ci-cd_example.png?raw=true)

### Jobs

#### Publish-Release
The Publish-Release job undertakes the ensuing actions:

* It utilizes [release-drafter](https://github.com/release-drafter/release-drafter).
* This job generates a new GitHub release, with the versioning based on the label assigned by the developer to the pull request.

#### Deploy-ECS
The Deploy-ECS job encompasses the following steps:

* It employs [docker/build-push-action](https://github.com/marketplace/actions/build-and-push-docker-images).
* This job authenticates to ECR using credentials and assembles a new ECR Docker image accompanied by an image tag based on the ID of the release generated by the Publish-Release job. For instance, `careplan-service-dev-uat:97777323`.
* Subsequently, the job produces a new version of the Amazon ECS task definition, integrating the updated Docker image. The deployment of the Amazon ECS task definition is facilitated using the Duplo API.
51 changes: 51 additions & 0 deletions docs/release_flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# About Release Flow

1. For general guidance about using GitHub actions, you can take a look at [Github Actions Guide](https://docs.github.com/en/actions/guides).
2. We have a total of 7 active release workflows. These are located under [Workflows](https://github.com/REAN-Foundation/reancare-service/tree/develop/.github/workflows).

## Table Of Contents
- [Branching Strategy](#Branching-Strategy)
- [Develop to Main Branch Workflow](#Develop-to-Main-branch-Workflow)
- [Develop Branch Workflow](#Develop-Branch-Workflow)
- [Main branch Workflow](#Main-branch-Workflow)
- [Release Workflows](#Release-Workflows)
- [REAN Foundation Platform Workflows](#REAN-Foundation-Platform-Workflows)


## Branching Strategy

We are following the GitFlow branching strategy. Please refer [here](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow).

* ```main```: The main branch serves as the stable and production-ready branch, where all the changes from release branches are merged and tested before deployment.
* ```develop```: The develop branch, where all the changes from feature branches are merged
* ``` feature/*```: The feature branch, individual features, or enhancements are developed on separate branches, allowing for isolated development and easy collaboration before merging.
* ```release/*```: The release branch is a branch used for allowing isolated testing and preparation of the release before merging it into the main branch.
* ```hotfix/*```: The hotfix branch, hotfixes for critical issues are handled separately by creating dedicated branches and merging them directly into the main branch.

## Develop to Main Branch Workflow

The diagram below explains the end-to-end process and stages for promoting the code from the develop branch to the master branch.

![workflow_diagram](https://github.com/REAN-Foundation/reancare-service/blob/develop/assets/images/workflow_diagram.png?raw=true)

### Develop Branch Workflow

1. The developer will create a Feature branch and a Pull Request to develop the branch, triggering the PR-ci-cd workflow.
2. After the Pull request merges into develop branch it will Trigger the DEV-ci-cd workflow.

### Main branch Workflow

1. The developer will create a Release branch and a Pull Request to the main branch, triggering the UAT-ci-cd workflow.
2. After the Pull request merges into the main branch it will trigger the PROD-ci-cd workflow.

# Release Workflows

There are different types of workflows designed for the type of source branch used based on the GitFlow workflow and the deployment targets as explained below

### REAN Foundation Platform Workflows

* [PR-CI-CD](https://github.com/REAN-Foundation/reancare-service/blob/develop/docs/release_docs/REAN_Platform_Deployment_Workflows.md#pr-ci-cd)
* [Dev-CI-CD](https://github.com/REAN-Foundation/reancare-service/blob/develop/docs/release_docs/REAN_Platform_Deployment_Workflows.md#dev-ci-cd).
* [UAT-CI-CD](https://github.com/REAN-Foundation/reancare-service/blob/develop/docs/release_docs/REAN_Platform_Deployment_Workflows.md#uat-ci-cd).
* [PROD-CI-CD](https://github.com/REAN-Foundation/reancare-service/blob/develop/docs/release_docs/REAN_Platform_Deployment_Workflows.md#prod-ci-cd).

0 comments on commit 205774b

Please sign in to comment.