In GitLab, when a pipeline is not triggered by a commit or by a merge or pull request but it is manually launched, the environment variable CI_COMMIT_BEFORE_SHA is set to "000000000000000000000000000000000", thus leading to the following error:
$ echo "CI_COMMIT_BEFORE_SHA is $CI_COMMIT_BEFORE_SHA"
CI_COMMIT_BEFORE_SHA is 0000000000000000000000000000000000000000
$ dco-check
Detected: GitLab
Checking commits: 0000000000000000000000000000000000000000..114574cb574880de5fc0182828076bbb11a0da55
error: fatal: Invalid revision range 0000000000000000000000000000000000000000..114574cb574880de5fc0182828076bbb11a0da55
Traceback (most recent call last):
File "/usr/local/bin/dco-check", line 10, in <module>
sys.exit(main())
File "/usr/local/lib/python3.7/dist-packages/dco_check/dco_check.py", line 1095, in main
check_merge_commits=options.check_merge_commits,
File "/usr/local/lib/python3.7/dist-packages/dco_check/dco_check.py", line 568, in get_commits
individual_commits = split_commits_data(commits_data)
File "/usr/local/lib/python3.7/dist-packages/dco_check/dco_check.py", line 419, in split_commits_data
commits_data = commits_data.strip('\n')
AttributeError: 'NoneType' object has no attribute 'strip'
More generally, this happens every time there are no new commits to check on the default branch, but the pipeline is launched anyway, for whatever reason.
This case should be expressly handled by dco-check, by skipping the check entirely when there are no new commits
In GitLab, when a pipeline is not triggered by a commit or by a merge or pull request but it is manually launched, the environment variable CI_COMMIT_BEFORE_SHA is set to "000000000000000000000000000000000", thus leading to the following error:
More generally, this happens every time there are no new commits to check on the default branch, but the pipeline is launched anyway, for whatever reason.
This case should be expressly handled by dco-check, by skipping the check entirely when there are no new commits