Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production Increment #102

Merged
merged 6 commits into from
Sep 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@ jobs:
- before_script: yarn global add codecov
script: yarn test:ci
after_success: codecov
- stage: Deploy
- stage: Beta Deploy
script: yarn build && curl -sSL https://raw.githubusercontent.com/RedHatInsights/insights-frontend-builder-common/master/src/bootstrap.sh | bash -s
- stage: Stable Deploy
script: yarn build && curl -sSL https://raw.githubusercontent.com/RedHatInsights/insights-frontend-builder-common/master/src/bootstrap.sh | bash -s
env:
global:
- REPO="git@github.com:RedHatInsights/curiosity-frontend-build"
- REPO_DIR="curiosity-frontend-build"
- BRANCH=${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}
- BUILD_STAGE="${TRAVIS_BUILD_STAGE_NAME}"
- NODE_OPTIONS="--max-old-space-size=4096 --max_old_space_size=4096"
- APP_BUILD_DIR="build"
56 changes: 56 additions & 0 deletions .travis/custom_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash
#
#
# CI/Dev beta release for "ci-beta" and "qa-beta" 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"

printf "${YELLOW}PUSHING qa-beta${NOCOLOR}\n"
rm -rf ./build/.git
.travis/release.sh "qa-beta"
printf "${GREEN}COMPLETED qa-beta${NOCOLOR}\n"
fi
}
#
#
# Prod release for "master" branch 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"
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"
fi
}
#
#
# main()
#
{
set -e
set -x

BLUE="\e[34m"
RED="\e[31m"
GREEN="\e[32m"
YELLOW="\e[33m"
NOCOLOR="\e[39m"

releaseDev
releaseProd
}
50 changes: 37 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,31 @@ It's encouraged that commit messaging follow the format

