Skip to main contentIBM Cloud Patterns

Cloud Toolchain Setup

IBM Cloud Toolchain Setup

Create Kubernetes Deployment Target

For this pattern, we will create an instance of the IBM Cloud Kubernetes Service (IKS) on VPC Gen 2. The following will work similar to Red Hat OpenShift Kubernetes Service (ROKS), as well as any Kubernetes service outside of IBM Cloud that you may have access to.

  • From the IBM Cloud console, select Kubernetes from the top left navigation menu in IBM Cloud
K8s hamburger menu
  • Click Create Cluster
k8s create cluster
  • Select Kubernetes version Latest which is required for VPC Gen 2
k8s select version
  • Select VPC Gen 2 Infrastructure (Assumes VPC Gen 2 has already been created)
k8s select vpc
  • Scroll down and complete and select other options such as type and number of nodes and hit Create. Wait a few minutes for your cluster to finish provisioning before proceeding to the next step.

Setup Image Registry

  • Add a Namespace to the registry on IBM Cloud
$ ibmcloud cr namespace-add attworkshoptest
Adding namespace 'attworkshoptest'...
Successfully added namespace 'attworkshoptest'
OK
  • Upgrade the plan, if needed, to unlock unlimited storage for the registry.
$ ibmcloud cr plan-upgrade
You agree to the terms and conditions of the 'Standard' pricing plan when you upgrade: https://www.ibm.com/software/sla/sladb.nsf/sla/bm-7670-03
You cannot undo this operation.
Do you want to continue to upgrade your pricing plan? [y/N]> y
Setting pricing plan: 'Standard'...
OK

Create the Toolchain

  • From the IBM Cloud console, select Devops from the top left navigation menu in IBM Cloud

Devops hamburger menu

  • Click the Create toolchain button

Devops create toolchain

  • Select the Develop a Kubernetes app tile as your template.

Devops create toolchain

  • Define the Toolchain Name, Region and Resource Group for the toolchain.
  • For Source Provider, select Git Repos and Issue Tracking which will create a git repo space using the IBM Cloud gitlab environment
Devops name toolchain
  • Next, configure the git repo. Select US East for the Server, select Clone as the Repository Type and use https://github.com/jzaccone/java-liberty-app for the Source repository URL.

Devops Git configuration

Configure the Delivery Pipeline:

  • Select from the dropdowns to find the container registry namespace you created earlier by selecting the appropriate Container registry region and Container registry namespace.
  • Click the blue button to generate a IBM Cloud API Key based on your current logged in user.
  • Use the dropdowns again to find your clustser by selecting the correct Cluster region, Resource Group, and Cluster name.
  • Write in default for Cluster namespace.

Devops delivery pipeline

  • Select Create to create your Toolchain

Results

One you create the Toolchain, you should see the following screen

Devops pipeline overview

Using the Deploy to Kubernetes template, we configure a few things to the toolchain out of the box.

  • Git which links to a the GitLab environment hosted on IBM Cloud and protected by IAM for your accounts
  • Eclipse Orion Web IDE which is a web IDE allowing you to browse and make quick edits to your code
  • Issues which links to the Issues page in your source control repository
  • Delivery Pipeline which includes all the stages and jobs for building, testing and deploying your application. The pipeline should have been triggered to run automatically when you created the pipeline

You can add a new tool to your tool chain by pressing the Add Tool button. Options for tools include integrations with Artifactory, Nexus, SonarQube, Slack or you can create a custom integration with any tool

Devops pipeline add tool

Select the Delivery Pipeline tile to check the progress of your pipeline execution. Once it completes, you should see that all stages pass successfully.

Devops pipeline success

You might notice that the Containerize stage passed with warnings. That is because vulnerabilities were found from the IBM Cloud Vurnerability Advisor. You can click through to see logs to see details of what vulnerabilities were discovered.

Click the Deploy to Kubernetes job in the Deploy stage. This should take you to the logs output for that job.

Devops pipeline logs

Near the bottom of the logs you should see a print of the address for your application.

Devops pipeline app link

Click on the link to see your application running on the Kubernetes Cluster on IBM Cloud

Devops pipeline app

Trigger a Change

This IBM Cloud Toolchain is automatically configured to run whenever a code change is committed to the linked git repository. To see what change triggered a particular pipeline run, check the Last Input in the build stage.

Devops pipeline last commit

Within that box, there is a link that will take you to the exact commit in the git repo where you can view what files were changed.

Devops pipeline changes

Once the pipeline is run multiple times, a history is created. Click on View logs and history for any stage to see a detailed history and logs for each stage execution.

Devops pipeline history