firecow / gitlab-ci-local

Tired of pushing to test your .gitlab-ci.yml?
MIT License
2.21k stars 125 forks source link

Define inputs for configuration added with include #1072

Closed bataliero closed 8 months ago

bataliero commented 8 months ago

Is your feature request related to a problem? Please describe.

I would like to be able to use spec:inputs for my reusable pipelines imported with include in the projects.

I have tried to run an example from GitLab documentation

spec:
  inputs:
    job-stage:
    environment:
---
scan-website:
  stage: $[[ inputs.job-stage ]]
  script: echo $[[ inputs.environment ]]

and

include:
  - local: "../<path>/main.yaml"
    inputs:
      job-stage: "example1"
      environment: "staging"

However gitlab-ci-local shows me this:

YAMLException: expected a single document in the stream, but found more
    at Object.load (/snapshot/firecow-gitlab-ci-local/node_modules/js-yaml/lib/loader.js:1722:9)
    at Function.loadYaml (/snapshot/firecow-gitlab-ci-local/src/parser.ts:244:21)
    at Function.init (/snapshot/firecow-gitlab-ci-local/src/parser-includes.ts:74:37)
    at Parser.init (/snapshot/firecow-gitlab-ci-local/src/parser.ts:83:44)
    at Function.create (/snapshot/firecow-gitlab-ci-local/src/parser.ts:54:9)
    at handler (/snapshot/firecow-gitlab-ci-local/src/handler.ts:96:18)
    at Object.handler (/snapshot/firecow-gitlab-ci-local/src/index.ts:36:21)

Describe the solution you'd like I would like to have spec:inputs implemented.

Thanks!

firecow commented 8 months ago

I'm marking this a duplicate of https://github.com/firecow/gitlab-ci-local/issues/940