Error message: Status: Syntax is incorrect. CI configuration validated, including all configuration added with the include keyword. More information jobs:autotag:script config should be a string or a nested array of strings up to 10 levels deep

I keep receiving an error on this part of my config file and I can’t figure out the problem.

autotag:
stage: build
script:
- echo “Checking version format…”
- VERSION=$(cat version.txt)
- echo “VERSION: $VERSION”
- if [[ ! “$VERSION” =~ [1]+.[0-9]+.[0-9]+$ ]]; then echo “Invalid version format”; exit 1; fi
- if [ “$CI_COMMIT_REF_NAME” == “master” ]; then git tag -a “$VERSION” -m “Auto-tagged version $VERSION”; git push origin “$VERSION”; fi

Problem to solve

Describe your question in as much detail as possible:

  • What are you seeing, and how does that differ from what you expect to see?
  • Consider including screenshots, error messages, and/or other helpful visuals

Steps to reproduce

Which troubleshooting steps have you already taken? Can you link to any docs or other resources so we know where you have been?

Configuration

Add the CI/CD configuration from .gitlab-ci.yml and other configuration if relevant (e.g. docker-compose.yml). Alternatively, create a public GitLab.com example project that provides all necessary files to reproduce the question.

Versions

Please select whether options apply, and add the version information.

  • Self-managed
  • GitLab.com SaaS
  • Self-hosted Runners

Versions

Helpful resources

  1. Before opening a new topic, make sure to search for keywords in the forum search
  2. Check the GitLab Runner and GitLab projects for existing issues. If you encounter a bug, please create a bug report issue.
  3. Troubleshooting docs: GitLab Runner, self-managed GitLab instances.

Thanks for taking the time to be thorough in your request, it really helps! :blush:


  1. 0-9 ↩︎

Colon is used to denote key-value pairs.
Either use:

autotag:
  stage: build
  script:
    - echo "Checking version format…”
    - VERSION=$(cat version.txt)
    - |
      echo "VERSION: $VERSION”
    - if [[ ! "$VERSION” =~ +.[0-9]+.[0-9]+$ ]]; then echo "Invalid version format”; exit 1; fi
    - if [ "$CI_COMMIT_REF_NAME” == "master” ]; then git tag -a "$VERSION” -m "Auto-tagged version $VERSION”; git push origin "$VERSION”; fi

Or remove colon:

- echo "VERSION $VERSION”

Additionally, fixed tabs and replaced double quotes

1 Like