gitlab-ci-local
gitlab-ci-local copied to clipboard
Support needs specified inside rules
Minimal .gitlab-ci.yml illustrating the issue
variables:
OVERRIDE_NEEDS_TO: "a"
build-a:
stage: build
script: echo "Feature branch, so building dev version..."
build-b:
stage: build
script: echo "Default branch, so building prod version..."
tests:
stage: test
needs:
- job: build-a
optional: true
- job: build-b
optional: true
rules:
- if: $OVERRIDE_NEEDS_TO == "a"
needs: ['build-a']
- if: $OVERRIDE_NEEDS_TO == "b"
needs: ['build-b']
script: echo "Running dev specs by default, or prod specs when default branch..."
Experienced output
❯ gitlab-ci-local --list
Using fallback git commit data
Unable to retrieve default remote branch, falling back to `main`. The default remote branch can be set via `git remote set-head origin <default_branch>`Using fallback git remote data
parsing and downloads finished in 51 ms.
json schema validated in 133 ms
name description stage when allow_failure needs
build-a build on_success false
build-b build on_success false
tests test on_success false [build-a,build-b]
Expected behavior
Tests to have a non-optional dependency on build-a only
Host information CachyOS gitlab-ci-local 4.60.0 Containerd binary No, running this directly
Additional context Add any other context about the problem here.
Uh, that must be a new feature. I'm pretty sure we do not support needs in rules. So this is a feature request 👍