防止jenkins远程执行脚本kill掉子进程

在execute shell输入框中加入
BUILD_ID=DONTKILLME,
即可防止jenkins杀死如:项目的启动脚本,git clone批量脚本。。。等

 

 

复制代码
    //阶段2 获取代码
    stage("获取代码"){
        steps{
            script{
                   PrintMes("获取代码","green")
sh '''
BUILD_ID=DONTKILLME
wget -q http://172.31.170.18:8888/chfs/shared/k8s-java/batch/app-git-clone.sh -O ./app-git-clone.sh
sed -i  "s|appinfoUrl|$appinfoUrl|g" app-git-clone.sh
sed -i  "s|group|$group|g" app-git-clone.sh
/bin/sh app-git-clone.sh
'''                    
                  
         
            }
   
复制代码

 

 

  • 批量git clone 脚本
    复制代码
    #!/bin/bash
    deploy_name=`curl -s appinfoUrl| /usr/bin/jq -r ".info.group[0]"|/usr/bin/jq -r 'keys[]'`
    
    rm -rf kkcloud*
    
    for i in $(echo $deploy_name)
    do
    app_git_url=`curl -s appinfoUrl| /usr/bin/jq -r ".info.group[0].${i}[0].git"|awk -F"//"  '{print $2}'`
    app_git_branch=`cat group.info|/usr/bin/jq -r ".${i}"|grep -v 'null'`
    git clone -b ${app_git_branch} http://pushom:!%40%23%24%25%5E@${app_git_url}
    done
    复制代码

     

  • 特殊字符密码utl转码
    http://tools.jb51.net/static/encodetxt/urlencode_decode/index.html
posted @   awks  阅读(200)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· AI与.NET技术实操系列(六):基于图像分类模型对图像进行分类
点击右上角即可分享
微信分享提示