start portlet menu bar

HCLSoftware: Fueling the Digital+ Economy

Display portlet menu
end portlet menu bar
Close
Select Page

Prerequisites

The following items will need to be configured before you can begin doing Argo CD deployments with DevOps Deploy.

GitHub Repository

You will need a GitHub repository that contains the Kubernetes resource definition files you plan to deploy.

Argo CD Server

You will need access to an Argo CD server. See https://argo-cd.readthedocs.io/en/stable/getting_started/ for instructions on how to install Argo CD. An Argo CD application that references your GitHub repository must exist in the Argo CD server.

Argo CD CLI

The Argo CD CLI will need to be installed on a DevOps Deploy agent machine. See https://argo-cd.readthedocs.io/en/stable/cli_installation/for instructions on installing the CLI.

If you want to install the Argo CD CLI on a containerized DevOps Deploy agent running in a Kubernetes/OpenShift cluster, be sure to install it in the persisted conf directory. If you install it anywhere else, it will be lost if the pod is restarted. Also be sure that the CLI executable has execute permission set.

DevOps Deploy Docker Source and Automation Plugins

The DevOps Deploy Docker source and automation plugins will need to be loaded into the DevOps Deploy server. The Docker automation plugin depends on the source plugin, so you should load the Docker source plugin first.

The Docker source plugin can be downloaded from https://urbancode.github.io/IBM-UCx-PLUGIN-DOCS/UCD/#docker-registry

The Docker automation plugin can be downloaded from https://urbancode.github.io/IBM-UCx-PLUGIN-DOCS/UCD/#docker

DevOps Deploy Argo CD Automation Plugin

The DevOps Deploy Argo CD automation plugin will need to be loaded into the DevOps Deploy server. The Argo CD plugin can be downloaded from https://urbancode.github.io/IBM-UCx-PLUGIN-DOCS/UCD/#argocd

Create Argo CD Application

Log in to your Argo CD server and create a new application that references your source GitHub repository and the destination Kubernetes/OpenShift cluster where you want to deploy your Kubernetes resources. Set the Sync Policy of the application to manual. If the Argo CD application already exists, you can skip this step.

Create DevOps Deploy Application and Related Resources

Log in to your DevOps Deploy server and create a new application. This application will be used to deploy your Kubernetes resources via your Argo CD application.

Create an environment in the new DevOps Deploy application. Add the DevOps Deploy agent where you previously installed the Argo CD CLI to the resource tree of this new DevOps Deploy environment.

Create DevOps Deploy Component

Create a new DevOps Deploy component, using the ArgoCD Component Template. Fill in the required component properties, including argocd.server, argocd.user, argocd.password, and argocd.application.name. Specify any required Argo CD CLI global flags in the argocd.global.flags field, such as --config=../argocd.config --insecure. Be sure to specify each global flag on a line of its own. If the Argo CD CLI is not installed in a directory that is included in the PATH of the agent, specify its location in argocd.cmd.path.

Once the new DevOps Deploy component has been created, add it to the new DevOps Deploy application. Also add a reference to the new component under the DevOps Deploy agent in the DevOps Deploy application environment resource tree.

Create DevOps Deploy Application Process

Create a new DevOps Deploy application process that will send an application sync request to the Argo CD server. Go to the Processes tab of the new DevOps Deploy application and click the Create Process button. Specify values for the Name and Description fields and click Save.

In the Process Design pane, drag the Install Component step onto the palette. Edit the step. Specify Sync And Run Tests for the Name field. Select KubeToy for the Component field. Select Sync And Run Tests for the Component Process field. Click the OK button to save the changes to the step. Click Save to save the design of the new application process.

The component process named Sync And Run Tests is included in the ArgoCD component template. After the App Sync step, which invokes the Argo CD CLI to synchronize your Argo CD application, there is a Shell step named Run Tests. This step can be modified to run whatever tests are needed to validate that your Kubernetes application has been deployed successfully. If the status of the Run Tests step is Failure, then the App Rollback step is called to roll back to the previous application state. If the status of the Run Tests step is Success, then the Sync And Run Tests process exits with a successful status.

Create DevOps Deploy Deployment Trigger

Now that the application process has been created, we need to create a new Deployment Trigger that will be invoked whenever a new component version is created in the component you just added to the application. Edit the DevOps Deploy application environment configuration. Select the Deployment Triggers section of the environment configuration and click the Create Deployment Trigger button. Specify the new DevOps Deploy component and application process created above, as well as the DevOps Deploy user that will execute the application process.

Configure GitHub Actions Workflow in GitHub Repository

Create a new GitHub Actions workflow in your GitHub repository that will be triggered when changes are pushed to the main branch of the repository. When triggered, this workflow will cause a new DevOps Deploy component version to be created. When the new component version is created, it will trigger the application process that will invoke an app-sync call to the Argo CD CLI, resulting in the deployment of the Kubernetes resources defined in your GitHub repository.

In your GitHub repository, create a new file named .github/workflows/CreateDevOpsDeployCompVersion.yml. The content should come from the
Example Usage section of
https://github.com/HCL-TECH-SOFTWARE/devops-deploy-createcomponentversion-action. Update the following input properties from the example with values specific to your DevOps Deploy instance:

  • component - The name or ID of the component in DevOps Deploy.
  • hostname - Hostname or IP of the DevOps Deploy server.
  • port - Port number of the DevOps Deploy server. Defaults to 8443.
  • authToken - Authentication token used to authenticate with the DevOps Deploy server. The example uses a secret named DEVOPS_DEPLOY_AUTHTOKEN which is defined in the GitHub repository at Settings->Secrets and variables->Actions.

The example workflow below specifies that it should be fired when changes are pushed to the master branch. You will need to modify that value if your GitHub repository uses a different branch.

Update GitHub Repository and Deploy Changes

Everything is now configured so that whenever a change is pushed to the specified branch in your GitHub repository, DevOps Deploy will initiate an application sync request to Argo CD. Argo CD will check what changes have been made and apply them to the destination Kubernetes/OpenShift cluster.

Make a change to one of the Kubernetes resource files in your GitHub repository. For example, change the replica count of a deployment or statefulset resource file and push the changes. Verify that a new DevOps Deploy component version is created.

Next, verify that the DevOps Deploy application process that invokes the Argo CD application sync request was executed and completed successfully. Navigate to the DevOps Deploy application and select the History tab.

Click the ellipsis (Actions) at the end of the process request line and select View Request. Expand the Execution Log to view all the executed steps in the process request.

You can also check your application in the Argo CD UI to verify that the Kubernetes resources were updated to match the change you made in the GitHub repository. Note that there are now two KubeToy pods displayed in the lower right section of the image below.

Comment wrap

Start a Conversation with Us

We’re here to help you find the right solutions and support you in achieving your business goals.

Secure DevOps | September 2, 2024
Announcing the End of Support for HCL DevOps Deploy Version 7.2
HCL announces End of Support for HCL DevOps Deploy (formerly HCL Launch) Version 7.2. Learn what EOS means and how to upgrade smoothly.
Secure DevOps | June 27, 2024
HCL DevOps Deploy 2024.03 (8.0.1): Empower Your Deployment Capabilities
HCL DevOps Deploy 2024.03 (8.0.1) is here with crucial bug fixes & security enhancements. New features: YAML export, Recycle Bin, unavailable agent status & more.