Skip to content

gitlab secrets, build args are not passed to kaniko at build time by default

Kaniko does not consider any build arguments, nor secrets from gitlab by default.

Steps to reproduce:

  1. clone example repo

  2. add:

    ARG BUILDARG
    RUN echo I received "${BUILDARG}" from kaniko!
  3. Add BUILDARG in your CI/CD settings.

Example here: https://gitlab.cern.ch/dsouthwi/build_docker_image/-/jobs/5328661

This may be fixed by modifying the build argument for kaniko with docker-style --build-arg ARG_IN_GITLAB=$GITLAB_VAR_NAME for every single argument, but is painful for builds with many arguments.

Is there a gitlab array argument that might be passed? i.e. --build-arg $CI_USER_ARGS=[for arg in $CI_USER_ARGS;do;ARG=${ARG};done;] etc?

Edited by David Southwick