更新时间:2024-09-25 GMT+08:00
分享

准备Jenkins环境

环境信息说明

在Linux虚拟机上安装Jenkins,本实践使用的具体环境信息如下所示。如果使用镜像包部署,需要在虚拟机中安装Docker。

  • 虚拟机:CentOS 7.9
  • Jenkins:2.319.3
  • git:yum安装
  • JDK:11.0.8
  • Apache Maven:3.8.6

部署的Jenkins启动时需添加参数:

-Dhudson.security.csrf.GlobalCrumbIssuerConfiguration.DISABLE_CSRF_PROTECTION=true

否则GitLab对接Jenkins会失败,报错信息如下:

HTTP Status 403 - No valid crumb was included in the request

相关软件下载及安装

安装后检查

  • 检查git:
    [root@ecs-jenkins ~]# git version
    git version 1.8.3.1
  • 检查JDK:
    [root@ecs-jenkins jar]# java -version
    openjdk version "1.8.0_345"
    OpenJDK Runtime Environment (build 1.8.0_345-b01)
    OpenJDK 64-Bit Server VM (build 25.345-b01, mixed mode)
  • 检查Maven:
    [root@ecs-jenkins jar]# mvn -v
    Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
    Maven home: /root/app/maven/apache-maven-3.8.6
    Java version: 11.0.8, vendor: Huawei Technologies Co., LTD, runtime: /root/app/jdk11/jdk-11.0.8
    Default locale: en_US, platform encoding: UTF-8
    OS name: "linux", version: "3.10.0-1160.76.1.el7.x86_64", arch: "amd64", family: "unix"
  • 检查Docker:
    [root@ecs-jenkins jar]# docker version
    Client:
     Version:         1.13.1
     API version:     1.26
     Package version: docker-1.13.1-209.git7d71120.el7.centos.x86_64
     Go version:      go1.10.3
     Git commit:      7d71120/1.13.1
     Built:           Wed Mar  2 15:25:43 2022
     OS/Arch:         linux/amd64
    Server:
     Version:         1.13.1
     API version:     1.26 (minimum version 1.12)
     Package version: docker-1.13.1-209.git7d71120.el7.centos.x86_64
     Go version:      go1.10.3
     Git commit:      7d71120/1.13.1
     Built:           Wed Mar  2 15:25:43 2022
     OS/Arch:         linux/amd64
     Experimental:    false

相关文档