donal
2018-04-24 e23af1b6c23ffae00b7377d7d3a92b2f8b62425e
FIX - from guys doing lab 1
4 files modified
50 ■■■■■ changed files
0-rogue-cluster/README.md 5 ●●●● patch | view | raw | blame | history
1-the-manual-menace/README.md 34 ●●●●● patch | view | raw | blame | history
2-attack-of-the-pipelines/README.md 9 ●●●● patch | view | raw | blame | history
README.md 2 ●●● patch | view | raw | blame | history
0-rogue-cluster/README.md
@@ -16,12 +16,9 @@
 - Redis requires 512Mi of storage
 - Nexus requires
## Cluster Access 
 - Learners are in LDAP and can access cluster via `oc login`
 - Learners have access to LDAP bind credentials to be able to auth against gitlab 
 -
 
## User privileges 
 - Learners will require privileges to run SCC containers ie GitLab
 -
 - Learners will require privileges to run SCC containers ie GitLab
1-the-manual-menace/README.md
@@ -43,9 +43,11 @@
If you're feeling confident and don't want to follow the step-by-step guide these highlevel instructions should provide a challenge for you:
2. Clone the repo `https://github.com/rht-labs/enablement-ci-cd` which contains the scaffold of the project.
2. Clone the repo `https://github.com/rht-labs/enablement-ci-cd` which contains the scaffold of the project. Ensure you get all remote branches.
2. Create `<your-name>-ci-cd`, `<your-name>-dev` and `<your-name>-test` project namespaces using the inventory and run them with the OpenShift Applier to populate the cluster
2. Use the templates provided to create build of the jenkins-s2i. The templates are in `exercise1/jenkins-s2i`
2. Use the templates provided to create build and deployment configs in `<your-name>-ci-cd` for. Templates are on a branch called `exercise1/git-nexus` && `exercise1/jenkins`:
    * Nexus
@@ -100,7 +102,7 @@
 * `requirements.yml` is a manifest which contains the ansible modules needed to run the playbook
 * `apply.yml` is a playbook that sets up some variables and runs the OpenShift Applier role.
