This installer aims to produce ready to use development environment for Red Hat Container Development Kit on Windows and macOS platforms.
Build output is two platform specific executables: Online and Bundle installer. Online Installer is lightweight (approximately 50Mb) and it downloads everything during installation. Bundle Installer includes most of binary dependencies and downloads binaries that cannot be included during installation.
Both Installers are self extracting executable files made with 7-zip file archiver with a high compression ratio (7-Zip is licensed under the GNU LGPL license, more details on https://www.7zip.org).
Each Installer is a disk image (.dmg file) with macOS Application Bundle inside.
This installer is desktop application for Windows and macOS built with Electron.
To build installer follow steps below for specific platform (please note that 'browser/images' and 'resources' folders contains graphical files for product logos and icons which are the copyrighted work of Red Hat).
-
Download and install nvm for Windows from https://github.com/coreybutler/nvm-windows/. Pick the MSI installer.
-
Install nodejs using
nvm install 6.9.1
-
Download and install Python 2.7.x for Windows from https://www.python.org/downloads/release/
-
Edit your "Path" by going to the "System" Control Panel, "Advanced system settings", "Environment Variables". Add C:\Program Files\nodejs;C:\Users\<username>\App Data\Roaming\npm to the "Variable value".
Note that your system might have an "AppData" (no space) instead of "App Data" (with space) folder, so make sure you use the correct path for your system.
-
Download and install git for windows from https://github.com/git-for-windows/git/releases/tag/v2.11.0.windows.1
-
Run git bash from Windows Start Menu
-
In git bash windows clone installer repository by running
git clone https://github.com/redhat-developer-tooling/developer-platform-install.git ~/Projects/developer-platform-install
-
Then change current directory to repository root
cd ~/Projects/developer-platform-install
-
Install required dependencies with
npm install
-
Build installer executables with
npm run dist
After build is finished ./dist folder should contain Windows executable files for On-line and Bundle Installers.
-
Install git by running
git
from bash terminal and then follow the requests to install Xcode Development IDE
-
Run git again to accept the license
-
Install nvm (Nodejs Version Management) by running following shell script in bash terminal
touch ~/.bash_profile curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
then restart bash to pick up changes in your environment
-
Install nodejs using nvm command
nvm install v8.9.1
-
Clone installer repository
git clone https://github.com/redhat-developer-tooling/developer-platform-install.git ~/Projects/developer-platform-install
-
Then change current directory to repository root
cd ~/Projects/developer-platform-install
-
Install required dependencies with
npm install
-
Build installer executables with
npm run dist:mac
After build finishes ./dist folder should contain disk image files (.dmg) with macOS application packages for On-line and Bundle Installers.
-
Install git by running
sudo yum install git
from terminal
-
Install nvm (Nodejs Version Management) by running following shell script in terminal
touch ~/.bash_profile curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash
then restart bash to pick up changes in your environment
-
Install nodejs using nvm command
nvm install 6.9.1
-
Clone installer repository
git clone https://github.com/redhat-developer-tooling/developer-platform-install.git ~/Projects/developer-platform-install
-
Then change current directory to repository root
cd ~/Projects/developer-platform-install
-
Install required dependencies with
npm install
There are multiple ways how to run the installer.
-
When fixing bugs and/or creating new features, run the application using
npm start
This way, you can open Chrome developer tools using
Ctrl+Alt+I
or reload application usingCtrl+R
. -
Build a Windows binary and run it:
npm run generate dist/win/DevelopmentSuiteInstaller-win32-x64/DevelopmentSuiteInstaller.exe
-
Build a distribution Windows binary that downloads Vagrant, VirtualBox, DevStudio, etc. from the Internet (it will download about 1.6G):
npm run package-simple dist/win/DevelopmentSuiteInstaller-win32-x64-*.exe
-
Build a distribution Windows binary including almost all dependencies, except of Vagrant and VirtualBox (will download them):
npm run package-bundle dist/win/DevelopmentSuiteInstaller-win32-x64-*-bundle.exe
-
To build both installers in a single step:
npm run dist
Proxy configuration details are available in this issue #1171.
If your npm install gets corrupted (or out of date) and you can't build, you can try cleaning leftover modules by deleting all dependencies and generated configuration files and installing them again:
rm -rf node_modules/
npm cache clean
npm install -g gulp
npm install
Then build as in the examples above.
Unit tests are located in test/unit
. To run all unit tests:
npm test
To run selected unit tests, you can grep any string from describe
or it
section of any test, e.g.:
npm test -- -g login
npm test -- --grep login
To run tests from specific file --spec-file parameter can be used to override default pattern to select files to run. Parameter value can be specific file name
npm test -- --spec-file test/unit/pages/account/controller-test.js
or globe pattern
npm test -- --spec-file=test/unit/pages/**/*.js
Unit tests code coverage calculated by Istanbul. By default it generates html
and raw coverage reports. The report format can be overridden with --report
parameter like shown below
npm test -- --report cobertura
To open html coverage report in your default browser after unit tests finished use
--open-report
option
npm test -- --spec-file=test/unit/pages/**/*.js --open-report
Running unit tests one by one for each installer module
gulp unit-test-1by1
If you experience this error when running unit tests
module.js:598
return process.dlopen(module, path._makeLong(filename));
^
Error: The specified procedure could not be found.
\\?\C:\p\rh\dpi\node_modules\keytar\build\Release\keytar.node
at Object.Module._extensions..node (module.js:598:18)
install 'keytar' module using npm
npm install keytar
Add
debugger;
statement in test where you want debugger to stop after start. Set env variable NODE_PATH pointing to the project's root folder and run
node_modules\.bin\mocha.cmd --inspect --inspect-brk --compilers js:babel-core/register path/to/file-test.js
UI tests located in 'test/ui'. To run all UI tests:
npm run ui-test
UI tests use protractor 'browser' global object and Jasmine testing framework.
System tests located in the 'test/system' folder. These tests have requirements depending on the platform they are run on.
To run the tests successfully on Windows, you need to have 'Oracle Corporation' added to the list of trusted publishers (otherwise a modal dialog will interrupt the tests when installing VirtualBox). The tests need to be run by a user with administrative privileges.
When running the tests locally, use the following command:
npm run system-test -- --binary="path to a DevSuite Installer executable archive"
For CI environment a powershell script is available in 'test/system/windows/runTests.ps1':
powershell -file $devsuiteFolder/test/system/windows/runTests.ps1 -binary "path to sfx archive"
This script launches the tests with elevated privileges and copy the installation logs into the $devsuiteFolder for archivation in CI environment.
Run installer with
npm start
and then push Ctrl + Shift + I to show Chrome Developer Tools in current installer window
In windows System Properties Setting Dialog add
DSI_REJECT_UNAUTHORIZED=false
to your user environment variables. Run notepad.exe as Administrator and add
127.0.0.1 developers.redhat.com
to C:\Windows\system32\Drivers\etec\hosts file.
Then download (VPN connection required) all requirements with
gulp prefetch-all
When download finished run http and https mock servers to mock developers.redhat.com with download-manager links. In separate windows run
node gulp-tasks/http-server.js
and then
node gulp-tasks/https-server.js
Now you are ready to test online installer. Start dist/win/DevelopmentSuiteInstaller-win32-x64-*.exe from package explorer. Mock http server always returns true for authentication requests to let you pass account information page, but if you plan to install and test CDK in DevStudio use your real Red Hat user name and password from developers.rdhat.com.
In Windows System Properties Setting Dialog add
DSI_REJECT_UNAUTHORIZED=false
DM_STAGE_HOST=localhost
to your user environment variables.
Then download (VPN connection required) requirements with
gulp prefetch
When download finished run https mock servers to mimic developers.redhat.com with download-manager links. In separate windows execute
node gulp-tasks/https-server.js
Now you are ready to test online installer without actual bits published to download-manager. Start dist/win/DevelopmentSuiteInstaller-win32-x64-*.exe from package explorer and use it as you would normally do after release.
It is possible to run online installer right from your favorite terminal on windows or macOS.
On Windows if you running from cmd, powershell or git bash console and going to install components that is MSI installers please be sure you started console as Administrator. That is required because installer starts MSI installers in non-interactive mode and they will fail to run without Administrative privileges.
On macOS, installer may request administrative account credentials to continue. So you can run from any bash instance and installer will show request for account with rights to administer current machine.
If you are developer set DSI_TEST_AGENT to be any truthy string value to get original user agent string replaced with modified one to avoid interference with real installer usage stats.
If you are developing UI and do not really needed to install anything, you can go though all the steps
quickly using --skip-install
option when running installer with npm.
npm start -- --skip-install
Most of dependencies declared with exact version. That is required to get reproducible build results. To move declared dependencies to latest available versions run command below, unit tests, UI tests, dist build and then send regular github.com pull request.
npm run update-deps