A,Download JenkinsSelect Windows Installation
Install in a directory of your choice
Select the service operation account
Jenkins operates in the way of system service, and the account for service operation needs to be specified. Both LocalSystem and LocalService are system built-in accounts. The difference is that LocalSystem has the highest permission, while LocalService only has the minimum permission for service operation. This article is installed locally, so the LocalSystem account was selected.
Setting service Ports
Enter the service port number. It is recommended that the value be larger and do not conflict with the system port. This is 60000. After entering, you can click test Port to confirm that the port is available.
Custom installation
Custom install here, select features and install as needed
Next click Install, and then Click Finish
Unlock Jenkins
The first time you access a new Jenkins instance, you will be asked to unlock it with an automatically generated password. On the CMD command line, view the password with type
type C:\WINDOWS\system32\config\systemprofile\AppData\Local\Jenkins\.jenkins\secrets\initialAdminPassword
Custom Jenkins extension
After Jenkins is unlocked, any number of useful plug-ins can be installed in the custom Jenkins page for initial configuration. There are two options to choose from:
- Install recommended plug-ins – Install a recommended set of plug-ins based on the most common use cases.
- Select the plugins to install – Custom plugins can be installed, if you know which plugins you want to use, choose custom install, otherwise choose the recommended plugins
It takes a long time for the plug-in to be installed
Some plugins may fail to install, don’t worry, because some of them will not be used by you, continue with the following operation.
Create the first Jenkins administrator account
Configure the Jenkins webpage access address, click Save and finish. You can use the default address
After the configuration is complete, the home page is automatically displayed, and the Node. exe installation directory is configured
View the node.js version and pathManage Jenkins ==> Manage Plugin Download NodeJS Plugin
Then specify the NodeJS installation directory and Manage Jenkins ==> Global Tool Configuration
Install the Gitee plug-in for pulling remote code
Manage Jenkins ==> Manage Plugin Download the plugin gitee
- There are two ways to configure tokens
- Before the project is being built (choose between the time when you can build a new project after it is built here)
Manage Jenkins ==> Configure System Add credentials
2. Configure tokens for projects under construction.
Start our build project
1 Open Jenkins home page and click “New Item” to create a project. Create a new free-style project
2 Select the source control panel and enter the repository address on your Git. Note that gitee credentials are added
3. Select the build trigger. Gitee Webhook triggers code to automatically build and publish
Configure Web Hook on Gitee Click project administration to add webHookThis url needs to delegate its local Jenkins address to the public network and Configure the domain name after using the domain name proxy to Jenkins’ Manage Jenkins ==> Configure System to find Jenkins Location Modify the Jenkins URL
In Windows, you can modify Jenkins. XML in the directory where you installed Jenkins
– Dhudson. Security. CSRF. GlobalCrumbIssuerConfiguration. DISABLE_CSRF_PROTECTION = true mean cross-site request forgery protection is closed CSRF verification (default is allowed) Go back to the home page and configure global security options. Check that the anonymous user has read permission and save.
3 Select the Build Environment panel and run the Node command to use the NodeJS version
4. Select Add Build Procedure panel. In Windows, select Execute Windows Batch Command
NPM I && NPM run build && xcopy.\dist\* E:\server\dist\ /s/ E /y # . This directory is the static server resource directory. 5 Operation after build there is no server for now. First go here and finally click “Build New” to start build
You can see the build going on here and when the build is finished you can click to see the console output