Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitLab !reference Keyword causes YAMLException #9162

Closed
1 of 5 tasks
deveth0 opened this issue Mar 16, 2021 · 10 comments · Fixed by #9163
Closed
1 of 5 tasks

GitLab !reference Keyword causes YAMLException #9162

deveth0 opened this issue Mar 16, 2021 · 10 comments · Fixed by #9163
Assignees
Labels
manager:gitlabci GitLab CI config files priority-2-high Bugs impacting wide number of users or very important features status:in-progress Someone is working on implementation type:bug Bug fix of existing functionality

Comments

@deveth0
Copy link

deveth0 commented Mar 16, 2021

What Renovate type, platform and version are you using?

Renovate 24.85.1, both on self-hosted GitLab and GitLab.com

Describe the bug

I recently added a project to renovate's scope that includes a gitlab-ci.yml that uses the !reference keyword:

include:
  - local: setup.yml
  
test:
  script:
    - !reference [.setup, script]
    - echo running my own command

When running renovate, it tries to validate the yml file but failes, cause !reference is not a valid identifier in yml.

Relevant debug logs

ERROR: Repository has unknown error (repository=deveth0/renovate-runner-demo)
       "err": {
         "name": "YAMLException",
         "reason": "unknown tag !<!reference>",
         "mark": {
           "name": null,
           "buffer": "\ninclude:\n  - local: setup.yml\n  \ntest:\n  script:\n    - !reference [.setup, script]\n    - echo running my own command\n\u0000",
           "position": 83,
           "line": 6,
           "column": 33
         },
         "message": "unknown tag !<!reference> at line 7, column 34:\n        - !reference [.setup, script]\n                                     ^",
         "stack": "YAMLException: unknown tag !<!reference> at line 7, column 34:\n        - !reference [.setup, script]\n                                     ^\n    at generateError (/usr/src/app/node_modules/js-yaml/lib/js-yaml/loader.js:167:10)\n    at throwError (/usr/src/app/node_modules/js-yaml/lib/js-yaml/loader.js:173:9)\n    at composeNode (/usr/src/app/node_modules/js-yaml/lib/js-yaml/loader.js:1434:7)\n    at readBlockSequence (/usr/src/app/node_modules/js-yaml/lib/js-yaml/loader.js:955:5)\n    at composeNode (/usr/src/app/node_modules/js-yaml/lib/js-yaml/loader.js:1358:12)\n    at readBlockMapping (/usr/src/app/node_modules/js-yaml/lib/js-yaml/loader.js:1089:11)\n    at composeNode (/usr/src/app/node_modules/js-yaml/lib/js-yaml/loader.js:1359:12)\n    at readBlockMapping (/usr/src/app/node_modules/js-yaml/lib/js-yaml/loader.js:1089:11)\n    at composeNode (/usr/src/app/node_modules/js-yaml/lib/js-yaml/loader.js:1359:12)\n    at readDocument (/usr/src/app/node_modules/js-yaml/lib/js-yaml/loader.js:1525:3)\n    at loadDocuments (/usr/src/app/node_modules/js-yaml/lib/js-yaml/loader.js:1588:5)\n    at load (/usr/src/app/node_modules/js-yaml/lib/js-yaml/loader.js:1614:19)\n    at Object.safeLoad (/usr/src/app/node_modules/js-yaml/lib/js-yaml/loader.js:1637:10)\n    at Object.extractAllPackageFiles (/usr/src/app/node_modules/renovate/lib/manager/gitlabci/extract.ts:99:22)\n    at Object.extractAllPackageFiles (/usr/src/app/node_modules/renovate/lib/manager/index.ts:62:17)\n    at Object.getManagerPackageFiles (/usr/src/app/node_modules/renovate/lib/workers/repository/extract/manager-files.ts:33:29)\n    at /usr/src/app/node_modules/renovate/lib/workers/repository/extract/index.ts:52:28\n    at async Promise.all (index 0)\n    at Object.extractAllDependencies (/usr/src/app/node_modules/renovate/lib/workers/repository/extract/index.ts:50:26)\n    at Object.checkOnboardingBranch (/usr/src/app/node_modules/renovate/lib/workers/repository/onboarding/branch/index.ts:45:24)"
       }
 INFO: Repository finished (repository=deveth0/renovate-runner-demo)
       "durationMs": 2242
 INFO: Renovate is exiting with a non-zero code due to the following logged errors
       "loggerErrors": [
         {
           "name": "renovate",
           "level": 50,
           "logContext": "3YKhMDSqL",
           "repository": "deveth0/renovate-runner-demo",
           "err": {
             "name": "YAMLException",
             "reason": "unknown tag !<!reference>",
             "mark": {
               "name": null,
               "buffer": "\ninclude:\n  - local: setup.yml\n  \ntest:\n  script:\n    - !reference [.setup, script]\n    - echo running my own command\n\u0000",
               "position": 83,
               "line": 6,
               "column": 33
             },
             "message": "unknown tag !<!reference> at line 7, column 34:\n        - !reference [.setup, script]\n                                     ^",
             "stack": "YAMLException: unknown tag !<!reference> at line 7, column 34:\n        - !reference [.setup, script]\n                                     ^\n    at generateError (/usr/src/app/node_modules/js-yaml/lib/js-yaml/loader.js:167:10)\n    at throwError (/usr/src/app/node_modules/js-yaml/lib/js-yaml/loader.js:173:9)\n    at composeNode (/usr/src/app/node_modules/js-yaml/lib/js-yaml/loader.js:1434:7)\n    at readBlockSequence (/usr/src/app/node_modules/js-yaml/lib/js-yaml/loader.js:955:5)\n    at composeNode (/usr/src/app/node_modules/js-yaml/lib/js-yaml/loader.js:1358:12)\n    at readBlockMapping (/usr/src/app/node_modules/js-yaml/lib/js-yaml/loader.js:1089:11)\n    at composeNode (/usr/src/app/node_modules/js-yaml/lib/js-yaml/loader.js:1359:12)\n    at readBlockMapping (/usr/src/app/node_modules/js-yaml/lib/js-yaml/loader.js:1089:11)\n    at composeNode (/usr/src/app/node_modules/js-yaml/lib/js-yaml/loader.js:1359:12)\n    at readDocument (/usr/src/app/node_modules/js-yaml/lib/js-yaml/loader.js:1525:3)\n    at loadDocuments (/usr/src/app/node_modules/js-yaml/lib/js-yaml/loader.js:1588:5)\n    at load (/usr/src/app/node_modules/js-yaml/lib/js-yaml/loader.js:1614:19)\n    at Object.safeLoad (/usr/src/app/node_modules/js-yaml/lib/js-yaml/loader.js:1637:10)\n    at Object.extractAllPackageFiles (/usr/src/app/node_modules/renovate/lib/manager/gitlabci/extract.ts:99:22)\n    at Object.extractAllPackageFiles (/usr/src/app/node_modules/renovate/lib/manager/index.ts:62:17)\n    at Object.getManagerPackageFiles (/usr/src/app/node_modules/renovate/lib/workers/repository/extract/manager-files.ts:33:29)\n    at /usr/src/app/node_modules/renovate/lib/workers/repository/extract/index.ts:52:28\n    at async Promise.all (index 0)\n    at Object.extractAllDependencies (/usr/src/app/node_modules/renovate/lib/workers/repository/extract/index.ts:50:26)\n    at Object.checkOnboardingBranch (/usr/src/app/node_modules/renovate/lib/workers/repository/onboarding/branch/index.ts:45:24)"
           },
           "msg": "Repository has unknown error"
         }
       ]

