donal
2018-05-16 45eb81146e23389c2ba56eff999278de2a9eb0e2
FIXES from Lab2
1 files added
6 files modified
55 ■■■■■ changed files
1-the-manual-menace/README.md 10 ●●●●● patch | view | raw | blame | history
2-attack-of-the-pipelines/README.md 27 ●●●●● patch | view | raw | blame | history
3-revenge-of-the-automated-testing/README.md 6 ●●●● patch | view | raw | blame | history
4-an-enslaved-hope/README.md 8 ●●●● patch | view | raw | blame | history
5-non-functionals-strike-back/README.md 4 ●●●● patch | view | raw | blame | history
images/exercise2/fe-dev-config.png patch | view | raw | blame | history
images/exercise2/fe-test-config.png patch | view | raw | blame | history
1-the-manual-menace/README.md
@@ -31,10 +31,8 @@
* [OpenShift Applier](https://github.com/redhat-cop/openshift-applier) - used to apply OpenShift objects to an OpenShift Cluster.
## Big Picture
This exercise begins with an empty Cluster
> TODO - add big picture here...
> The Big Picture is our emerging architecture; starting with an empty cluser we populate it with projects and some ci/cd tooling.
![ds-messing-around.gif](../images/exercise1/ds-messing-around.gif)
@@ -66,9 +64,9 @@
### Part 1 - Create OpenShift Projects
> _Using the OpenShift Applier, we will add new project namespaces to the cluster which will be used throughout the exercise._
3. In this course three different git projects will be used. To setup your local machine for each of these, create a new folder on the terminal in the root of your HOME directory. To do this, open a new Terminal session and create the new folder using the following command (new terminal sessions will start in your HOME dir).
3. In this course three different git projects will be created. To setup your local machine for each of these, create a new folder on the terminal in the root of your HOME directory for convenience. To do this, open a new Terminal session and create the new folder using the following command (new terminal sessions will start in your HOME dir).
```bash
mkdir -p innovation-labs && cd innovation-labs
mkdir -p ~/innovation-labs && cd ~/innovation-labs
```
<p class="tip">
NOTE - If you do not want to have this folder at the root of your home dir that's fine, just ensure any parent directories of this `innovation-labs` folder do NOT have any spaces in them as it breaks Ansible in later labs...
@@ -308,7 +306,7 @@
git config --global user.name "Your Name"
```
4. Commit your local project to this new remote by first removing the existing origin (github) where the the project was cloned from. Remember to substitute `<GIT_URL>` accordingly
4. Commit your local project to this new remote by first removing the existing origin (github) where the the project was cloned from. Remember to substitute `<GIT_URL>` accordingly with the one created for your `enablement-ci-cd` repository a moment ago.
```bash
git remote set-url origin <GIT_URL>
```
2-attack-of-the-pipelines/README.md
@@ -79,7 +79,7 @@
#### 1a Todolist-fe
2. Git clone the `todolist-fe` project to somewhere sensible and checkout the `develop` branch.
2. Git clone the `todolist-fe` project to somewhere sensible and checkout the `develop` branch using the following.
```bash
cd ~/innovation-labs
```
@@ -179,10 +179,15 @@
    * `./src/scss` contains custom  SCSS used in the application.
    * `./*.js` is mostly config files for running and managing the app and the tests
2. To prepare Nexus to host the binaries created by the frontend and backend builds we need to run a prepare-nexus script. Before we do this we need to export some variables change `<YOUR_NAME>` and `somedomain` accordingly.
2. To prepare Nexus to host the binaries created by the frontend and backend builds we need to run a prepare-nexus script. Before we do this we need to export some variables and change `<YOUR_NAME>` accordingly in the below commands.
```bash
export NEXUS_SERVICE_HOST=$(oc get route nexus --template='{{.spec.host}}' -n <YOUR_NAME>-ci-cd)
```
```bash
export NEXUS_SERVICE_PORT=80
```
```bash
```
npm run prepare-nexus
```
<p class="tip">
@@ -325,7 +330,7 @@
git checkout exercise2/jenkins-slave docker/ templates/ params/jenkins-slave-npm
```
3. Open the `params/jenkins-slave-npm` file and update `<GIT_URL>` accordingly. This set of parameters will clone from the enablement repo and run a docker build of the Dockerfile stored in `docker/jenkins-slave-npm`.
3. Open the `params/jenkins-slave-npm` file and update `<GIT_URL>` accordingly. The `<GIT_URL>` is the full path of the repository where this project is stored (including the https && .git) eg `https://gitlab.apps.lader.rht-labs.com/<YOUR_NAME>/enablement-ci-cd.git`. This set of parameters will clone from the enablement repo and run a docker build of the Dockerfile stored in `docker/jenkins-slave-npm`.
```bash
SOURCE_REPOSITORY_URL=<GIT_URL>
SOURCE_CONTEXT_DIR=docker/jenkins-slave-npm
@@ -434,7 +439,7 @@
git push
```
4. Back on your terminal navigate to the root of the `todolist-api` application. Open the `.openshift-applier` directory. The same layout as seen in `todolist-fe` should be visible with one noticeable difference; the api requires `MongoDB` to connect to at runtime.
4. Back on your terminal navigate to the root of the `todolist-api` application. Open the `.openshift-applier` directory in your editor. The same layout as seen in `todolist-fe` should be visible with one noticeable difference; the api requires `MongoDB` to connect to at runtime.
4. In the `apply.yml` update the namespace `<YOUR_NAME>` variables accordingly. For example:
```yaml
@@ -634,10 +639,14 @@
5. With our Jenkins setup in place; now move to our `todolist-fe` app's source code. We have to add our configuration to the frontend to tell it where the API layer will be hosted. Open the source in your favourite editor and navigate to `src/config/dev.js`.
5. Update `<YOUR_NAME>` accordingly with the route where the Todo List API will live when it is deployed, update the `somedomain` to the clusters domain. The correct full URL can also be found on the OpenShift Console; if you copy it from there remember to append `/api/todos` to the URL. For example:
5. Update `<YOUR_NAME>` accordingly with the route where the Todo List API will live when it is deployed. The correct full URL can also be found on the OpenShift Console; if you copy it from there remember to append `/api/todos` to the URL. For example:
![fe-dev-config](../images/exercise2/fe-dev-config.png)
5. Repeat this for `src/config/test.js` file. If you copy the URL from the previous step; change `dev` to `test`. Once done; commit your chanages and push them to GitLab
5. Repeat this for `src/config/test.js` file. If you copy the URL from the previous step; change `dev` to `test`.
For example:
![fe-test-config](../images/exercise2/fe-test-config.png)
5. With the config in place; commit your chanages and push them to GitLab:
```bash
git add .
```
@@ -660,8 +669,8 @@
5. You should now see the pipeline view. Run the pipeline by hitting run (you can move onto the next part while it is running as it may take some time).
![dev-pipeline-view](../images/exercise2/dev-pipeline-view.jpeg)
### Part 5 - Backend Pipeline
> In this exercise we will use the Jobs created for the `todolist-fe` as a template to create a pipeline for the `todolist-api` app by copying the config.
### Part 5 - (Optional) Backend Pipeline
> In this exercise we will use the Jobs created for the `todolist-fe` as a template to create a pipeline for the `todolist-api` app by copying the config. The backend pipeline as code will be explored in the next lab
6. On Jenkins home; create a new job for our backend build called `dev-todolist-api-build`. Use the `Copy from` section to copy all the configuration from the `dev-todolist-fe-build`.
![copy-fe-build](../images/exercise2/copy-fe-build.png)
@@ -708,7 +717,7 @@
6.  When `dev-todolist-api-build` has completed we should see the sample data has changed on refresh.
![with-backend-app](../images/exercise2/with-backend-app.png)
### Part 6 - GitLab Webhooks
### Part 6 - (Optional) GitLab Webhooks
> _In this exercise we will link GitLab to Jenkins so that new build jobs are triggered on each push to the `develop` branch._
<p class="tip" >
3-revenge-of-the-automated-testing/README.md
@@ -119,7 +119,7 @@
npm run test
```
2. Navigate to your instance of jenkins at `https://jenkins-<YOUR_NAME>-ci-cd.apps.somedomain.com/`.
2. Navigate to your instance of jenkins at `https://jenkins-<YOUR_NAME>-ci-cd.apps.lader.rht-labs.com/`.
Click on `dev-todolist-fe-build` and then click the `configure` button on the left-hand side.
![jenkins-configure-job](../images/exercise3/jenkins-configure-job.png)
@@ -250,9 +250,9 @@
2. Set `Color ANSI Console Output` on the `Build Environment` section
2. On the Build section; add a build step to execute shell and fill in the following substituting `<YOUR_NAME>` and `somedomain` accordingly:
2. On the Build section; add a build step to execute shell and fill in the following substituting `<YOUR_NAME>` accordingly:
```bash
export E2E_TEST_ROUTE=todolist-fe-<YOUR_NAME>-dev.apps.somedomain.com
export E2E_TEST_ROUTE=todolist-fe-<YOUR_NAME>-dev.apps.lader.rht-labs.com
npm install
npm run e2e:ci
```
4-an-enslaved-hope/README.md
@@ -97,7 +97,7 @@
2. On the job's configure page; set the Branch Sources to `git`
![multibranch-select-git](../images/exercise4/multibranch-select-git.png)
2. Fill in the Git settings with your `todolist-api` GitLab url and set the credentials as you've done before. `https://gitlab.apps.<SOMEDOMAIN>.com/<YOUR_NAME>/todolist-api.git`
2. Fill in the Git settings with your `todolist-api` GitLab url and set the credentials as you've done before. `https://gitlab.apps.lader.rht-labs.com/<YOUR_NAME>/todolist-api.git`
![multibranch-git](../images/exercise4/multibranch-git.png)
2. Set the `Scan Multibranch Pipeline Triggers` to be periodic and the interval to 1 minute. This will poll the gitlab instance for new branches or change sets to build.
@@ -322,7 +322,7 @@
     -e "filter_tags=zap"
```
3. Head to (https://console.somedomain.com/console/project/<YOUR_NAME>-ci-cd/browse/builds) on Openshift and you should see `jenkins-slave-zap`.
3. Head to https://console.lader.rht-labs.com on Openshift and move to your ci-cd project > builds. You should see `jenkins-slave-zap` has been built.
![zap-build](../images/exercise4/zap-build.png)
#### 3b - Arachni Scan
@@ -370,8 +370,8 @@
     -e "filter_tags=arachni"
```
3. Head to (https://console.somedomain.com/console/project/<YOUR_NAME>-ci-cd/browse/builds) on Openshift and you should see `jenkins-slave-arachni`.
![todolist-fe-multi](../images/exercise4/builds-zap-arachni.png)
3. Head to https://console.lader.rht-labs.com on Openshift and move to your ci-cd project > builds. You should see  `jenkins-slave-arachni`.
![builds-zap-arachni](../images/exercise4/builds-zap-arachni.png)
_____
5-non-functionals-strike-back/README.md
@@ -292,9 +292,9 @@
4. Set the `Color ANSI Console Output` on the Build Environment section.
4. Click `add build step` and select `execute shell` and add the following to it, replacing `<YOUR_NAME>` and `somedomain` as expected. We will just test the `create` and `show` API for the moment. We are grabbing the response code of the perf-test to keep Jenkins running both shells steps and then exiting with whichever fails:
4. Click `add build step` and select `execute shell` and add the following to it, replacing `<YOUR_NAME>` as expected. We will just test the `create` and `show` API for the moment. We are grabbing the response code of the perf-test to keep Jenkins running both shells steps and then exiting with whichever fails:
```bash
export E2E_TEST_ROUTE=todolist-api-<YOUR_NAME>-dev.apps.somedomain.com
export E2E_TEST_ROUTE=todolist-api-<YOUR_NAME>-dev.apps.lader.rht-labs.com
npm install
set +e
npm run perf-test:create
images/exercise2/fe-dev-config.png

images/exercise2/fe-test-config.png