Skip to content

Support remote for remote file includes for inputs

As part of being able to include inputs defined in a different yaml file hosted at an endpoint, we want to support remote keyword in spec:include: as defined follows:

Inputs defined in another yaml (http://gitlab.com/namespace/file.yml) file in a public endpoint:

inputs:
  environment:
    default: "staging"
    options: ["development", "staging", "production"]
  app_version:
    default: "1.0.0"
  replicas:
    type: number
    default: 3

Using the same file in the main .gitlab-ci.yml file:

spec:
  include:
    - remote: 'http://gitlab.com/namespace/file.yml'
    - integrity: 'sha256-L3/GAoKaw0Arw6hDCKeKQlV1QPEgHYxGBHsH4zG1IY8='
  inputs:
    job_prefix:
      description: "Prefix for job names (inline)"
      default: "inline"
    environment:
      default: "production"  # This should override external
---


$[[ inputs.job_prefix ]]-test:
  script:
    - echo "Environment (should be inline-production):" $[[ inputs.environment ]]
    - echo "Job prefix (inline only):" $[[ inputs.job_prefix ]]
    - echo "App version (from external):" $[[ inputs.app_version ]]
    - echo "Replicas (from external):" $[[ inputs.replicas ]]

We should also support it along with integrity in case a user wants us to be able to verify the authenticity of the file.

Edited by Rajendra Kadam