gitlab-dashboard
gitlab-dashboard copied to clipboard
Fails to update if commit is null
The /jobs
API can return null for a commit if that branch has been removed from the source control. This is not a usual situation, but has happened to us where a backup went awry.
However, if the commit
object is null, then the Gitlab Dashboard fails to parse and stops updating any projects after the project with the null commit. The error message in the console is:
Polling failed with error: Failed to parse jobs: (NonEmptyList (NonEmpty (ErrorAtProperty "commit" (ErrorAtProperty "short_id" (TypeMismatch "object" "object"))) Nil))
And a sample response from the /jobs
API with this problem is:
{"id":36068,"status":"failed","stage":"build","name":"build","ref":"master_merge_2018-06-13-12-55-18","tag":false,"coverage":null,"created_at":"2019-01-10T11:46:38.043Z","started_at":"2019-01-10T11:46:39.825Z","finished_at":"2019-01-10T11:46:44.817Z","duration":4.9919,"user":{"id":4,"name":"James","username":"bakerj","state":"active","avatar_url":"https://gitlab.local/uploads/-/system/user/avatar/4/avatar.png","web_url":"https://gitlab.local/bakerj","created_at":"2018-07-05T08:38:59.015Z","bio":"","location":"","public_email":"","skype":"","linkedin":"","twitter":"","website_url":"","organization":""},"commit":null,"pipeline":{"id":650,"sha":"053ac952b64d5649ba4d7992d8b47475500086dc","ref":"master_merge_2018-06-13-12-55-18","status":"failed","web_url":"https://gitlab.local/ABC/DEF/pipelines/650"},"web_url":"https://gitlab.local/ABC/DEF/-/jobs/36068","artifacts":[{"file_type":"trace","size":895,"filename":"job.log","file_format":null}],"runner":{"id":1,"description":"docker-runner-1","ip_address":"XYZ.XYZ.XYZ.XYZ","active":true,"is_shared":true,"name":"gitlab-runner","online":true,"status":"online"},"artifacts_expire_at":null},
Yep, this sounds like a bug in the way we model the API in the types: here the commit
field should be a Maybe Commit