首页 > 其他分享 >Controlling the Flow with Stage, Lock, and Milestone

Controlling the Flow with Stage, Lock, and Milestone

时间:2024-04-19 13:33:45浏览次数:16  
标签:builds Lock Milestone Flow echo Build milestone build stage

Controlling the Flow with Stage, Lock, and Milestone

https://www.jenkins.io/blog/2016/10/16/stage-lock-milestone/

 

stage('Build') {
  // The first milestone step starts tracking concurrent build order
  milestone()
  node {
    echo "Building"
  }
}

// This locked resource contains both Test stages as a single concurrency Unit.
// Only 1 concurrent build is allowed to utilize the test resources at a time.
// Newer builds are pulled off the queue first. When a build reaches the
// milestone at the end of the lock, all jobs started prior to the current
// build that are still waiting for the lock will be aborted
lock(resource: 'myResource', inversePrecedence: true){
  node('test') {
    stage('Unit Tests') {
      echo "Unit Tests"
    }
    stage('System Tests') {
      echo "System Tests"
    }
  }
  milestone()
}

// The Deploy stage does not limit concurrency but requires manual input
// from a user. Several builds might reach this step waiting for input.
// When a user promotes a specific build all preceding builds are aborted,
// ensuring that the latest code is always deployed.
stage('Deploy') {
  input "Deploy?"
  milestone()
  node {
    echo "Deploying"
  }
}

milestone后来者运行快,并达成了milestone,则前者运行慢的build则被抛弃。

Concurrent builds of the same job do not always run at the same rate. Depending on the network, the node used, compilation times, test times, etc. it is always possible for a newer build to complete faster than an older build. For example:

  • Build 1 is triggered

  • Build 2 is triggered

  • Build 2 builds faster than Build 1 and enters the Test stage sooner.

Rather than allowing Build 1 to continue and possibly overwrite the newer artifact produced in Build 2, you can use the milestone step to abort Build 1:

stage('Build') {
  milestone()
  echo "Building"
}
stage('Test') {
  milestone()
  echo "Testing"
}

 

标签:builds,Lock,Milestone,Flow,echo,Build,milestone,build,stage
From: https://www.cnblogs.com/lightsong/p/18145710

相关文章

  • Java开发者如何使用RunFlow内置的QLExpress
    本文是为Java开发者写的手册,如果您不是Java开发者可以阅读我们的开发者篇手册,当然如果您感兴趣也可以继续阅读。输入qe进入QLExpress专注模式。执行Java代码比如数学计算:Math.sin(9);执行结果:0.4121184852417566。比如读取系统环境变量:top.myrest.myflow.util.Jackson......
  • C# Lock锁对象的理解
    我们lock的一般是对象,不是值类型和字符串。1、为什么不能lock值类型比如lock(1)呢?lock本质上Monitor.Enter,Monitor.Enter会使值类型装箱,每次lock的是装箱后的对象。lock其实是类似编译器的语法糖,因此编译器直接限制住不能lock值类型。退一万步说,就算能编译器允许你lock(1),......
  • 安装TensorFlow时timeout
    运行pip3install--upgradetensorflow时一直会报错 我看了看,报错落在timeout上 解决方法(用下面这句,用的清华镜像)pip3install--default-timeout=100tensorflow-ihttps://pypi.tuna.tsinghua.edu.cn/simple 参考——https://blog.csdn.net/weixin_43938599/artic......
  • Mac(M1)配置基于ARM64的Tensorflow
    以下步骤最好先执行condaconfig--remove-keychannels 删除conda镜像源pipconfigunsetglobal.index-url 删除pip镜像源然后接下来的步骤最好挂上梯子。1.下载miniforge:从https://github.com/conda-forge/miniforge上找到arm64(AppleSilicon)版本进行下载,下一步下一步的......
  • 解决加载GPT2(Tensorflow预训练模型)的Linear权重到PyTorch的Linear权重 形状不匹配(互为
    解决报错内容:RuntimeError:Error(s)inloadingstate_dictforPyTorchBasedGPT2:sizemismatchfortransformer.h.0.attn.c_attn.weight:copyingaparamwithshapetorch.Size([768,2304])fromcheckpoint,theshapeincurrentmodelistorch.Size([2304,768]).........
  • 关于flowable(6
    关于flowable(6.8.0)一些关键表和关键参数的记录一、关键字(我在项目中接触比较多的flowable实体类)后续待补充。。。。静态关键字描述flowelement流程模型中的节点是一个event,线也是一个eventmodel表示存储在模型存储库中的模型。此外,还可以在单独的部署步骤中将......
  • Chrome跨域问题:查看图片报错has been blocked by CORS policy: The request client is
    Chrome跨域问题:hasbeenblockedbyCORSpolicy:Therequestclientisnotasecurecontextandtheresourceisinmore-privateaddressspaceprivate已被CORS策略阻止:请求客户端不是安全上下文,资源位于更私有的地址空间私有问题原因:公网资源(访问者)访问私网资源......
  • 现场取证之Bitlocker加密问题
    在取证工作中Bitlocker加密对于调查人员早已司空见惯了。2020年1月微软正式终止了对Windows7的安全更新及系统支持,这也意味着属于它的时代已经结束了。而对于Windows10以及Windows11版本的操作系统,甚至在首次激活和使用系统时,在默认情况下就会对磁盘驱动器进行加密。Windows......
  • 【加解密篇】电子数据分析之特殊的自加密BitLocker解密
    数据加解密通常是个耗时费力的事情---【蘇小沐】1实验环境Windows11专业版,[23H2(22631.3007)]1 (一)自动开启BitLocker之天坑1经验之谈在2019、2020年左右开始,新发布的品牌笔记本电脑很多都默认打开了Windows操作系统的BitLocker功能,消费级笔记本电脑预装系统......
  • 13、OSPF Database Overflow
    OSPFDatabaseOverflow 定义OSPF协议要求同一个区域中的路由器保存相同的链路状态数据库LSDB(Link-StateDatabase)。随着网络上路由数量不断增加,一些路由器由于系统资源有限,不能再承载如此多的路由信息,这种状态就被称为数据库超限(OSPFDatabaseOverflow)。目的对于路由......