3. Open the `apply.yml` file in the root of the project. Update the namespace variables by replacing the `<YOUR_NAME>` with your name or initials. For example; my name is Dónal so I've created:
3. Open the `apply.yml` file in the root of the project. Update the namespace variables by replacing the `<YOUR_NAME>` with your name or initials. Don't use uppercase or special characters. For example; my name is Dónal so I've created:
```yaml
  hosts: "{{ target }}"
  vars:
@@ -120,6 +122,9 @@
3. Let's add two more param files to pass to our template to be able to create a `dev` and `test` project.
  * Create another two params files `params/project-requests-dev` & `params/project-requests-test`. 
```bash
$ touch params/project-requests-dev params/project-requests-test
```
  * Add to `params/project-requests-dev` the following; substituting `<YOUR_NAME>` accordingly
```
NAMESPACE=<YOUR_NAME>-dev
@@ -283,9 +288,9 @@
Note - we would not normally make the project under your name but create an group and add the project there on residency but for simplicity of the exercise we'll do that here
</p>
4. Commit your local project to this new origin by first removing the existing origin (github) where the the project was cloned from. Remember to substitute `<YOUR_NEW_GIT_PROJECT>` accordingly
4. Commit your local project to this new origin by first removing the existing origin (github) where the the project was cloned from. Remember to substitute `<GIT_URL>` accordingly
```bash
$ git remote set-url origin <YOUR_NEW_GIT_PROJECT>
$ git remote set-url origin <GIT_URL>
$ git add . 
$ git commit -m "Adding git and nexus config"
$ git push -u origin --all
@@ -369,23 +374,21 @@
5. Open `params/jenkins-s2i` and add the following content; replacing variables as appropriate. 
```
SOURCE_REPOSITORY_URL=<YOUR_ENABLEMENT_REPO>
SOURCE_REPOSITORY_URL=<GIT_URL>
NAME=jenkins
SOURCE_REPOSITORY_CONTEXT_DIR=jenkins-s2i
IMAGE_STREAM_NAMESPACE=<YOUR_NAME>-ci-cd
SOURCE_REPOSITORY_USERNAME=<BASE64_YOUR_LDAP_USERNAME>
SOURCE_REPOSITORY_PASSWORD=<BASE64_YOUR_LDAP_PASSWORD>
SOURCE_REPOSITORY_USERNAME=<YOUR_LDAP_USERNAME>
SOURCE_REPOSITORY_PASSWORD=<YOUR_LDAP_PASSWORD>
```
where 
    * `<YOUR_ENABLEMENT_REPO>` is the full path clone path of the repo where this project is stored (including the https && .git)
    * `<GIT_URL>` is the full path clone path of the repo where this project is stored (including the https && .git)
    * `<YOUR_NAME>` is the prefix for your `-ci-cd` project.
    * Explore some of the other parameters in `templates/jenkins-s2i.yml`
    * `<BASE64_YOUR_LDAP_USERNAME>` is the base64encoded username builder pod will use to login and clone the repo with
    * `<BASE64_YOUR_LDAP_PASSWORD>` is the base64encoded password the builder pod will use to authenticate and clone the repo using
You can use `echo -n '<YOUR_LDAP_PASSWORD>' | openssl base64` to encode your username and password accordingly. For example 'password' base64 encoded will look like `cGFzc3dvcmQ=`.
![base64-pass](../images/exercise1/base64-pass.png)
    * `<YOUR_LDAP_USERNAME>` is the username builder pod will use to login and clone the repo with
    * `<YOUR_LDAP_PASSWORD>` is the password the builder pod will use to authenticate and clone the repo using
<p class="tip">
Note in a residency we would not use your GitCredentials for pushing and pulling from Git, A service user would be created for this.
Note in a residency we would not use your GitCredentials for pushing and pulling from Git, A service user would be created or a token generated.
</p>
5. Create a new object `ci-cd-builds` in the ansible `inventory/host_vars/ci-cd-tooling.yml` to drive the s2i build configuration.
@@ -449,6 +452,11 @@
$ oc delete project <YOUR_NAME>-test
```
7. Check to see the projects that were marked for deletion are removed.
```bash
$ oc get projects | egrep '<YOUR_NAME>-ci-cd|<YOUR_NAME>-dev|<YOUR_NAME>-test'
```
7. Re-apply the inventory to re-create it all!
```bash
$ oc login -p <password> -u <user> <cluster_url>
2-attack-of-the-pipelines/README.md
@@ -313,7 +313,7 @@
3. In order for Jenkins to be able to run `npm` builds and installs as we have done locally, we must configure a `jenkins-build-slave` for Jenkins to use. This slave will be dynamically provisioned when we run a build. It needs to have NodeJS and npm installed in it. In your `enablement-cd-cd` repository, checkout the template and configuration. This will bring in the template, the params & the `Dockerfile`.
```bash
$ git checkout exercise2/jenkins-slave docker/ templates/ params/
$ git checkout exercise2/jenkins-slave docker/ templates/ params/jenkins-slave-npm
```
3. Open the `params/jenkins-slave-npm` file and update `<YOUR_ENABLEMENT_GIT_REPO>` 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`.
@@ -334,6 +334,13 @@
```
![jenkins-slave-ansible](../images/exercise2/jenkins-slave-ansible.png)
3. Commit your changes to the `enablement-ci-cd` repository!
```bash
$ git add .
$ git commit -m "ADD npm slave node for Jenkins"
$ git push
```
3. Run the OpenShift Applier to trigger a build of this jenkins slave image.
```bash
$ ansible-playbook apply.yml -e target=tools \
README.md
@@ -11,7 +11,7 @@
 - NodeJS v8.x
 - Git Installed
 - Google Chrome Web Browser (>59)
 - Docker 17.x
 - Docker latest
 - Access to an OpenShift cluster `oc login -u <username> -p <password> <cluster_url>`
 - Text editor such as Atom, IntelliJ or Visual Studio Code (The exercise were created using VSCode, so the screenshots will match it's layout and colour schemes)