Skip to content

empty MR_ACCESS_TOKEN uncaugt exception

📝 Description

during jobs MR title and commit messages if no variable MR_ACCESS_TOKEN is supplied the following error occurs and the job fails.

error message:

Traceback (most recent call last):
  File "./gitlab-ci/conventional_commits/scripts/commit.py", line 80, in <module>
    if mr['source_branch'] == git_branch and str(mr['target_project_id']) == str(project_id) and str(mr['state']) == 'opened':
TypeError: string indices must be integers

code in question Lines 76-83:

for mr in merge_requests:

#    print('\n\nMR=[-{0}-]'.format(mr))

    if mr['source_branch'] == git_branch and str(mr['target_project_id']) == str(project_id) and str(mr['state']) == 'opened':
        mr_title = mr['title']
        mr_first_commit = mr['sha']
        target_branch = mr['target_branch']

🔗 Links / References

🚧 Tasks

  • validate the cause of the bug
  • if no MR_ACCESS_TOKEN supplied check if MR's are public, if so progress without MR_ACCESS_TOKEN variable
  • if no MR_ACCESS_TOKEN supplied and MR's are not public, fail with error that MR_ACCESS_TOKEN variable has to be supplied.
    • output error if cant access MR if no MR_ACCESS_TOKEN variable supplied
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information