Skip to content

Commit

Permalink
chore: update deploying an application section
Browse files Browse the repository at this point in the history
  • Loading branch information
evanshortiss committed May 16, 2023
1 parent d3d8800 commit 78a9b51
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/modules/m5-ci-cd/pages/cd.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ You can use the *Refresh* button in Argo CD to force it to check the Git reposit

image:ex8.argo-post-merge.png[]

Once your new commit has been synchronised by Argo CD, your meme will be available to view. Follow the steps from the *Test the Containerised Application* to find the URL for your application. Refresh the page a few times and your meme will eventually be shown, all with zero downtime or manual processes beyond approving a pull request!
Once your new commit has been synchronised by Argo CD, your meme can be displayed by visiting your application's URL. Refresh the page a few times and your meme will eventually be shown, all with zero downtime or manual processes beyond approving a pull request!

You can further confirm that the new ConfigMap has been synchronised by:

Expand Down
16 changes: 11 additions & 5 deletions docs/modules/m5-ci-cd/pages/ci.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,33 @@ Nice work on getting the application deployed on OpenShift! Now you'll make a ch
. Once the GitHub IDE has loaded:
* Click the branch name (`main` by default) in the bottom left.
* Select *Create new branch* in the popup that appears.
* Enter the branch name `new-meme` and press the enter key.
* Enter the follwoing branch name and press the enter key:
+
[.console-input]
[source,text]
----
new-meme
----
* Click the green *Switch to branch* button when promoted.
. Use the following image as a guide for completing the prior steps:
+
image:ex8.gh-new-branch.png[]
. Add a new image to the _k8s/overlays/development/config-map.yaml_ file. You can use the URL of any image that you like.
+
[NOTE]
[IMPORTANT]
====
The URL of the image must resolve to an image file, and not a page that contains the image. If the URL ends in an extension such as `.png` or `.jpg` then it'll likely resolve directly to an image.
====
. Select the *Source Control* view from the side-menu.
. Enter a commit message and push your change.
. Enter a commit message and push your change using the *Commit & Push* button.
+
image:ex8.gh-diff-commit.png[]

This new branch can be used to create a pull request. Creating the pull request will invoke a CI process, after which the code change can be merged to the `main` branch.

[NOTE]
====
It's common to use a https://trunkbaseddevelopment.com/[trunk-based development model] with Argo CD. That's why your pull request targets the `main` branch, and not a `development` or `staging` branch. The _k8s/overlays_ directory contains a unique configuration for each environment. Since the application is containerised, each of the _k8s/overlays_ (i.e environments) can be updated to point to a specific container image tag etc.
It's common to use a https://trunkbaseddevelopment.com/[trunk-based development model] with Argo CD. That's why your pull request will target the `main` branch, and not a `development` or `staging` branch. The _k8s/overlays_ directory contains a unique configuration for each environment. Since the application is containerised, each of the _k8s/overlays_ (i.e environments) can be updated to point to a specific container image tag. This alleviates the need to have branches with varying configurations that result in tedious Git merges at a later point in time.
====

. Return to *your copy* of the https://github.com/evanshortiss/rht-summit-2023-sample-application[random-meme application repository].
Expand All @@ -37,9 +43,9 @@ image:ex8.gh-pr-notice.png[]
. Click on the *Compare & pull request* button.
. On the *Open a pull request* screen, scroll down and click the *Create pull request* button.
. Approve the pending checks if prompted, then wait for them to complete.
. Do not merge the pull request yet!
+
image:ex8.gh-pr-open.png[]
. Do not merge the pull request yet.


If the CI check fails, it most likely means that a URL you added to the ConfigMap doesn't resolve to an image or there's a syntax error in the JSON array in the ConfigMap. Make sure that your chosen URL returns an image and *not a page that contains an image* since that will fail the CI check. Another thing to be aware of is to make sure the image URL in the ConfigMap is surrounded by quotes, and that you haven't misplaced a comma.
Expand Down
9 changes: 5 additions & 4 deletions docs/modules/m5-ci-cd/pages/deploy.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,15 @@ image:ex8.gh-use-template.png[]
rht-summit-2023-sample-application
----
. Navigate to the Argo CD dashboard.
. Click the *New App* button.
. Click the *New App* button. An overlay will appear.
. Switch to the YAML editor in the overlay using the *Edit as YAML* button.
. Fill in the form with the following information:
* Application Name: `random-meme-dev`
* Application Name: `random-meme-dev` (Using any other value will result in an error. Feel free to try a different value to see what happens!)
* Project: `project-foo-dev`
* Sync Policy: `Automatic`
* Prune Resources: `Enabled`
* Self Heal: `Enabled`
* Repository URL: `https://github.com/%USERID%/rht-summit-2023-sample-application` (use your repository's URL!)
* Repository URL: `https://github.com/%USERID%/rht-summit-2023-sample-application`
* Path: `k8s/overlays/development`
* Cluster URL: `https://kubernetes.default.svc`
* Namespace: `project-memes-dev` (Using any other value will result in an error. Feel free to try a different value to see what happens!)
Expand All @@ -68,7 +69,7 @@ rht-summit-2023-sample-application
image:ex8.argocd-application-yaml.png[]
. Click the *Create* button.

The Application creation should be a success, and a new *random-meme* Application tile should be shown in the Argo CD dashboard. Clicking on the tile reveals the Application details. It should have synchronised successfully.
The Application creation should be a success, and a new *random-meme-dev* Application tile should be shown in the Argo CD dashboard. Clicking on the tile reveals the Application details. It should have synchronised successfully.

image:ex8.argocd-random-meme-application.png[]

Expand Down

0 comments on commit 78a9b51

Please sign in to comment.