English 中文(简体)
Gitlab CI: conditionally ignore needs based on rules?
原标题:

So I have a pipeline that builds docker images to be used later by other parts of the pipeline. I have set things up so this image-building part of the pipeline only triggers if special tags are included in the commit message, to avoid rebuilding them unless necessary. But there are quite a few images and now I m trying to figure out how to make this even more fine-grained so that I can rebuild just some images when required.

Here s the idea. In my gitlab-ci.yml there is:

build-base:
  stage: build-images
  extends: .template_build_image
  variables:
    IMAGE_NAME: base
  rules:
    - if:  $CI_COMMIT_MESSAGE =~ /^.*[build-images].*$/s 

build-environment:
  stage: build-images
  needs: [build-base]
  extends: .template_build_image
  variables:
    IMAGE_NAME: environment
  rules:
    - !reference [build-base, rules]

...
<and others>

I can add more rules for more tags easily enough, like make a rule for build-environment to add it to the pipeline if [build-environment] is in the commit message. My problem is that build-environment needs build-base. I.e. gitlab will complain if I try to run build-environment without build-base in the pipeline. And I don t want to remove these needs relationships because when I am running the whole pipeline those relationships are important. I just want to selectively ignore them sometimes when I "manually" want to skip some initial steps in the pipeline (and just use the e.g. base image already in my image registry).

Is there some way to achieve this in gitlab CI?

问题回答

暂无回答




相关问题
Gitlab CI: conditionally ignore needs based on rules?

So I have a pipeline that builds docker images to be used later by other parts of the pipeline. I have set things up so this image-building part of the pipeline only triggers if special tags are ...

Google Colab x Gitlab Repository cloning problem

I am trying to clone my repository in Gitlab to Google Colab but kept receiving this below error. Google Colab has no issue with Github project cloning but Gitlab doesn t seem work. Cloning into <...

gitlab compare - get raw patch / diff file

My situation In both github and gitlab, I can compare two branches or refs in the UI: github: https://github.com/*/*/compare/1.x...2.x gitlab: https://*.*.*/*/*/-/compare/1.x...2.x In github, I can ...

Gitlab CI On Prem, Docker Image and ASP.NET Core 7

We have a .NET 6 application. We added CI using: image: mcr.microsoft.com/dotnet/sdk:6.0 before_script: - dotnet restore --packages $NUGET_PACKAGES_DIRECTORY build: stage: build script: - ...

4. 吉拉布-西姆勒,以创造合并后

我在DEV分行有以下电离板-ci.yml文档,其目标也是平等与发展。 由于将TARGET作为MASTER,没有自动产生MR。 我要知道......

How to find a deleted file in the project commit history?

Once upon a time, there was a file in my project that I would now like to be able to get. The problem is: I have no idea of when have I deleted it and on which path it was. How can I locate the ...

热门标签