Skip to content

Update the Kaniko template to make the job be extendible

What does this MR do and why?

Define the build job as hidden so it can be extended more flexibly

GitLab CI does not merge arrays when extending existing jobs, so it is not possible to add additional steps to rules or script without cut-and-paste of the code into your own project.

With this patch, it can be accomplished by writing:

kaniko-build:
  extends: .kaniko-build
  script:
    - !reference [.kaniko-build, script]
    - echo "One more command"

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate

  1. Make a simple .gitlab-ci.yml
    ---
    include:
       - template: Kaniko.gitlab-ci.yml
  2. Run it. Behaviour should be unchanged before and after applying the patch
  3. Try out example in commit message and see that the extra echo command is run after the other build commands.

Merge request reports