Contributing encompasses repository specific requirements and the global Insights guidelines.
Before developing you'll need to install:
- NodeJS and NPM
- Docker
- And Yarn
A large percentage of front-end tooling is Mac OSX
centered, the tooling for Curiosity falls into this category.
While some aspects of the tooling have been expanded for Linux there may still be issues. It is encouraged that OS tooling
changes are contributed back while maintaining existing Mac OSX
functionality.
If you are unable to test additional OS support it is imperative that code reviews take place before integrating/merging build changes.
Setting Docker up on a Mac? Install the appropriate package and you should be good to go. To check if everything installed correctly you can try these steps.
-
At a terminal prompt type
$ docker run hello-world
Setting Docker up on a Linux machine can include an additional convenience step. If you're having to prefix "sudo" in front of your Docker commands you can try these steps.
Once you've installed NodeJS you can use NPM to perform the Yarn install
$ npm install yarn -g
You can also use Homebrew
$ brew update
$ brew install yarn
In an effort to continue enhancing future automation around CHANGELOG.md and tagging we make use of Standard Version and Conventional Commits.
It's required that commit messaging follow the format
<type>[optional scope]: <issue number><description>
For Jira issues that looks like
<type>[optional scope]: ent-123 <description>
For Github issues that looks like
<type>[optional scope]: issues/123 <description>
Settings for Standard Version can be found in package.json
Curiosity makes use of the branches main
, stage
, qa
, and ci
.
main
branch is a protected representation of production environments- Adding commits, or a PR, into
main
should generate aprod-stable
branch within the deploy repository curiosity-frontend-build - The
prod-stable
branch is manually deployed through coordination with the operations team.
- Adding commits, or a PR, into
stage
branch is a protected representation of production environments- Adding commits, or a PR, into
stage
should generate aprod-beta
branch within the deploy repository curiosity-frontend-build - The
prod-beta
branch is manually deployed through coordination with the operations team.
- Adding commits, or a PR, into
qa
branch is a representation ofci-stable
,qa-stable
andstage-stable
.- Adding commits, or a PR, into
ci-stable
should generateci-*
andqa-*
branches within the deploy repository curiosity-frontend-build - The
ci-*
andqa-*
branches are automatically deployed within an averaged time forhttps://ci.*.redhat.com
,https://qa.*.redhat.com
andhttps://*.stage.redhat.com
- In the future, once the API is fully deployed to QA, this will be a representation of
qa-beta
andqa-stable
- Adding commits, or a PR, into
ci
branch is a representation ofci-beta
,qa-beta
andstage-beta
.- Adding commits, or a PR, into
ci-beta
should generateci-*
andqa-*
branches within the deploy repository curiosity-frontend-build - The
ci-*
andqa-*
branches are automatically deployed within an averaged time forhttps://ci.*.redhat.com
,https://qa.*.redhat.com
andhttps://*.stage.redhat.com
- In the future, once the API is fully deployed to QA, this will be a representation of
ci-beta
andci-stable
- Adding commits, or a PR, into
It is required that all work is handled through GitHub's fork and pull workflow.
Working directly on the main repository is highly discouraged. Continuous Integration is dependent on branch structure.
- General development PRs should almost always be opened against the
ci
branch. - It is preferred that PRs to
qa
originate fromci
, but testing related fixes and general PRs opened againstqa
are allowed. 1 PRs fromci
toqa
are allowed - PRs from
qa
tostage
are preferred. - PRs to
stage
require a QE team members approval/sign-off. - PRs to
main
are only allowed fromstage
. - PRs to
main
branch are considered production ready releases. - Development or testing PRs opened against main, unless a team agreed exception occurs, will be closed.
- All PRs to production, main branch, should have a final review, coordination, from Quality Engineering.
PR fork -> ci <-> qa -> stage -> main
- Merging a PR into
main
is considered production ready. - Merging a PR into
main
doesn't require tagging and CHANGELOG.md updates. - Running
$ yarn release
after commits are merged intomain
generates the release commit and CHANGELOG.md. You may need to update/pull tags prior to running this command. This commit should be pushed towardsmain
. This release commit is currently used as a purposeful block and may be automated in the future. The commit message is recognized in the release script. This commit format controls when files are pushed towards production stable, and gives development a fallback when something goes wrong. - Tagging and
CHANGELOG.md
updates should be coordinated against a consistent release cycle, and can take place at an independent time. - Tagging should make use of semver.
- Manipulating tags against commits directly should be avoided in favor of a semantic version increment, iteration.
- Once a release commit and tag have been implemented
stage
,qa
, andci
will be rebased accordingly.
To serve content you'll need to have Docker, Node, and Yarn installed.
Serving content comes in 3 variations
-
$ yarn start
, Styled local run, without the Insights proxy, using a mock server.- You'll be presented with a login, you can attempt to login with user
admin
passwordadmin
as the credentials. However, the up-to-date credentials are maintained here, RH Cloud Services Config standalone - By default
local
run uses theprod-stable
branch of the Insights chroming repo (see the repo for additional branches). You can run a branch of your choice by either running the terminal commandor by placing the parameter in a$ export DEV_BRANCH=ci-beta; yarn start
.env.local
dotenv file in the root directory of the project (you can use .env.development and .env.proxy as examples)DEV_BRANCH=ci-beta
- Terminal messaging should indicate the path at which the app can be opened, you may need to scroll up.
- You'll be presented with a login, you can attempt to login with user
-
$ yarn start:proxy
, Styled local using the Insights proxy.- This requires access in order to be used. In addition, you may be asked for your credentials during initial repository setup. The credentials are used to modify your
hosts
for local run. - By default
proxy
run uses theci-stable
branch of the Insights chroming repo (see the repo for additional branches). You can run a branch of your choice by either running the terminal commandor by placing the parameter in a$ export DEV_BRANCH=ci-beta; yarn start:proxy
.env.local
dotenv file in the root directory of the project (you can use .env.development and .env.proxy as examples)DEV_BRANCH=ci-beta
- Terminal messaging should indicate the path at which the app can be opened, you may need to scroll up.
- This requires access in order to be used. In addition, you may be asked for your credentials during initial repository setup. The credentials are used to modify your
Occasionally the proxy setup will attempt to connect, acknowledge that it's connected, but then fail to load the GUI. Things to try:
- Stop the build
- Restart Docker
- Run the build again,
$ yarn start:proxy
- Stop the build
- Confirm you're logged in, connect if necessary
- Run the build again,
$ yarn start:proxy
- Determine if you recently ran any command that used
$ export DEV_[something]; yarn [some-command]
. - Stop the build
- Unset that
exported
value by running$ unset DEV_[something]
- Run the build again,
$ yarn start:proxy
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.
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
This project makes use of reserved CSS class prefixes used by external resources.
Updating elements with these classes should be done with the knowledge "you are affecting an external resource in a potentially unanticipated way".
-
Prefix
uxui-
CSS classes with the prefix
uxui-
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.
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.
-
Attribute
data-test
DOM attributes with
data-test=""
are used by QE as a means to identify specific DOM elements.
A low level Spandx config is being used within the proxy config local run. It follows the same guidelines as the original Spandx config, but is now integrated with dotenv parameters.
This proxy route file still has multiple team and build dependencies. Before relocating/moving this file(s) the appropriate teams should be informed.
- Development team
- QE team
There is a related integration test snapshot(s) of this proxy route file, ./tests/platform.test.js
that may need updating if the file is altered.
To test content you'll need to have Node and Yarn installed.
You may want to confirm what exactly gets output from the build, run the build with analyze
$ export DEV_ANALYZE=true; yarn build
Updates that drop coverage below the current threshold will need to have their coverage expanded accordingly before being merged.
Settings for the Jest aspect of code coverage can be found in jest.config.js. Settings for the CI reporting level of code coverage can be found in .codecov.yml.
You can access basic dotenv config values via a global window object unique to the application. You'll need to access the GUI through a browser, open the development console and type
curiosity
or
window.curiosity
This should expose a quick grouping of string values (along with a few superfluous helper functions) enabling you to identify things such as the release version
.
The name of the window value can be found under the dotenv file .env
REACT_APP_UI_LOGGER_ID=curiosity
You can apply overrides during local development by adding a .env.local
(dotenv) file in the repository root directory.
Once you have made the dotenv file and/or changes, like the below "debug" flags, restart the project and the flags should be active.
Any changes you make to the .env.local
file should be ignored with .gitignore
.
The default context for starting local development runs with the command
$ yarn start
This default comes with a caveat, it uses mock API data.
You can apply a date override during local development (using $ yarn start
) by adding the following line to your .env.local
file.
REACT_APP_DEBUG_DEFAULT_DATETIME=20190630
You can access the administrator role experience during local development (using $ yarn start
) by adding the following line to your .env.local
file.
REACT_APP_DEBUG_ORG_ADMIN=true
Combining this flag with manipulating the http status on the API/service mocks can be an effective emulation.
You can access different levels of user permissions during local development (using $ yarn start
) by adding the following lines to your .env.local
file.
REACT_APP_DEBUG_PERMISSION_APP_ONE=subscriptions:*:*
REACT_APP_DEBUG_PERMISSION_APP_TWO=inventory:*:*
As additional resource and operation checks are implemented these values should be altered accordingly.
Combining these flags with manipulating the http status on the API/service mocks can be an effective emulation.
This project makes use of React & Redux. To enable Redux browser console logging add the following line to your .env.local
file.
REACT_APP_DEBUG_MIDDLEWARE=true
To run the unit tests with a watch during development you'll need to open an additional terminal instance, then run
$ yarn test:dev
To update snapshots from the terminal run
$ yarn test:dev
From there you'll be presented with a few choices, one of them is "update", you can then hit the "u" key. Once the update script has run you should see additional changed files within Git, make sure to commit them along with your changes or testing will fail.
To check the coverage report from the terminal run
$ yarn test
If you're having trouble getting an accurate code coverage report, or it's failing to provide updated results (i.e. you renamed files) you can try running
$ yarn test:clearCache
- Confirm you've installed all recommended tooling
- Confirm the repository name has no blank spaces in it. If it does replace that blank with a dash or underscore, Docker has issues with unescaped parameter strings.
- Confirm you've installed resources through yarn
- Create a local dotenv file called
.env.local
and add the following contentsREACT_APP_DEBUG_MIDDLEWARE=true
- Confirm you have access to the network
- Make sure Docker is running
- Open a couple of instances of Terminal and run...
and, optionally,
$ yarn start:proxy
$ yarn test:dev
- Make sure your browser opened around the domain
https://*.foo.redhat.com/
- Start developing...
- Confirm you've installed all recommended tooling
- Confirm the repository name has no blank spaces in it. If it does replace that blank with a dash or underscore, Docker has issues with unescaped parameter strings.
- Confirm you've installed resources through yarn
- Create a local dotenv file called
.env.local
and add the following contentsREACT_APP_DEBUG_MIDDLEWARE=true REACT_APP_DEBUG_ORG_ADMIN=true REACT_APP_DEBUG_PERMISSION_APP_ONE=subscriptions:*:* REACT_APP_DEBUG_PERMISSION_APP_TWO=inventory:*:*
- Open a couple of instances of Terminal and run...
and, optionally,
$ yarn start
$ yarn test:dev
- Make sure your browser opened around the domain
https://localhost:3000/
- Start developing...