Skip to content

Commit 238d125

Browse files
committed
pulling changes from instruqt #298
1 parent 03d1563 commit 238d125

File tree

9 files changed

+192
-66
lines changed

9 files changed

+192
-66
lines changed

instruqt-tracks/cicd-with-ansible-automation-platform-and-jenkins-on-openshift/01-aap-installation-login/assignment.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,15 @@ notes:
2121
2222
2323
tabs:
24-
- title: Terminal 1
24+
- id: 6dktihe6n0nz
25+
title: Terminal
2526
type: terminal
26-
hostname: container
27-
- title: Web Console
27+
hostname: crc
28+
- id: cde7ufdjlhxb
29+
title: Web Console
2830
type: website
29-
url: https://console-openshift-console.crc-lgph7-master-0.crc.${_SANDBOX_ID}.instruqt.io
31+
url: https://console-openshift-console.crc-rwwzd-master-0.crc.${_SANDBOX_ID}.instruqt.io
3032
new_window: true
31-
- title: Visual Editor
32-
type: code
33-
hostname: container
34-
path: /root/backend
3533
difficulty: basic
3634
timelimit: 1000
3735
---
@@ -99,7 +97,9 @@ Log in to the OpenShift Web Console using the admin account.
9997

10098
![AltText](https://github.com/redhat-developer-demos/ansible-automation-platform-continous-delivery-demo/blob/main/assets/aap_search.png?raw=true)
10199

102-
- Click on "Install."
100+
- Click on **Install**. Later on choose the version of AAP from cluster-scoped or stable.
101+
> [!NOTE]
102+
> For better compatibility choose new version of AAP
103103
104104
![AltText](https://github.com/redhat-developer-demos/ansible-automation-platform-continous-delivery-demo/blob/main/assets/aap_install_button2.png?raw=true)
105105

@@ -133,7 +133,7 @@ resource-operator-controller-manager-57b5b58667-phmlh 2/2 Runnin
133133

134134
Next, to configure Ansible Automation Platform, create an instance of **Automation Controller** from the installed operator.
135135

136-
Go to installed operators; you will find Ansible Automation Platform there. Click on it. A couple of options will appear; select **Automation Controller**, click on it, and create an Automation Controller. Give a name to the automation controller. Change "example" to **cd-ansible**.
136+
Go to installed operators; you will find Ansible Automation Platform there. Click on it. A couple of options will appear; select **Automation Controller**, click on it, and create an Automation Controller. Give a name to the automation controller. Change "example" to **ansible**.
137137

138138
Leave everything default & click on create.
139139

@@ -159,9 +159,9 @@ resource-operator-controller-manager-57b5b58667-phmlh 2/2 Runnin
159159
To access the UI of the Ansible Automation Platform, we need to run a few commands:
160160

161161
```
162-
export SA_SECRET=cd-ansible
162+
export SA_SECRET=ansible
163163
```
164-
Here, my automation controller name is **cd-ansible**. Please replace the name with your automation controller name.
164+
Here, my automation controller name is **ansible**. Please replace the name with your automation controller name.
165165

166166
```
167167
oc get route -n aap | grep $(echo ${SA_SECRET}) | awk '{print$2}'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
slug: join-red-hat-developer-portal
3+
id: esbre9m5uknh
4+
type: challenge
5+
title: Join Red Hat Developer at no cost
6+
teaser: Join Red Hat Developer at no cost
7+
tabs:
8+
- id: untdxrjwnxyg
9+
title: Red Hat Login
10+
type: browser
11+
hostname: rhd-login
12+
difficulty: ""
13+
---
14+
Before you proceed with the next challenge, please take a moment to register for Red Hat Developer. If you already have a Red Hat account, you can use the same login credentials.
15+
16+
This will help us assess user satisfaction and enable us to provide more curated content.
17+
18+
Click on the `Check` button at the bottom once you have registered or logged in.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
set -euxo pipefail
3+
echo 'logincheck'
4+
if [ "${LOGGEDIN-0}" = "1" ]; then
5+
echo 'loggedin'
6+
exit 0
7+
fi
8+
9+
rm -f /home/user/checkResult.json
10+
rm -f /home/user/checkAssets.json
11+
rm -f /home/user/checkError.txt
12+
13+
echo 'dropdown check'
14+
echo '{"location":{"conditions":[{"url":"redhat.com","condition":"contains"}]},"innerText":[{"selector":"html \u003e body","value":"Please click on Check button in the bottom right of your screen to continue with the Lab."}]}' > /home/user/checkAssets.json
15+
until [ -f /home/user/checkResult.json ]; do
16+
sleep 1
17+
done
18+
if grep "SUCCESS" /home/user/checkResult.json; then
19+
echo 'account dropdown'
20+
exit 0
21+
fi
22+
23+
rm -f /home/user/checkResult.json
24+
rm -f /home/user/checkAssets.json
25+
rm -f /home/user/checkError.txt
26+
27+
echo 'email check'
28+
echo '{"location":{"conditions":[]},"innerText":[{"selector":"html \u003e body","value":"Email address verification"}]}' > /home/user/checkAssets.json
29+
until [ -f /home/user/checkResult.json ]; do
30+
sleep 1
31+
done
32+
cat /home/user/checkResult.json
33+
if grep "SUCCESS" /home/user/checkResult.json; then
34+
echo 'email validation'
35+
exit 0
36+
fi
37+
fail-message "Please login and click 'Check' button."
38+
exit 1

instruqt-tracks/cicd-with-ansible-automation-platform-and-jenkins-on-openshift/02-aap-configure/assignment.md instruqt-tracks/cicd-with-ansible-automation-platform-and-jenkins-on-openshift/03-aap-configure/assignment.md

+27-13
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,31 @@ slug: aap-configure
33
id: b4l1xusyizyt
44
type: challenge
55
title: Step 2 - Ansible Automation Platform Configuration
6+
notes:
7+
- type: text
8+
contents: |-
9+
# Ansible Automation Platform Configuration Setup
10+
11+
After a successful installation and login to the Ansible Automation platform, we need to configure it according to our requirements. These requirements could be anything, such as multi-cloud deployment, multi-cluster deployment, or using it for continuous delivery.
12+
13+
In this scenario, we will consider the Ansible Automation platform for continuous deployment/delivery.
614
tabs:
7-
- title: Terminal 1
15+
- id: kkgap6h7rjix
16+
title: Terminal
817
type: terminal
9-
hostname: container
10-
- title: Web Console
18+
hostname: crc
19+
- id: gdg0rj2quvcl
20+
title: Web Console
1121
type: website
12-
url: https://console-openshift-console.crc-lgph7-master-0.crc.${_SANDBOX_ID}.instruqt.io
22+
url: https://console-openshift-console.crc-rwwzd-master-0.crc.${_SANDBOX_ID}.instruqt.io
1323
new_window: true
14-
- title: Visual Editor
24+
- id: tpydiidko7qw
25+
title: Code editor
1526
type: code
16-
hostname: container
17-
path: /root/backend
27+
hostname: crc
28+
path: /home
1829
difficulty: basic
19-
timelimit: 600
30+
timelimit: 1000
2031
---
2132

2233
## Ansible Automation Platform Configuration Setup
@@ -100,19 +111,19 @@ You need to extract the token and certificates using the following commands.
100111

101112
The token is collected in `containergroup-sa.token` file. You have to copy the context and paste it into AAP credentials page in `API authentication bearer token` block.
102113

114+
103115
```
104-
dnf install jq -y && oc project dev-game-app && cd backend
105-
```
106-
```
107-
oc get secret cicd -o json | jq '.data.token' | xargs | base64 --decode > containergroup-sa.token
116+
cd home && oc get secret cicd -o json | jq '.data.token' | xargs | base64 --decode > containergroup-sa.token
108117
```
109118
The certificate is collected in the `containergroup-ca.crt` file. You have to copy the context and paste it in the AAP credentials page in the `Certificate Authority data` block.
110119

111120
```
112121
oc get secret cicd -o json | jq '.data["ca.crt"]' | xargs | base64 --decode > containergroup-ca.crt
113122
```
114123

115-
Alternatively, switch to the visual-editor tab to collect the `Token` and `Certificate`.
124+
Alternatively, switch to the 3rd tab means `Code-editor` tab to collect the `Token` and `Certificate`.
125+
> [!NOTE]
126+
> If .token & .crt file is not visible then click on the refresh icon ↻
116127
117128
![AltText](https://github.com/redhat-developer-demos/ansible-automation-platform-continous-delivery-demo/blob/main/assets/aap_cred_filled.png?raw=true)
118129

@@ -151,6 +162,9 @@ After adding, you can check connectivity with OpenShift cluster by clicking on
151162
**Project**:
152163

153164
The project is an SCM of the project where all playbooks and manifests are available. With the help of the project, we need to fetch it. From the left menu, select a project and click on Add, then give a name to the project.
165+
> [!IMPORTANT]
166+
>Kindly fork the following repository into your GitHub account and provide the URL, as shown below, of your GitHub repository.
167+
154168
The Source Control Type is Git. In the Source Control URL, fill in the GitHub URL:
155169
```
156170
https://github.com/redhat-developer-demos/ansible-automation-platform-continous-delivery-demo.git

instruqt-tracks/cicd-with-ansible-automation-platform-and-jenkins-on-openshift/03-jenkins-install/assignment.md instruqt-tracks/cicd-with-ansible-automation-platform-and-jenkins-on-openshift/04-jenkins-install/assignment.md

+25-12
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,21 @@ slug: jenkins-install
33
id: nztpivixukj5
44
type: challenge
55
title: Step 3 - Jenkins Installation
6+
notes:
7+
- type: text
8+
contents: |-
9+
# Jenkins Setup
10+
In this challenge, we'll delve into the process of setting up the Jenkins pod from the developers catalog.
611
tabs:
7-
- title: Terminal 1
12+
- id: fa3ft9gtjedu
13+
title: Terminal
814
type: terminal
9-
hostname: container
10-
- title: Web Console
15+
hostname: crc
16+
- id: 5movvlgwjjsq
17+
title: Web Console
1118
type: website
12-
url: https://console-openshift-console.crc-lgph7-master-0.crc.${_SANDBOX_ID}.instruqt.io
19+
url: https://console-openshift-console.crc-rwwzd-master-0.crc.${_SANDBOX_ID}.instruqt.io
1320
new_window: true
14-
- title: Visual Editor
15-
type: code
16-
hostname: container
17-
path: /root/backend
1821
difficulty: basic
1922
timelimit: 1000
2023
---
@@ -26,9 +29,9 @@ Log in to the OpenShift dashboard. Select the Developer perspective and right-cl
2629

2730
Select Jenkins, which has extra permissions because RBAC permission is required for this task.
2831

29-
![AltText](https://github.com/redhat-developer-demos/ansible-automation-platform-continuous-delivery-demo/blob/main/assets/jenkins_catalog_search1.png?raw=true)
32+
![AltText](https://github.com/redhat-developer-demos/ansible-automation-platform-continous-delivery-demo/blob/main/assets/jenkins_catalog_search1.png?raw=true)
3033

31-
![AltText](https://github.com/redhat-developer-demos/ansible-automation-platform-continuous-delivery-demo/blob/main/assets/jenkins_install2nd.png?raw=true)
34+
![AltText](https://github.com/redhat-developer-demos/ansible-automation-platform-continous-delivery-demo/blob/main/assets/jenkins_install2nd.png?raw=true)
3235

3336
![AltText](https://github.com/redhat-developer-demos/ansible-automation-platform-continous-delivery-demo/blob/main/assets/jenkins_install3nd.png?raw=true)
3437

@@ -49,7 +52,13 @@ To enable continuous build and push, we need to create a build config here using
4952
```
5053
oc project dev-game-app
5154
```
52-
Before executing the following command, make sure you replace the image name with your container registry.
55+
> [!IMPORTANT]
56+
> If you already have an account of container registry such as Quay.io or Dockerhub, use the credentials in the following steps.
57+
> If you don't have one, kindly visit [quay.io](https://quay.io/) and create an account.
58+
59+
Before executing the following command, ensure that you replace the image with your container registry.
60+
61+
Example : `name: quay.io/nagesh-redhat/cd:latest`
5362
```
5463
cat <<EOF | oc create -f -
5564
apiVersion: build.openshift.io/v1
@@ -74,7 +83,7 @@ spec:
7483
dockerfilePath: Dockerfile
7584
EOF
7685
```
77-
Now, create a secret for image building. This secret will help the image to push to the Quay container registry. If you don't have a Quay.io container registry account, check [**here**](https://docs.quay.io/guides/create-repo.html#:~:text=via%20the%20UI-,To%20create%20a%20repository%20in%20the%20Quay.io%20UI%2C%20click,the%20'Create%20Repository'%20button.). Replace the credentials with your container registry account in the following command:
86+
Now, create a secret for image building. This secret will help the image to push to the Quay container registry. Replace the credentials with your container registry account in the following command:
7887

7988
```
8089
oc create secret docker-registry my-secret --docker-server=quay.io --docker-username=<your-container-registry-id> --docker-password=xxx
@@ -93,6 +102,9 @@ For pipeline creation, go to New Item, select Pipeline, and give a name to that
93102
Let’s configure the Continuous Integration pipeline.
94103
Scroll down in the pipeline section and select the Pipeline script from SCM.
95104

105+
> [!IMPORTANT]
106+
> Kindly provide the URL of your forked GitHub repository here.
107+
96108
SCM: Git
97109

98110
Repository URL:
@@ -107,6 +119,7 @@ Branch: `*/main`
107119
Script Path: `Jenkinsfile`
108120

109121

122+
110123
![AltText](https://github.com/redhat-developer-demos/ansible-automation-platform-continous-delivery-demo/blob/main/assets/jenkins_filled_pipe.png?raw=true)
111124

112125
When the developer commits the code in a repo, we need something in place that can detect the changes and start the pipeline. For that, we have to enable the triggers and polling for every minute.
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,26 @@ slug: integration-of-ansible-automation-platform-and-jenkins
33
id: x5clyla3ouwj
44
type: challenge
55
title: Step 4 - Integration Of Ansible Automation Platform & Jenkins
6+
notes:
7+
- type: text
8+
contents: |-
9+
# Integration of Ansible Automation Platform & Jenkins
10+
11+
We have completed the setup of the Ansible Automation platform and Jenkins continuous integration.
12+
13+
To connect the Ansible Automation platform and Jenkins, log in to the Jenkins dashboard and install the **Ansible** and **Ansible Tower** plugins from Manage Jenkins.
14+
tabs:
15+
- id: yzdotlyuopxt
16+
title: Terminal
17+
type: terminal
18+
hostname: crc
19+
- id: ybfbniumifgl
20+
title: Web Console
21+
type: website
22+
url: https://console-openshift-console.crc-rwwzd-master-0.crc.${_SANDBOX_ID}.instruqt.io
23+
new_window: true
624
difficulty: basic
7-
timelimit: 3600
25+
timelimit: 1800
826
---
927
## Integration of Ansible Automation Platform & Jenkins
1028

@@ -39,10 +57,13 @@ Select the build triggers as "Build after other projects are built."
3957
In Build Triggers, check the "Build after other projects are built" option and add the continuous integration pipeline name.
4058

4159
It's time now to see an end-to-end pipeline in action. To do that, you have to clone the GitHub repository in your favorite code editor like VScode or PyCharm.
60+
> [!IMPORTANT]
61+
> Kindly consider here the forked repository.
4262
43-
Checkout into the git folder and make some minor changes like adding "#" in any file.
63+
Checkout into the git folder and make some changes in your GitHub repository.
4464

45-
After you are done with your changes, it's time to push them to the GitHub repository using git commands:
65+
66+
After completing your changes, it's time to push them to the GitHub repository using git commands:
4667

4768
```
4869
git add .
@@ -56,7 +77,7 @@ git commit -m "my changes"
5677
git push
5778
```
5879

59-
After pushing, check the Jenkins dashboard. The Continuous Integration pipeline will start. It will build and push the container image. Later on, the Continuous Deployment pipeline will start with the help of Ansible Automation Platform, and it will deploy the pod in OpenShift cluster.
80+
After push, check the Jenkins dashboard. The Continuous Integration pipeline will start. It will build and push the container image. Later on, the Continuous Deployment pipeline will start with the help of Ansible Automation Platform, it will deploy the pod in OpenShift cluster.
6081

6182
![AltText](https://github.com/redhat-developer-demos/ansible-automation-platform-continous-delivery-demo/blob/main/assets/jenkins_cd_op.png?raw=true)
6283

instruqt-tracks/cicd-with-ansible-automation-platform-and-jenkins-on-openshift/config.yml

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
version: "3"
2-
containers:
3-
- name: container
4-
image: fedora
5-
shell: /bin/bash
2+
virtualbrowsers:
3+
- name: rhd-login
4+
url: https://developers.redhat.com/node/284339?auHash=5k9QV-yD0z-jAU7XkJyq1TUxhVyyZVLiuZz7tsfTz_s&offerid=3881844
65
virtualmachines:
76
- name: crc
8-
image: rhd-devx-instruqt/openshift-4-11-7-lgph7
9-
machine_type: n1-highmem-4
7+
image: rhd-devx-instruqt/openshift-4-12-1-rwwzd
8+
machine_type: n1-standard-8
109
allow_external_ingress:
1110
- http
1211
- https

0 commit comments

Comments
 (0)