CI/CD (Continuous Integration/Continuous Delivery or Deployment) is an integral part of the modern Software Development Life Cycle (SDLC), automating and accelerating key phases like development, testing, integration, and deployment to deliver software updates faster and more reliably. It acts as a bridge between development and operations, streamlining workflows, enhancing code quality, and allowing teams to respond quickly to feedback and changes.
For organizations using IBM tools, achieving this automation—specifically for bundling a HATS project into an Enterprise Archive (.ear) file and deploying it—is powerfully implemented using a combined solution of IBM DevOps Build and IBM DevOps Deploy.
IBM DevOps Build (Build) is a continuous integration and build-management system. Build is a distributed, multi-platform, enterprise-scale build management tool for configuring and running software builds. Build uses a template-driven system to configure and run builds. Projects are created from project templates and are configured by assigning other templates, such as process and workflow templates, to them. The templates can define standard build processes, source control rules, and testing and reporting processes.

The IBM DevOps Build (Build) architecture consists of a centralized server and distributed agents. The server provides a data store, a user interface, and coordinates agents, among other things. All build activities occur on agents, and agents act only when the server tells them to.
IBM DevOps Deploy (Deploy) is an application-release solution that infuses automation into the continuous delivery and continuous deployment (CI/CD) process. It standardizes and simplifies the process of deploying software components to each environment in your development cycle.

The core installation of Deploy includes a server, agents, and a license server. Clients access the server through web browsers, the REST API, or the command-line client. Agents can be installed on cloud environments, virtual machines (VMs), containers, or physical systems.
CI/CD using DevOps Build and Deploy for HATS:

Automate HATS EAR build using DevOps Build:
Prerequisite for Build automation:
● Script to bundle the HATS Project as an enterprise archive(.ear) file. For example, the ANT build script.

Reference to create ANT Build Script: https://community.ibm.com/community/user/blogs/sathiya-priya/2022/01/07/generate-ant-build-for-hats-project
Prerequisite for agent:
● Access to the Source code repository for the agent
● HATS setup on the VM/Physical machine where the agent is configured.
● Any other specific prerequisites as per the Project requirement.
Set up a build server and install the agent on the target computer where prerequisites are configured.
DevOps Build’s job template is where all the required steps are added to complete the project building activity. Steps include cloning the source code to the build agent workspace, executing the build script, uploading artifacts, and performing any other necessary steps as specified by the build requirements.

To build HATS applications, the following mandatory steps must be accomplished in the build job.
- Clean Workspace: Agent workspace directory where resources are downloaded for the build.
- Clone Git repository: Source code repository.
- Invoke ANT Build script in the HATS project: build.xml(ANT script).
- Upload the artifact(.EAR) to build view.
- Upload artifact to Deploy.
- Trigger Deploy to Dev Environment.
Additionally, if artifacts are required to be stored in the external artifactory, add an upload to artifactory step.
Build job steps are plugin-based, allowing you to extend functionality as needed. You can easily add the required plugins from the available list to your DevOps build and integrate additional features directly into the job steps.
Below are the sample steps to enable building the HATS ear in the DevOps Build
1. Configure the Job Step Sequence for the HATS Project Build
Add an ANT build job step to invoke the ANT build script required for the HATS project.


Note: The Working Directory refers to the current agent’s workspace where the Git repository is cloned. Specify a relative directory path to locate the ANT build script file.
2. Start the Build Manually
Once the job steps are configured, click Build to trigger the build process manually.

Success Build view:

Artifacts:
Artifacts generated during each build execution can be viewed directly in the build results, uploaded to Artifactory, and deployed to DevOps for deployment.

Note: To publish artifacts to DevOps Deploy, configure the Deploy server details in the Build system. Ensure that the component and application names specified in the deploy job steps match the corresponding names defined on the Deploy server.
Automate Build Trigger:
Builds can be triggered by repository events, such as source code changes, or on a predefined schedule at specific intervals. In addition, builds can be triggered through post-processing events, such as the completion of builds in related projects.
For repository-based triggers, configure a trigger in the build definition and update the Git webhook settings to automatically start a build whenever the source code is updated.
DevOps Build Tutorial: https://www.ibm.com/docs/en/devops-build/7.1.0?topic=tutorials
Automate HATS EAR Deployment using DevOps Deploy:
Set up the Deploy server and install the agent on the target system where the deployment application server is configured. The target system can be a virtual machine, a mainframe, or a physical computer, including the same system on which the application server is installed and configured.
HATS supported applications servers:
· IBM Websphere Application Server.
· IBM Websphere Server Liberty.
· Apache Geronimo Server.
· Oracle WebLogic Server and JBoss EAP server.
Component:
Components contain artifacts and deployment processes. During the DevOps Build, the HATS artifact (.ear) is uploaded, and a component process with defined steps is created to deploy the artifact to the application server.
The component view displays the version generated and uploaded by the build, along with the associated deployable artifact.


Create a new process with steps to deploy the EAR to the server. Use the drag and drop steps to complete the deployment of the artifact to the server. Steps to stop the server, deploy the EAR file, and restart the server.
In the case of deployment to the IBM WebSphere Liberty server, copy the EAR file to the ‘dropins’ folder on the Liberty server. Ensure that the server is stopped before copying and deleting if the previous build of HATS ear already exists. Once the copy operation is complete, restart the server to finalize the deployment.


Application:
Create an application and add a component that has already been created, along with a deployment process. Applications are responsible for bringing together all the components that must be deployed together. It automates the deployment process by calling the component process.

Create the environments where the HATS applications will be deployed. Each Deploy environment includes one or more Deploy agents. Assign the appropriate agents to each environment based on its purpose, such as DEV, QA, or PROD.
Ideally, development builds should be deployed automatically to the DEV environment whenever the source code is updated. Deployments to QA and PROD environments can be scheduled or triggered manually, depending on the development milestones.

Deployment success view: 
DevOps Deploy Tutorial: https://www.ibm.com/docs/en/devops-deploy/8.1.2?topic=tutorials-create-simple-helloworld-deployment
Shivaprasad N
Managing Consultant I
🚀 Introducing IBM z17 - making more AI possible. With AI capabilities infused across hardware, software and systems, IBM z17 can drive business value by mitigating fraud risk, analyzing medical images, or even helping prevent retail crime – and that’s just the beginning. See how it can help your organization here.
