zoukankan      html  css  js  c++  java
  • Jenkins Job构建

    Jenkins job介绍

    Jenkins Freestyle与Pipeline Job区别

    Jenkins Job构建配置

    一 、环境准备

    1.配置Jenkins server本地Gitlab DNS

    2.安装git client, curl工具依赖

    3.关闭系统Git http.ssIVerify安全认证

    4.添加Jenkins后台Git client user与email

    5.添加Jenkins后台 Git Credential凭据

    进入路径-工作台》系统管理》系统配置》Git plugin

    填写用户名和邮箱,点击【保存】

    添加Jenkins后台 Git Credential凭据

    进入路径-工作台》Jenkins》全局凭据》添加凭据

    添加用户和密码,点击【确定】

    二、Jenkins freestyle Job构建配置

    1.创建一个Freestyle project

    进入路径-工作台》新建任务》Freestyle project

    输入任务名称test-freestyle-job,点击【确定】

    2.编辑描述信息

    填写描述信息:This is my first test freestyle job

    3.源代码管理

    添加gitlab仓库地址、添加账户密码

    选择参数化构建过程,然后选择“选项参数”。

    填写参数

    继续添加参数Multi-line String Parameter

    选择master分支

    4.Build配置

    添加执行脚本,点击【应用】

    填写脚本,将参数deploy_env、version传入到shell脚本中,并重定向到test.properties的文件下;判断test.properties文件是否存在

    #!/bin/sh
    
    export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
    
    # Print env variable
    echo "[INFO] Print env variable"
    echo "Current deployment envrionment is $deploy_env" >> test.properties
    echo "THe build is $version" >> test.properties
    echo "[INFO] Done..."
    
    # Check test properties
    echo "[INFO] Check test properties"
    if [ -s test.properties ]
    then
      cat test.properties
      echo "[INFO] Done..."
    else
      echo "test.properties is empty"
    fi
    
    echo "[INFO] Build finished..."

    返回项目,选择dev,点击【开始构建】

    构建完成,查看控制台输出

  • 相关阅读:
    hdu1247 字典树或者hash
    hdu1247 字典树或者hash
    hdu1251 hash或者字典树
    hdu1251 hash或者字典树
    hdu4421 2-sat(枚举二进制每一位)
    hdu4421 2-sat(枚举二进制每一位)
    poj3648 2-sat
    poj3648 2-sat
    hdu 1814 字典序最小的2sat(暴力深搜)
    hdu 1814 字典序最小的2sat(暴力深搜)
  • 原文地址:https://www.cnblogs.com/joy-sir/p/12165026.html
Copyright © 2011-2022 走看看