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..."
                    }
                }
            }
        }
    }

  • 相关阅读:
    电商平台开发笔记5.nuxt项目中深度选择器解决el-input高度设置无效
    电商平台开发笔记4.css选择器之~波浪号使用
    电商平台开发笔记3.nuxt全局css的引入
    电商平台开发笔记2.Nuxt增加对less支持,解决This relative module was not found报错
    电商平台开发笔记1.Nuxt项目创建+Eslint代码保存自动格式化
    vue-cli 4.x 发布前的一些优化
    VueCli 4.x npm run build后主页空白的原因及解决方案
    VSCode 保存时自动ESlint格式化
    git 常用操作笔记
    VSCode下手动构建webpack项目
  • 原文地址:https://www.cnblogs.com/zhaop8078/p/10023417.html
Copyright © 2011-2022 走看看