-
Notifications
You must be signed in to change notification settings - Fork 21
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
Store gitlab failure reason/exit code in analytics DB #1042
Conversation
I believe this is stored in the GitLab database as |
I made a query in metabase that grabs all the |
This might be incorrect. Marking this as draft until I can confirm |
2af4b29
to
ea78016
Compare
13f3281
to
7ab99e7
Compare
There must be something going on with the regex in that metabase query, because it does look like at least |
analytics/analytics/core/management/commands/migrate_exit_code_and_failure_reasons.py
Outdated
Show resolved
Hide resolved
For posterity - @jjnesbitt and I discussed this offline and decided to move the backfilling of exit codes/failure reasons to a Django migration instead of a management command. |
6ce55b1
to
4e3b23f
Compare
analytics/analytics/core/migrations/0003_jobdatadimension_gitlab_failure_reason_and_more.py
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just had one remaining question, but otherwise LGTM. We'll just need to make sure to disable flux before we merge this, so we can manually run migrate
.
This PR updates the webhook-handler to store the
build_failure_reason
reported by gitlab (for example,script_failure
) in the job data dimension table. It also attempts to parse out the exit code from the job log and store it if found.A couple things to note-
From what I can tell, gitlab does not store the job exit code anywhere. So, I opted to parse it out of the job log with a regex. If there's a better way/it is in fact stored somewhere in the gitlab DB, I'd be happy to change this.Updated PR to use DB insteadI suspect that only
script-failure
jobs have an exit code, so we should be able to add a constraint that enforces exit code to be non-null for those jobs. I don't have any evidence for this yet, so I figured we can leave it as null-able for now and revisit it later when we have some data.I've added a temporary management command to backfill the new fields; I didn't want to make it a migration, because long-running migrations don't work great with our current process for running them.