Have you created a minimal reproduction repository?

  • This is a really small bug, it does not need a reproduction (think small typo)
  • I have provided a minimal reproduction repository
  • I don't have time for that, but it happens in a public repository I have linked to
  • I don't have time for that, and cannot share my private repository
  • The nature of this bug means it's impossible to reproduce publicly

Sure :)

Additional context

@deveth0 deveth0 added priority-5-triage status:requirements Full requirements are not yet known, so implementation should not be started type:bug Bug fix of existing functionality labels Mar 16, 2021
@viceice viceice added manager:gitlabci GitLab CI config files priority-2-high Bugs impacting wide number of users or very important features and removed priority-5-triage labels Mar 16, 2021
@viceice
Copy link
Member

viceice commented Mar 16, 2021

it's because of #8810

@viceice
Copy link
Member

viceice commented Mar 16, 2021

adding a try-catch block as workaround now

@deveth0
Copy link
Author

deveth0 commented Mar 16, 2021

wow, that was fast :)

I just modified the demo project to use "remote" instead of "local", just to verifiy. Same issue.

@viceice
Copy link
Member

viceice commented Mar 16, 2021

Do you have a documentation for the !reference [.setup, script] expression?

@HonkingGoose HonkingGoose added status:in-progress Someone is working on implementation and removed status:requirements Full requirements are not yet known, so implementation should not be started labels Mar 16, 2021
@deveth0
Copy link
Author

deveth0 commented Mar 16, 2021

@viceice sure, I just used the gitlab documentation for the mvp: https://docs.gitlab.com/ee/ci/yaml/#reference-tags

@github-actions
Copy link
Contributor

Thank you for providing a reproduction! 🎉 🚀

The Renovate team will take a look at the reproduction repository. Once we confirm the provided repository reproduces the problem, the label will be changed to reproduction:confirmed.

@viceice
Copy link
Member

viceice commented Mar 16, 2021

PR waiting for review 🙃

@deveth0
Copy link
Author

deveth0 commented Mar 16, 2021

awesome, thank you! I'll keep you posted, if the build still fails when this is released ;)

@renovate-release
Copy link
Collaborator

🎉 This issue has been resolved in version 24.87.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@deveth0
Copy link
Author

deveth0 commented Mar 17, 2021

works fine!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
manager:gitlabci GitLab CI config files priority-2-high Bugs impacting wide number of users or very important features status:in-progress Someone is working on implementation type:bug Bug fix of existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants