z/OS Connect - Group home

Sample workflow with IBM UrbanCode Deploy and Git

  
This blog was originally published on June 5, 2018, by Yee Rong Lai.



The following sample implementation uses Git repositories to store our source code, and IBM UrbanCode Deploy (UCD) to run the z/OS Connect EE build toolkit to generate the archive files and deploy them.

Source code in Git

Using services as our example, each service project has its own Git repository as shown in the following figure.

A Git repository for each service
Figure 1. A Git repository for each service

Each repository has the project files created in the z/OS Connect EE API toolkit, including:

  • bin/ directory
  • service-interfaces/ directory
  • service.properties file

Each Git repository maps to a component in UCD. In our sample, we use a convention where the component name is the service name and the Git repository name. The following figure shows a MortgageCalculateService1.1 component that maps to the MortgageCalculateService1.1 repository on GitHub.

Each Git repository is mapped to a component in UCDFigure 2. Each Git repository is mapped to a component in UCD

The MortgageCalculateService1.1 component is set up to use Git as the source configuration type, with the repository URL specified. SSH connections to Git is setup in the environment to run this agent.

Specifying the source configuration type and repository URL for the component
Figure 3. Specifying the source configuration type and repository URL for the component

Setting up the UCD process

Our process starts by downloading the source code from the Git repository and then running a script to build the service archive file.

The DevOps process in UCD
Figure 4. The DevOps process in UCD

You can set up an automatic version impact check in UCD so the component would check for updates to the source code at a specified interval. However, keep in mind that a regular pull would impact performance and is not typically used in a production environment.

Running the build toolkit

The following figure shows the generation from a project directory that has the same name as the component, and the generated archive file is also set to have the same name.

Running a script to run the build toolkit
Figure 5. Running a script to run the build toolkit

Managing services using the RESTful administration interface

After the archive file is generated, we call the RESTful administration interface provided by z/OS Connect EE to check the service status. The following figure shows how the call using the RESTful administration interface is configured.

Getting the status of a service

Figure 6. Getting the status of a service

zcee_base_url is configured as a resource property, and the service name is the component name. The service status is obtained by issuing a GET request.

We also have a post-processing script GetZCEEServiceStatus to check the return response. The script looks as follows:


var exit = properties.get('exitCode'); if (exit == 0) { line = properties.get("responseBody"); var pos = line.indexOf('"serviceStatus"'); var restline = line.substring(pos+17); var serviceStatus = restline.substring(0,restline.indexOf('"')); properties.put("serviceStatus", serviceStatus); if(serviceStatus == "Started" || serviceStatus == "Stopped"){ properties.put('Status', 'Success'); }else{ properties.put('Status', 'Failure'); } }else{ properties.put('Status', 'Failure'); }


If the service status is neither started or stopped, it means the service does not exist yet. In this case, we’d deploy the service, which is automatically started upon deployment. If the service already exists, we stop the service, update the service, and then start the service.

Deploying a service

Figure 7. Deploying a service

For deploying a new service, we use the POST method. To update a service, we would use a PUT method.

Updating a service

Figure 8. Updating a service

Summary

For a DevOps process to manage your services, APIs, and API requesters, treat your properties files or project files from the API toolkit as source code and manage them accordingly. Regardless of your choice of source code management or DevOps tool, the build toolkit and the administration interface provided by z/OS Connect EE will be the key to your DevOps solution. In this article, we describe such a process, and demonstrate the process with IBM UrbanCode Deploy and a Git repository.

Additional information

For more information, see the following resources in IBM Knowledge Center: