Skip to content

Commit

Permalink
chore(build): issues/218 apply stable deploy paths (RedHatInsights#222)
Browse files Browse the repository at this point in the history
* pre.sh, minor local variable rename to avoid confusion
* proxy run, stable path additions for spandx config, local run
* contributing.md, branch and pr workflow updated
* custom release, beta and stable branches for ci, qa, prod
  • Loading branch information
cdcabrera committed Mar 13, 2020
1 parent 786abbb commit ac69b0c
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 33 deletions.
46 changes: 25 additions & 21 deletions .travis/custom_release.sh
Original file line number Diff line number Diff line change
@@ -1,40 +1,44 @@
#!/bin/bash
#
#
# CI/Dev beta release for "ci-beta" and "qa-beta" branches, based on deploy stage name
# Release a branch
release()
{
local DEPLOY_BRANCH=$1

printf "${YELLOW}PUSHING ${DEPLOY_BRANCH}${NOCOLOR}\n"
rm -rf ./build/.git
.travis/release.sh "${DEPLOY_BRANCH}"
printf "${GREEN}COMPLETED ${DEPLOY_BRANCH}${NOCOLOR}\n"
}
#
#
# CI/Dev beta release for "ci" and "qa" "beta" and "stable" branches, based on deploy stage name
#
releaseDev()
{
if [[ "${TRAVIS_BRANCH}" = "ci" ]] && [[ $TRAVIS_BUILD_STAGE_NAME == *"Beta"* ]]; then
printf "${YELLOW}PUSHING ci-beta${NOCOLOR}\n"
rm -rf ./build/.git
.travis/release.sh "ci-beta"
printf "${GREEN}COMPLETED ci-beta${NOCOLOR}\n"
if [[ "${TRAVIS_BRANCH}" = "ci-beta" || "${TRAVIS_BRANCH}" = "dev" || "${TRAVIS_BRANCH}" = "ci" ]] && [[ $TRAVIS_BUILD_STAGE_NAME == *"Beta"* ]]; then
release "ci-beta"
release "qa-beta"
fi

printf "${YELLOW}PUSHING qa-beta${NOCOLOR}\n"
rm -rf ./build/.git
.travis/release.sh "qa-beta"
printf "${GREEN}COMPLETED qa-beta${NOCOLOR}\n"
if [[ "${TRAVIS_BRANCH}" = "ci-stable" || "${TRAVIS_BRANCH}" = "test" || "${TRAVIS_BRANCH}" = "qa" ]] && [[ $TRAVIS_BUILD_STAGE_NAME != *"Beta"* ]]; then
release "ci-stable"
release "qa-stable"
fi
}
#
#
# Prod release for "master" branch based on deploy stage name.
# Prod release for "master" and "stage" branches based on deploy stage name.
#
releaseProd()
{
if [[ "${TRAVIS_BRANCH}" = "master" ]] && [[ $TRAVIS_BUILD_STAGE_NAME == *"Beta"* ]]; then
printf "${YELLOW}PUSHING prod-beta${NOCOLOR}\n"
rm -rf ./build/.git
.travis/release.sh "prod-beta"
printf "${GREEN}COMPLETED prod-beta${NOCOLOR}\n"
if [[ "${TRAVIS_BRANCH}" = "prod-beta" || "${TRAVIS_BRANCH}" = "stage" ]] && [[ $TRAVIS_BUILD_STAGE_NAME == *"Beta"* ]]; then
release "prod-beta"
fi

if [[ "${TRAVIS_BRANCH}" = "master" ]] && [[ $TRAVIS_BUILD_STAGE_NAME != *"Beta"* ]]; then
printf "${YELLOW}PUSHING prod-stable${NOCOLOR}\n"
rm -rf ./build/.git
.travis/release.sh "prod-stable"
printf "${GREEN}COMPLETED prod-stable${NOCOLOR}\n"
if [[ "${TRAVIS_BRANCH}" = "prod-stable" || "${TRAVIS_BRANCH}" = "master" ]] && [[ $TRAVIS_BUILD_STAGE_NAME != *"Beta"* ]]; then
release "prod-stable"
fi
}
#
Expand Down
42 changes: 34 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,36 @@ Settings for [Standard Version](https://github.com/conventional-changelog/standa
## Branching, Pull Requests, and Releases

### Branches
Curiosity makes use of only two branches `master` and `ci`.
Curiosity primarily makes use of the branches `master`, `qa`, and `ci`.
- `master` branch is a protected representation of production environments
- Adding commits, or a PR, into `master` should generate `prod-*` branches within the deploy repository [curiosity-frontend-build](https://github.com/RedHatInsights/curiosity-frontend-build)
- The `prod-*` branches are manually deployed through coordination with the operations team.
- `ci` branch is a representation of `ci`, or `dev`, and `qa`.
- Adding commits, or a PR, into `ci` should generate `ci-*` and `qa-*` branches within the deploy repository [curiosity-frontend-build](https://github.com/RedHatInsights/curiosity-frontend-build)
- The `ci-*` and `qa-*` branches are automatically deployed within an averaged timeframe for both `https://ci.*.redhat.com` and `https://qa.*.redhat.com`
- Adding commits, or a PR, into `master` should generate a `prod-stable` branch within the deploy repository [curiosity-frontend-build](https://github.com/RedHatInsights/curiosity-frontend-build)
- The `prod-stable` branch is manually deployed through coordination with the operations team.
- `qa` branch is a representation of `qa-stable`, and `ci-stable`.
- Adding commits, or a PR, into `ci-stable` should generate `ci-*` and `qa-*` branches within the deploy repository [curiosity-frontend-build](https://github.com/RedHatInsights/curiosity-frontend-build)
- The `ci-*` and `qa-*` branches are automatically deployed within an averaged time for both `https://ci.*.redhat.com` and `https://qa.*.redhat.com`
- `ci` branch is a representation of `ci-beta`, and `qa-beta`.
- Adding commits, or a PR, into `ci-beta` should generate `ci-*` and `qa-*` branches within the deploy repository [curiosity-frontend-build](https://github.com/RedHatInsights/curiosity-frontend-build)
- The `ci-*` and `qa-*` branches are automatically deployed within an averaged time for both `https://ci.*.redhat.com` and `https://qa.*.redhat.com`

#### Additional branches
A staging branch can also be utilized.
- `stage` branch is a protected representation of production environments
- Adding commits, or a PR, into `stage` should generate a `prod-beta` branch within the deploy repository [curiosity-frontend-build](https://github.com/RedHatInsights/curiosity-frontend-build)
- The `prod-beta` branch is manually deployed through coordination with the operations team.

#### Branching and Pull Request Workflow
It is preferred that all work is handled through GitHub's fork and pull workflow. Working directly on the master repository is discouraged
since a form of Continuous Integration is implemented and dependent on branch structure.

1. General development PRs should be opened against the `ci` branch.
1. PRs to master branch are considered production ready releases.
1. It is preferred that PRs to `qa` originate from `ci`, but development PRs opened against `qa` are allowed.
1. PRs to master branch are considered production ready releases. It is preferred that PRs originate from `qa`, or `stage` if available.
1. Development PRs opened against master, unless a team agreed exception occurs, will be closed.
1. All PRs to master branch should include a final review, or coordination, from Quality Engineering.
1. All PRs to production, master branch, should have a final review, coordination, from Quality Engineering.

```
PR -> ci <-> qa -> stage -> master
```

### Releases and Tagging
1. Merging a PR into `master` is considered production ready.
Expand Down Expand Up @@ -87,6 +104,14 @@ This project makes use of reserved CSS class prefixes used by external resources

CSS classes with the prefix `uiux-` are used by external resources to identify elements for use in 3rd party tooling. Changes to the class name or element should be broadcast towards our UI/UX team members.

### Reserved QE testing attributes
This project makes use of reserved DOM attributes used by the QE team.
> Updating elements with these attributes should be done with the knowledge "you are affecting" QE's ability to test.
1. Attribute `data-test`

DOM attributes with `data-test=""` are used by QE as a means to identify specific DOM elements.

## Testing
To test content you'll need to have Node and Yarn installed.

Expand Down Expand Up @@ -161,6 +186,7 @@ If you're having trouble getting an accurate code coverage report, or it's faili

## Typical Development Workflow
After setting up the repository...
1. Confirm you have access to the network
1. Make sure Docker is running
1. Open a couple of instances of Terminal and run...
```
Expand Down
9 changes: 9 additions & 0 deletions config/spandx.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,21 @@ module.exports = {
'/static': {
host: `https://${localhost}:5001`
},
'/apps/subscriptions': {
host: `https://${localhost}:5001`
},
'/beta/apps/subscriptions': {
host: `https://${localhost}:5001`
},
'/staging/subscriptions': {
host: `https://${localhost}:5001`
},
'/beta/staging/subscriptions': {
host: `https://${localhost}:5001`
},
'/subscriptions': {
host: `https://${localhost}:5001`
},
'/beta/subscriptions': {
host: `https://${localhost}:5001`
},
Expand Down
8 changes: 4 additions & 4 deletions scripts/pre.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
#
deployPaths()
{
local CI_BRANCH=$1
local CI_BUILD_STAGE=$2
local DEPLOY_BRANCH=$1
local DEPLOY_BUILD_STAGE=$2

DEPLOY_PATH_PREFIX=""

if [[ $CI_BUILD_STAGE == *"Beta"* ]]; then
if [[ $DEPLOY_BUILD_STAGE == *"Beta"* ]]; then
DEPLOY_PATH_PREFIX=/beta
fi

echo UI_DEPLOY_PATH_PREFIX="$DEPLOY_PATH_PREFIX" >> ./.env.production.local

echo "\"${CI_BUILD_STAGE}\" build stage config for branch \"${CI_BRANCH}\"..."
echo "\"${DEPLOY_BUILD_STAGE}\" build stage config for branch \"${DEPLOY_BRANCH}\"..."
printf "Deploy path prefix ... ${GREEN}UI_DEPLOY_PATH_PREFIX=$DEPLOY_PATH_PREFIX${NOCOLOR}\n"
}
#
Expand Down
3 changes: 3 additions & 0 deletions tests/__snapshots__/platform.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ Array [

exports[`Platform Configuration should have a proxy configuration with path references that match configuration: proxy references 1`] = `
Array [
"'/apps/subscriptions': {",
"'/beta/apps/subscriptions': {",
"'/staging/subscriptions': {",
"'/beta/staging/subscriptions': {",
"'/subscriptions': {",
"'/beta/subscriptions': {",
"",
]
Expand Down

0 comments on commit ac69b0c

Please sign in to comment.