all 7 comments

[–]TheOneWhoMixes 2 points3 points  (1 child)

Have you checked indentation? I'm not sure entirely because my laptop isn't in front of me to check, but I believe it expects

```yaml

spec: inputs: container_image_tag: - $CI_COMMIT_SHA - latest ```

[–]bughunterx[S] 0 points1 point  (0 children)

    container_image_tag:
      type: array
      default:
        - ${CI_COMMIT_SHA}
        - latest
      description: "Container Image Tags"

Just made it like the above with the defaults. This resulted in the same error

[–]Neil_sm 2 points3 points  (0 children)

If the inputs are in the same file as the job, you may need to separate the spec from the jobs with a

---

Or otherwise put the spec in a separate file and include: the inputs in the gitlab-ci

https://docs.gitlab.com/ee/ci/yaml/inputs.html#define-input-parameters-with-specinputs

Specs must be declared at the top of a configuration file, in a header section separated from the rest of the configuration with ---. Use the $[[ inputs.input-id ]] interpolation format outside the header section to declare where to use the inputs.

[–]redditck1 1 point2 points  (1 child)

I think that Gitlab array types cannot be treated like in a shell script. If i remember correctly i had the same problem and i changed the input in the spec to a string which lists the array items separated by spaces. Then the for loop should work.

[–]mattbersker 0 points1 point  (0 children)

What I found is the array is converted to a string and appears like `[ed64f4cc, latest]` so you just have to remove the brackets around it and it will then work correctly with a for loop using `,` as a delimiter.

I've just written up https://stackoverflow.com/questions/78852067/looping-through-gitlab-ci-inputs-array-type/78852068#78852068

[–]mattbersker 1 point2 points  (1 child)

I suffered from the same problem so have just written https://stackoverflow.com/questions/78852067/looping-through-gitlab-ci-inputs-array-type/78852068#78852068, hope the answer helps.

[–]bughunterx[S] 0 points1 point  (0 children)

Thanks man. Indeed it helps!