Settings for [Standard Version](https://github.com/conventional-changelog/standard-version#readme) can be found in [package.json](./package.json)

## Build
### dotenv files
Our current build leverages `dotenv`, or `.env*`, files to apply environment build configuration.

There are currently build processes in place that leverage the `.env*.local` files, these files are actively applied in our `.gitignore` in order to avoid build conflicts. They should continue to remain ignored, and not be added to the repository.

Specific uses:
- `.env.local`, is left alone for developer purposes, typically around displaying Redux logging
- `.env.development.local`, is used by the local run NPM script `$ yarn start:local`
- `.env.production.local`, is used by the build to relate version information

## Serving Content
## Branching, Pull Requests, and Releases

### Branches
Curiosity makes use of only two branches `master` 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`

#### Branching and Pull Request Workflow
1. General development PRs should be opened against the `ci` branch.
1. PRs to master branch are considered production ready releases.
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.

### Releases and Tagging
1. Merging a PR into `master` is considered production ready.
1. Merging a PR into `master` doesn't require tagging and [CHANGELOG.md](./CHANGELOG.md) updates.
1. Tagging and `CHANGELOG.md` updates should be coordinated against a consistent release cycle, and can take place at an independent time.
1. Tagging should make use of semver.
1. Manipulating tags against commits directly should be avoided in favor of a semantic version increment.

## Serving content, or getting everything to run in your local environment.
To serve content you'll need to have Docker, Node, and Yarn installed.

Serving content comes in 3 variations
Expand Down Expand Up @@ -54,6 +67,17 @@ Things to try:
#### It's still failing, and now I'm frustrated!
You can take the easy way out and just run, `$ yarn start`, it'll be styled and use mock data but you'll have enough access to continue development.

## Build
### dotenv files
Our current build leverages `dotenv`, or `.env*`, files to apply environment build configuration.

There are currently build processes in place that leverage the `.env*.local` files, these files are actively applied in our `.gitignore` in order to avoid build conflicts. They should continue to remain ignored, and not be added to the repository.

Specific uses:
- `.env.local`, is left alone for developer purposes, typically around displaying Redux logging
- `.env.development.local`, is used by the local run NPM script `$ yarn start:local`
- `.env.production.local`, is used by the build to relate version information

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

Expand Down Expand Up @@ -126,7 +150,7 @@ If you're having trouble getting an accurate code coverage report, or it's faili
$ yarn test:clearCache
```

## Typical Workflow
## Typical Development Workflow
After setting up the repository...
1. Make sure Docker is running
1. Open a couple of instances of Terminal and run...
Expand Down
2 changes: 1 addition & 1 deletion config/spandx.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
host: `http://${localhost}:5001`
},
'/api': {
host: 'https://ci.cloud.paas.psi.redhat.com'
host: 'https://ci.cloud.redhat.com'
}
}
};
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@
"@redhat-cloud-services/frontend-components-utilities": "0.0.8",
"axios": "^0.19.0",
"classnames": "^2.2.6",
"i18next": "^17.0.6",
"i18next-xhr-backend": "^3.0.0",
"js-cookie": "^2.2.0",
"i18next": "^17.0.14",
"i18next-xhr-backend": "^3.1.2",
"js-cookie": "^2.2.1",
"locale-code": "^2.0.2",
"lodash": "^4.17.15",
"moment": "^2.24.0",
Expand All @@ -94,8 +94,8 @@
"prop-types": "^15.7.2",
"react": "^16.9.0",
"react-dom": "^16.9.0",
"react-i18next": "^10.12.2",
"react-redux": "^7.1.0",
"react-i18next": "^10.12.4",
"react-redux": "^7.1.1",
"react-router": "^5.0.1",
"react-router-dom": "^5.0.1",
"react-scripts": "3.1.1",
Expand All @@ -111,9 +111,9 @@
"enzyme-adapter-react-16": "^1.14.0",
"enzyme-to-json": "^3.4.0",
"eslint-config-airbnb": "^18.0.1",
"eslint-config-prettier": "^6.1.0",
"eslint-config-prettier": "^6.3.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jest": "^22.15.2",
"eslint-plugin-jest": "^22.17.0",
"eslint-plugin-json": "^1.4.0",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.0",
Expand Down
9 changes: 6 additions & 3 deletions public/locales/en-US.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
{
"curiosity-graph": {
"heading": "Daily CPU socket usage",
"heading": "CPU socket usage",
"dropdownDaily": "Daily",
"dropdownWeekly": "Weekly",
"dropdownMonthly": "Monthly",
"dropdownQuarterly": "Quarterly",
"dropdownPlaceholder": "Select date range",
"tooltipLabel": "sockets on",
"tooltipPreviousLabelDaily": "from previous day",
"tooltipPreviousLabelWeekly": "from previous week",
"tooltipPreviousLabelMonthly": "from previous month",
"tooltipPreviousLabelQuarterly": "from previous quarter"
"tooltipPreviousLabelQuarterly": "from previous quarter",
"tooltipSockets": "sockets on",
"tooltipSocketsThreshold": "Socket Threshold",
"legendSocketsLabel": "Sockets",
"legendSocketsThresholdLabel": "Socket Threshold"
}
}
17 changes: 12 additions & 5 deletions scripts/pre.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@
deployPaths()
{
local CI_BRANCH=$1
local CI_BUILD_STAGE=$2

DEPLOY_PATH_PREFIX=""

if [[ $CI_BRANCH == *"beta"* ]] || [[ $CI_BRANCH == *"master"* ]]; then
if [[ $CI_BUILD_STAGE == *"Beta"* ]]; then
DEPLOY_PATH_PREFIX=/beta
fi

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

echo "Deploy config for branch \"${CI_BRANCH}\"..."
echo "Deploy path prefix ... UI_DEPLOY_PATH_PREFIX=$DEPLOY_PATH_PREFIX"
echo "\"${CI_BUILD_STAGE}\" build stage config for branch \"${CI_BRANCH}\"..."
printf "Deploy path prefix ... ${GREEN}UI_DEPLOY_PATH_PREFIX=$DEPLOY_PATH_PREFIX${NOCOLOR}\n"
}
#
#
Expand All @@ -25,7 +26,7 @@ deployPaths()
version()
{
UI_VERSION="$(node -p 'require(`./package.json`).version').$(git rev-parse --short HEAD)"
echo "Version... UI_VERSION=$UI_VERSION"
printf "Version... ${GREEN}UI_VERSION=$UI_VERSION${NOCOLOR}\n"
echo UI_VERSION="$UI_VERSION" >> ./.env.production.local
}
#
Expand All @@ -44,9 +45,15 @@ clean()
# main()
#
{
BLUE="\e[34m"
RED="\e[31m"
GREEN="\e[32m"
YELLOW="\e[33m"
NOCOLOR="\e[39m"

clean
version

# see .travis.yml globals
deployPaths ${BRANCH:-local}
deployPaths "${BRANCH:-local}" "${BUILD_STAGE:-Local Deploy}"
}
Loading