- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有 monorepo,我想根据已更改的目录内容运行子管道。在职 prepare_config
我检查最新更改的位置,创建子配置 yml 并在下一阶段的工作中 run_child
我从 .
问题是,如果 model-gitlab-ci.yml
不存在,则作业 run_child
由于缺少工件而失败而不是跳过。我搜索了只有在工件存在而不是失败的情况下才有条件地运行作业的解决方案,但没有找到任何解决方案。也许这里有人有一些想法?.gitlab-ci.yml
:
stages:
- .pre
- build
prepare_config:
stage: .pre
tags:
- sometag
rules:
- if: $CI_COMMIT_TAG == null
when: always
changes:
- '.gitlab-ci.yml'
- 'DIR_A/**/*'
- 'DIR_B/**/*'
- 'DIR_C/**/*'
script:
- |-
files=$(git diff-tree --name-only --no-commit-id ${CI_MERGE_REQUEST_TARGET_BRANCH_SHA:-$CI_COMMIT_SHA})
echo "Files changed: $files"
for f in $files; do
if [ -d $f ]; then
sed "s/{{ MODEL_NAME }}/$f/g" .gitlab-ci-template.yml >> model-gitlab-ci.yml
fi
done
artifacts:
paths:
- "model-gitlab-ci.yml"
run_child:
stage: build
rules:
- if: $CI_COMMIT_TAG == null
when: always
needs:
- job: prepare_config
artifacts: true
trigger:
include:
- artifact: model-gitlab-ci.yml
job: prepare_config
strategy: depend
最佳答案
作业“jsonnet”使用 jsonnet 从文件“trigger.jsonnet”生成 YAML 文件“trigger.yml”。如果 JSONNET 文件中的变量 triggering == true
它包含作业“artifact:helper”和“trigger”。如 triggering == false
它包含作业“not:triggered”,该作业运行为空。
需要作业“artifact:helper”,以便生成的文件“generated.yml”可以作为工件传输到触发器。如果子管道中的触发器作业想要直接使用父管道的工件,则会发生交叉依赖异常。
YAML 文件“trigger.yml”中的作业“trigger”最终从“generated.yml”触发作业“template_job”。
招聘信息 if triggering == true
招聘信息 if triggering == false
.gitlab-ci.yml
jsonnet:
image: jkblskw/jsonnet:jsonnet-curl
stage: .pre
script:
# do something
- if [ "$TEST_TRIGGER" = true ]; then TRIGGERING=true && cp template.yml generated.yml; else TRIGGERING=false; fi
- jsonnet --ext-code triggering=$TRIGGERING --ext-code pipeline_id=$CI_PIPELINE_ID trigger.jsonnet > trigger.yml
artifacts:
paths:
- trigger.yml
- generated.yml
trigger:
stage: build
trigger:
include:
- artifact: trigger.yml
job: jsonnet
strategy: depend
trigger.jsonnet
local triggering = std.extVar("triggering");
local pipeline_id = std.extVar("pipeline_id");
if triggering then
{
["artifact:helper"]: {
stage: "build",
variables: {
PARENT_PIPELINE_ID: pipeline_id
},
needs:{
pipeline: "$PARENT_PIPELINE_ID",
job: "jsonnet"
},
script: "echo 'Job needs to be executed in order for the artifact to be triggered. A trigger in the same job throws a cross-reference exception.'",
artifacts: {
paths: ["generated.yml"]
}
},
["trigger"]: {
stage: "test",
needs: ["artifact:helper"],
trigger: {
include: {
artifact: "generated.yml",
job: "artifact:helper"
},
strategy: "depend"
}
}
}else
{
["not:triggered"]: {
stage: "build",
script: "echo 'no further triggering'"
}
}
模板.yml
template_job:
stage: test
script:
- echo "running template_job"
关于continuous-integration - Gitlab CI : run job only if artifact exists,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66016408/
我想做的是分派(dispatch)一个 Job,然后在前一个 Job 完成后继续分派(dispatch)同一个 Job,这样就可以连续循环分派(dispatch) Job。如选项一所示,这以前是与数据
我想知道当一个过程通过一个作业执行时会发生什么,在它完成之前是作业调用该过程的下一次执行的时间。这是我创建的工作: DECLARE X NUMBER; BEGIN SYS.DB
我使用以下代码显示超时为 120 秒的 PowerShell 作业的结果。我想通过合并 Write-Progress(基于完成的作业数)来增强此代码。我尝试使用 this example然而,作为引用
我使用以下代码显示超时为 120 秒的 PowerShell 作业的结果。我想通过合并 Write-Progress(基于完成的作业数)来增强此代码。我尝试使用 this example然而,作为引用
这个关于 ECMAScript 规范(ECMA-262 第 8 版)的问题 这些天,我对作业和作业队列有点困惑。 这里有一些问题。 1:在ECMA-262中,有两种作业队列。一个是 ScriptJob
子进程是作业的一部分,由创建作业的进程启动。父进程尚未设置作业属性以允许脱离作业。需要在 JOB 上设置“JOB_OBJECT_LIMIT_BREAKAWAY_OK”标志以允许子进程脱离作业,但未设置
有没有人有类似于Path's Android Priority Job Queue的iOS作业队列?他们不介意与社区分享?我是 iOS 的新手,所以我不确定平台本身是否提供这样的解决方案。在 Andr
我正在关注 this在 Heroku 上安排我的 Django cron 作业。 程序文件: web: gunicorn tango.wsgi --log-file - clock: python c
UI协同程序指南包含有关如何管理UI协同程序生命周期的section。它说明了我们应该创建一个顶级Job实例,并将复合协程上下文contextJob + UI传递给我们启动的所有协程: launch(
我在 Spark 上创建了一个 Master 和一个 Worker。然后我创建了一个 Spark 流作业并尝试提交它,但在 Master 上它显示了一长串 java 错误 使用此命令启动主控: spa
我必须在 Spring Batch 上设置 jobparemeters,但使用 Spring Boot Batch 则无法轻松做到这一点。 我需要重新运行作业,但如果参数相同,spring-batch
众所周知,Apache Pig 是一种数据流语言。如果我编写了一个 Pig 脚本并且 Pig 决定拆分并运行两个或多个作业来执行手头的任务,那么 Pig 如何存储它从作业 1 传递到作业 2 的数据?
我以为他们指的是 Reducer 但在我的程序中我有 public static class MyMapper extends Mapper 和 public static class MyReduc
我需要创建一个恢复模式。 在我的模式中,我只能在给定的时间窗口内启 Action 业。 如果作业失败,它只会在下一个时间窗口重新启动,完成后我想开始为此窗口提前计划的计划作业。 作业之间的唯一区别是时
使用 play 框架 1.2.4 和 scala。我几乎没有类似的游戏工作 @OnApplicationStart class MyOtherJob extends Job { ... } @Ev
作业通知选项“作业成功时”和“作业完成时”有何区别。从表面上看,我假设“作业完成时”选项包含作业成功和作业失败,而“作业成功时”选项仅包含作业成功运行时。这是正确的吗? 最佳答案 作业成功时作业成功完
我正在尝试创建迁移,但由于以下错误而失败: Error from server (BadRequest): error when creating "kubernetes/migration-job.
Cron Job 和 hybris 中的 Job 有什么区别? 两者的创建/实现之间有什么区别? 最佳答案 下图描述了 Hybris 中 Jobs/Cronjobs 工作原理的完整 View
我正在运行多个作业,并且我希望每个作业都有一个单独的作业存储库(内存中实现)。 请在下面找到我尝试过的 bean 定义。请注意,我尝试指定具有作用域原型(prototype)的 bean。 我收到 j
Quartz 中是否有一种机制可以在启动另一个作业时删除现有作业?我需要暂停其他作业的原因是因为新作业需要所有资源可用,只有当其他作业未运行时才会如此。 这是一个示例: 我有 2 份工作:工作 A 和
我是一名优秀的程序员,十分优秀!