Huawei Cloud CodeArts π Jenkins Integration
Introduction
Hi everyone π in this article we will look at some cloud services, additionally we will make a connection with CodeArts and Jenkins.
Necessary knowledge; In this demo, we will use different cloud services. We will take a look these services to became more understandable article.
What is CCE on Huawei?
Cloud Container Engine or shortly CCE service provides a container environment for users. Cloud Container Engine (CCE) is a hosted Kubernetes product or service that simplifies the deployment and management of containerized applications. With CCE, you can easily create Kubernetes clusters, deploy containerized applications and you can manage & maintain them.
CCE allows you to buy, scale, upgrade, delete, and monitor clusters. After a cluster is created, it can be hibernated and awakened and you can access it using kubectl and manage cluster permissions.
Node Management:
A container cluster consists of a set of worker machines, called nodes, that run containerized applications. A node can be a virtual machine (VM) or a physical machine, depending on your service requirements. The components on a node include kubelet, container runtime, and kube-proxy.
CCE uses high-performance ECSs or bare metal servers (BMSs) as nodes to build high-availability Kubernetes clusters.
CCE allows you to buy, monitor, reset, shut down, and delete nodes. You can also accept existing nodes into a cluster, log in to nodes, manage node labels, and synchronize node information.
Workload:
A workload is an abstract model of a group of pods in Kubernetes. Workloads classified in Kubernetes include Deployments, StatefulSets, DaemonSets, jobs, and cron jobs.
CCE supports Kubernetes-native container deployment and management. You can manage the lifecycle of container workloads, including creation, configuration, monitoring, auto-scaling, upgrade, uninstall, service discovery, and load balancing.
CodeArts
CodeArts is a one-stop cloud-based DevOps platform. These out-of-the-box cloud services enable you to manage projects, host code, run pipelines, and build, deploy, and release your applications in the cloud anytime, anywhere.
CodeArts consists of many services, these are some of them :
CodeArts Repo: A Git-based online code hosting service for software developers. It is also a cloud code repository for security management, member and permission management, branch protection and merging, online editing, and statistics
CodeArts Check: Manages code quality in the cloud. Developers can easily perform static checks and security checks on code in multiple programming languages and obtain comprehensive quality reports
CodeArts Build: Provides an easy-to-use hybrid language build platform to implement cloud-based build, and supports continuous and efficient delivery. With CodeArts Build, you can create, configure, and run build tasks with a few clicks.
CodeArts Deploy: Provides visualized, one-click deployment. It supports deployment on VMs or containers by using Tomcat, Spring Boot, and other templates or by flexibly orchestrating atomic actions.
CodeArts Pipeline: Provides visualized, customizable automatic delivery pipelines to shorten the delivery period and improve efficiency.
Jenkins
Jenkins is an open-source automation server that helps automate various parts of the software development process, including building, testing, and deploying software. It is a popular tool used by developers and DevOps teams to streamline their workflows and improve the efficiency of their software development processes. Jenkins can be used to automate tasks such as code compilation, testing, and deployment, and it can integrate with a wide range of tools and technologies, making it a versatile and powerful tool for software development teams.
Hands-On Steps
CCE Environment
Firstly we will create a CCE cluster for Jenkins deployment
Cluster Specifications:
After creation, the cluster status is running now. We can create a node from here :
Now we can create a workload to make deployment
Configure basic workload parameters
For this demo we will choose Jenkins image from open source images, 2 cores and 2048 mb will be enough.
Configure basic container parameters, Choose Data Storage > PersistentVolumeClaims (PVCs) and add a persistent volume
We need to create PVC before mounting
If you donβt have EVS (Elastic volume service), go to Storage services > EVS on Huawei Cloud Console and click to buy disk
Now we can create PVC with these specifications
enter /var/jenkins_home in the mount path to mount a cloud volume for Jenkins to store data persistently.
After that, Choose Data Storage > Local Volumes, add a local volume, and mount the host path to the corresponding container path
This table shows Mounting the host paths to the corresponding container paths
Add Service Settings
For reaching clusters we need LoadBalancer,
LoadBalancer: provides external web access using port 8080. You can also select NodePort to provide external access.
- Set the Service name to Jenkins (customizable), the container port to 8080, and the access port to 8080, and retain the default values for other parameters.
Create a second service for the agent and open 2 ports,
ClusterIP: used by the Agent to connect to the Master
Set the Service name to agent (customizable), the container port 1 to 8080, the access port 1 to 8080, the container port 2 to 50000, the access port 2 to 50000, and retain the default values for other parameters.
At the end of service settings should be like this:
Access to Jenkins
On the CCE console, click the target cluster. Choose Networking in the navigation pane. On the Services tab page, view the Jenkins access mode. Enter EIP:8080 of the load balancer in the browser address box to visit the Jenkins configuration page.
When you visit the page for the first time, you are prompted to obtain the initial administrator password. You can obtain the password from the Jenkins pod.
To access Jenkins pod you can use CloudShell from the CCE console, then you can run these commands to obtain the administrator password;
# kubectl get pods
# kubctl exec -it "your pod's name" - /bin/sh
# cat /var/jenkins_home/secrets/initialAdminPassword
After taking the password you can create your user
On the Jenkins page, I had a job and I will connect my Jenkins account to Huawei Cloud, so I will be able to run my jobs on CodeArts
CodeArts Endpoint
I had a project on CodeArts, on the settings panel choose general settings
We will create a Service Endpoint to make a connection, As you can see there are many different services that could work with Huawei Cloud, now we will continue with Jenkins
You can give a name whatever you want for the connection name, copy your Jenkins URL address and past to Server URL blank, Also write your Username and Password to complete the connection
On the Pipeline creation panel, I will add a new task
Choose Jenkins task
Here your endpoint, you can write your jobβs name which you want to run
Conclusion π
At the end of the demo, we combined Jenkins and CodeArts π , committed pipeline on Huawei Cloud β . As a result, we achieved success β