Docs for spec:inputs:regex are wrong
Problem to solve
In the docs, at least here and here, when detailing how to use spec:inputs:regex
it indicates that the regex pattern should be enclosed in forward slashes, like in javascript.
However, if you copy the example in the docs then you always receive the error "provided value does not match required RegEx pattern". You can recreate this by copying the example in the docs above into a template file (tested on gitlab.com, so should be latest stable version):
.ci/template.yaml
spec:
inputs:
my_input:
regex: /^v\d\.\d+(\.\d+)$/
---
stages:
- my_stage
my_job:
stage: my_stage
script:
- echo "Input value is $[[ inputs.my_input ]] !"
then using it in .ci/gitlab-ci.yml
include:
- local: .ci/template.yml
inputs:
my_input: 'v1.2.3'
You will receive this error:
This is not specific to this regex, I have tried with the most wide regex patterns like /.*/
with the same result.
However, if you remove the enclosing forward slashes, it works as expected - I only worked this out by looking back at the original PR that implemented the change.
Proposal
Correct the docs!