The installation of Jenkins
Jenkins is an open source CI&CD software designed to automate a variety of tasks, including building, testing, and deploying software.
Jenkins can be run in a variety of ways, either through a system package, Docker, or through a standalone Java program.
The installation
The operating system here is WSL Ubuntu. For other systems, please refer to Jenkins’ official documentation
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins
Copy the code
Change the port number (default port 8080)
Jenkins’ configuration file is in /etc/default/jenkins; Find the http-port and modify it
run
sudo systemctl start jenkins
# OR
sudo service jenkins start
Copy the code
If you want to boot automatically run
sudo systemctl enable jenkins
Copy the code
If you run into the error shown below, install the JDK first
Basic configuration
After successful startup, enter the corresponding IP address (IP :port) to enter the Jenkins management page – As shown in the following figure
Get the default administrator password – specific command in the file in red
cat /var/lib/jenkins/secrets/initialAdminPassword
Copy the code
After the command is executed, return to the following figure
Enter the password and enter the custom Jenkins interface (as shown below).
In this interface, we select the recommended plug-in to install the plug-in. The following figure
After the plug-in is installed, the interface for setting user name and password will be entered automatically (as shown below).
Click the button to save the input after completion and enter the next interface instance configuration
Click the button to save and finish to enter a new interface, and then click the button to start using Jenkins to enter the Jenkins main interface (as shown in the figure below), so Jenkins installation and basic configuration have been completed.
Release the VUE project
Nodejs is required to package the Vue project. After the package is complete, you need to upload the packaged file to the target server via SSH. So next we’ll install Jenkins’ Nodejs plugin and Publish Over SSH plugin.
Install the plug-in -nodejs
In the Jenkins home screen workbench, click System Management > Plug-in Management to enter the plug-in management interface (as shown below).
The following figure shows the search results
After selecting the plug-in and clicking “Install”, you will enter the plug-in download interface (as shown below).
Configure the NodeJS plug-in
In the Jenkins home screen workbench, click System Management > Global Tool Settings to go to the plug-in management screen and find the NodeJs option (as shown below).
The installationPublish Over SSH
Plug-in and configuration
The install of Publish Over SSH plug-in is the same as the install of Nodejs plug-in.
In the Jenkins home screen workbench, click System Management > System Configuration to go to the Plug-in configuration screen, scroll to Publish over SSH, and click the Add button under SSH Servers (as shown below).
Click on the buttonsenior
The following interface is displayed
Create a task
Now that the Jenkins plug-ins needed to package vue are installed, let’s begin the task of creating the Vue project package.
The detailed operation is shown in the following figure
Click the button to confirm, as shown below
Clicking the Save button after installing the configuration described above will redirect you to the details of the task you created.
At this point we have implemented a simple Jenkins configuration for one-click packaging of front-end projects.
If there are any omissions, please point out that your “like” is the biggest recognition for me.