zoukankan      html  css  js  c++  java
  • Jenkins配置安装

    一、安装

    [root@localhost ~]# wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins.io/redhat-stable/jenkins.repo

    [root@localhost ~]# rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key

    [root@localhost ~]# yum -y install java

    [root@localhost ~]# java -version

    [root@localhost ~]# yum -y install jenkins

    [root@localhost ~]# vim /etc/sysconfig/jenkins

    29 JENKINS_USER="dxwh8078"

    56 JENKINS_PORT="8080"

    #修改jenkins的家目录

    [root@localhost ~]# chown -R dxwh8078.dxwh8078 /var/lib/jenkins

    #修改jenkins的日志目录

    [root@localhost ~]# chown -R dxwh8078.dxwh8078 /var/log/Jenkins

    [root@localhost ~]# chown dxwh8078.dxwh8078 -R /var/cache/jenkins

    #启动服务

    [root@localhost ~]# systemctl start jenkins

    [root@localhost ~]# lsof -i:8080

    #在网站上打开如下网址

    http://192.168.10.105:8080/

    #查看密码

    [root@localhost ~]# cat /var/lib/jenkins/secrets/initialAdminPassword

    #输入初始化密码

    #选择推荐安装

    账号root 密码 aN7Bn3Kj

    [root@ansiblejankinx ~]# yum -y install git curl

    #关闭系统当前的git安全认证

    [root@ansiblejankinx ~]# git config --system http.sslverify false

    二、jenkins的说明

     

     

     

    三、jenkins的编程模板

    #!groovy
    
    pipeline {
        agent {node {label 'master'}}
        
        environment {
            PATH="/bin:sbin:/usr/bin:/usr/sbin:/usr/local/bin"
        }
        
        parameters {
            choice(
                choices: 'dev
    prod',
                description: 'choose deploy environment',
                name: 'deploy_env'
                )
            string (name: 'version', defaultValue: '1.0.0', description: 'build version')
        }
        stages {
            stage("Checkout test repo") {
                steps{
                    sh 'git config --global http.sslVerify false'
                    dir ("${env.WORKSPACE}") {
                        git branch: 'master', credentialsId:"302e9299-8eb8-44d7-a0dc-33671b8acea4", url: 'https://root@gitlab.example.com/root/test-repo.git'
                    }
                }
            }
            stage("Print env variable") {
                steps {
                    dir ("${env.WORKSPACE}") {
                        sh """
                        echo "[INFO] Print env variable"
                        echo "Current deployment environment is $deploy_env" >>test.properties
                        echo "The build is $version" >> test.properties
                        echo "[INFO] Done..."
                        """
                    }
                }
            }
            stage("Check test properties") {
                steps{
                    dir ("${env.WORKSPACE}") {
                        sh """
                        echo "[INFO] Check test
                        if [ -s test.properties ]
                        then
                            cat test.properties
                            echo "[INFO] Done..."
                        else
                            echo "test.properties is empty"
                        fi
                        """
                        
                        echo "[INFO] Build finished..."
                    }
                }
            }
        }
    }

  • 相关阅读:
    简介&目录
    Lucas 定理
    扩展欧几里得算法(exgcd)
    【做题记录】CF23B Party
    【做题记录】CF1375D Replace by MEX
    【做题记录】CF194B Square
    SPFA
    dijkstra
    CSP-J&S 2020 游记
    中国剩余定理(CRT)
  • 原文地址:https://www.cnblogs.com/zhaop8078/p/10023417.html
Copyright © 2011-2022 走看看