Support empty script in CI job when using image entry point

Description

I would like to be able to have a job in CI that just runs a docker image, without having to specify a script.

At the moment, gitlab-ci.yml is rejected with "yaml invalid" when there is a job without specified script.

Proposal

In gitlabi-ci, don't reject a job that

  • has an image defined
  • does not have a script defined

Overview

This proposal makes writing jobs in CI simpler: It let's you have a docker image that does a particular job with your code, and gives you the possibility of moving the script to the image, leading to shorter and streamlined jobs in CI, and DRYer code - one example is a universal way of composing documenatation for all (or most) of your projects. This way you just have to specify - in every project (which should compile/publish documentation) which image to use.

The underlying business problem is that there are some tasks which are common to most or all projects, and this feature would make it a bit easier to manage those.

Use cases

One (my) use case is a pages job: Using a docker image that, upon checking in a project, compiles predefined files (readme and changelog) into a static web site using a script contained in the image and specified with CMD in the corresponding docker file, and thereafter making the compiled files available through artifacts.

Particular code example:

pages:
  stage: build and publish docs
  image: $CI_REGISTRY/tools/docs-builder
  artifacts:
    paths:
      - public
  tags:
    - pages

Feature checklist

Make sure these are completed before closing the issue, with a link to the relevant commit.

  • Feature assurance
  • Documentation
  • Added to features.yml
Edited Feb 24, 2022 by Fabien Catteau
Assignee Loading
Time tracking Loading