Exercise 9: Deploy an application with a custom Stack, custom Collection, and custom Pipeline
In this exercise, we will show how to bring all the custom components (Stacks, Collections, Pipelines) together.
When you have completed this exercise, you will understand how to
Create a custom pipeline and add it to a collection
Update the Kabanero Custom Resource to point to a new collection
Deploy an application based on a custom stack using a custom Tekton pipeline

Prerequisites
You should have already carried out the prerequisites defined in Exercise 8.
Delete the webhook from Exercise 8:
Open the Tekton dashboard, and select
Webhooks.Next, click on the box next to the
custom-slack-webhookto select it and click on Delete.In the dialog, check the box to delete pipeline runs associated with the webhook and click on Confirm.
Delete the task and pipeline from Exercise 8, too.
Steps
1. Add the tasks to the collection
In your local collections/incubator/my-nodejs-express/pipelines folder add a new folder called custom-pipeline and add two files test-task.yaml and test-build-deploy-pipeline.yaml. The file structure is seen below
The test-task.yaml is slightly updated from exercise 8 to pull in the relevant basename from any collection that uses it
And the test-build-deploy-pipeline.yaml is a modification of the defauly pipeline:
In incubator/my-nodejs-express update collection.yaml to change the default pipeline
Unusually in these exercises, we have been using a version of appsody that is ahead of the current level baked into some the standard kabanero tekton artifacts, so there is one additional change that is needed to get around this. You need to update a tag in the common build-task.yaml used for all stacks in the collection. This update will select a builder container that uses appsody 0.5.3 to support the private registry semantics used in these exercises.
Open the incubator/common/pipelines/default/build-task.yaml file and add the tag :0.5.3-buildah1.9.0 to the image spec in the assemble-extract step as shown:
2. Re-run the scripts
Run build.sh and release.sh as before. From collections home run:
Check the ci/release/ folder to make sure there is a file called (your version may be different):
And that the generated ci/release/kabanero-index.yaml has a section like the following:
3. Update the current release
Upload the changes
Navigating back to your GitHub repo, select the current custom release:

Clicking on the release name (0.2.1-custom) will allow you to edit the release. Click on Edit tag. Click on the x to delete existing items from the release and then upload all the files in collections/ci/release/ which were generated from the previous steps, by clicking on the Attach binaries... box.

4. Update the Kabanero Custom Resource
Use oc get kabaneros -n kabanero to obtain a list of all Kabanero CR instances in namespace kabanero. The default name for the CR instance is kabanero.
You should see output similar to the following:
Edit the specific CR instance using oc edit kabaneros <name> -n kabanero, replacing <name> with the instance name.
Modify your Kabanero custom resource (CR) instance to target the new collections that were pushed to the remote Github repository. The Spec.Collections.Repositories.url attribute should be set to the URL of the collection repository.
When you are done editing, save your changes and exit the editor. The updated Kabanero CR instance will be applied to your cluster.
5. Test it all out
If you go to the tekton dashboard, you should see the new pipeline and task (it was added when updating the Kabanero CR by the Kabanero Operator)

Re-add the webhook, this time you should see the new pipeline as an option (without having to do kubectl apply). Use similar settings for the webhook as in Exercise 8:
When the pipeline runs, it should, in addition to running the new test task, also run the build and deploy task. You can test this by making a minor update to your test-custom-stack repo. Once you have done this then re-commit to trigger the webhook by:
Return to the Tekton Pipeline Runs tab to check on the status of your deployment.

After a while it should show that the pipeline run is complete.

You can also click on the specific pipeline run link (custom-stack-1576283066 in the above example), and see the progress of the three tasks which make up the new pipeline. Once they are all complete, it should look similar to the picture below. Notice how you can click on a given task (e.g. the new test-task we created) to see the output.

Although the task we added was a test task, you can imagine how you might add additional tasks that are more relevant to your enterprise environment - for example to check that the application code added by the developer meets your security standards.
Once the pipeline run is complete, you can confirm that our test application, with the upgraded stack, is now running with a curl -v to the route. You should see helmet responses, e.g.:
Congratulations!! You have completed Day 2 of the workshop! You have successfully created a custom appsody stack, included it in a custom Collection that also includes a custom pipeline - showing how you can adapt the standard kabanero infrastructure to suit the needs of your enterprise.
Last updated
Was this helpful?