Skip to content

Integrate Jenkins on a Physical/Virtual Machine

Risks

Since Jenkins is deployed on a physical machine or virtual machine, some Kubernetes (K8s) based functionalities may not be available after integration.

  • The Workbench places pipelines in a folder named after the WorkspaceID, which may cause existing pipelines to be undiscoverable and not displayed on the workbench interface.
  • All configurations based on casc will become invalid, including SonarQube integration and global email settings.
  • If Jenkins is not running using KubernetesCloud, related syntax will become invalid, requiring manual adjustments to the Jenkinsfile.

Plugins

Required Plugins

The following dependency plugins will be automatically installed when installing Jenkins:

Optional Plugins

  • Kubernetes Plugin: If you want the pipeline to run on a K8s cluster, you need to install this plugin.
  • Docker Plugin: If you want the pipeline to run in isolation as a container from the physical machine, you need to install this plugin.
  • Chinese Plugin: This is a localization plugin provided by the Chinese community.

Configure Nodes

For preparation work related to physical machine nodes, refer to Using Jenkins agents.

Configure Jenkins

EventDispatcher

First, ensure that the generic-event plugin is properly installed and enabled.
Check the amamba-devops-server:

# Get the svc of amamba-devops-server
kubectl get svc amamba-devops-server -n amamba-system

NAME                   TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)            AGE
amamba-devops-server   ClusterIP   10.233.45.104   <none>        80/TCP,15090/TCP   230d

Ensure that Jenkins can communicate properly with the amamba-devops-server, exposed via NodePort or LB, and then fill the corresponding IP in the host field.

Note

This operation is not very secure, and this service is not suitable for direct exposure.

Fill the address of the amamba-devops-server into the Event Receiver input box in Jenkins system management configuration, as per the following format:

http://<hostIP:Port>/apis/internel.amamba.io/devops/pipeline/v1alpha1/webhooks/jenkins

SonarQube

For SonarQube configuration information, refer to Jenkins Integration with SonarQube.

Configure Email

Get the email configuration of Ghippo.

kubectl get ghippoconfig smtp -n ghippo-system -o yaml

Below is a simple example:

apiVersion: ghippo.io/v1alpha1
kind: GhippoConfig
metadata:
  labels:
    k8slens-edit-resource-version: v1alpha1
  name: smtp
spec:
  from: test@163.com
  host: smtp.163.com
  password: test
  port: 25
  ssl: false
  starttls: false
  user: test@163.com

Configure the email service in Jenkins.
Go to System Management System Configuration, enter the administrator email address test@163.com, set the SMTP email server to smtp.163.com, select SMTP authentication and fill in the username and password, set the SMTP port, and go to the user settings page to set the email address to test@163.com.

Comments