Skip to content
Verified Commit 5827d192 authored by Matthew Clarkson's avatar Matthew Clarkson
Browse files

refactor: change `input:extend` to `string` from `array`

BREAKING CHANGE: The ruleset `input:extend` is now a `string` rather than an `array`.

The change allows the rulesets to use the [`!reference` tags][reference] tags with `$[[ inputs.extends ]]`.

Previously with an array, it was not possible to use the `!reference` concept.

This breaks any usage of the `input:extend`.

In _most_ cases, the change is to switch from an array to a string:

```yaml
include:
  - component: "${CI_SERVER_HOST}/ci/component/bazelisk/ruleset@v1.2.1"
    inputs:
      extends:
        - .base

.base:
  extends: .job
  before_script:
    - echo world
```

Changes to:

```yaml
include:
  - component: "${CI_SERVER_HOST}/ci/component/bazelisk/ruleset@v1.2.1"
    inputs:
      extends: .base

.base:
  extends: .job
  before_script:
    - echo world
```

In the case of multiple extensions, switch to a single extended job:

```yaml
include:
  - component: "${CI_SERVER_HOST}/ci/component/bazelisk/ruleset@v1.2.1"
    inputs:
      extends:
        - .hello
        - .world

.hello:
  extends: .job
  before_script:
    - echo world

.world:
  extends: .job
  after_script:
    - echo world
```

Would change to:

```yaml
include:
  - component: "${CI_SERVER_HOST}/ci/component/bazelisk/ruleset@v1.2.1"
    inputs:
      extends: .base

.hello:
  extends: .job
  before_script:
    - echo world

.world:
  extends: .job
  after_script:
    - echo world

.base:
  extends:
    - .hello
    - .world
```

[reference]: https://docs.gitlab.com/ci/yaml/yaml_optimization/#reference-tags
parent a81c404c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment