Show who cancelled the pipeline in the UI
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Description
Improving team collaboration and transparency
Essential visibility for teams working together on shared CI/CD pipelines. Reduces friction, eliminates mystery cancellations, and helps teams collaborate more effectively.
I'd like to know who cancelled my pipeline. For all other actions/events that you would like to see in the UI. Please leave a comment in &14183 (closed)
Proposal
Gitlab should log, along with the status on the build/pipeline history, the user (if applicable) that caused the cancellation for improved coordination in the team, especially in large organizations.
Workaround for self-managed admins
grep -E 'caller_id":"Projects::(Jobs|Pipelines)Controller#cancel' /var/log/gitlab/gitlab-rails/production_json.log \
| jq --raw-output '[.time, ."meta.user"] | @tsv' \
| grep …job…or…pipeline…id… | sortCustomer Verbatim
"We have had automated release jobs canceled and we have no idea who canceled them. We are unable to prevent this from happening without knowing who"
""It hinders pipeline investigations - our SRO pipelines are quite long so when they get cancelled (accidentally? on purpose?) it makes life a lot harder when I don't know who did it and why."
Also see customer impact
Implementation guide
For the MVC we should look at focusing on only single-pipeline views.
Phase 1 Backend backend
Per the discussion in #17941 (comment 3107266630)
We need to create another table - https://docs.gitlab.com/development/cicd/cicd_tables/ that'll track
- Who canceled the build.
- Port over the columns
- Erased by ID
- Erased at
- Auto Canceled by ID
- Auto Canceled by Partition ID
Then by using this data, and some custom logic (eg disregard allowed_to_fail jobs), we cache these results on the pipeline level. See Gitlab::Ci::Status::Composite for how statuses are aggregated.
We can additionally expose this via the API.
The first step we need to do is
- Create the new table
- Add the data of who canceled the build when the build is canceled
Phase 2 Backend backend
Then pass this issue to groupci platform to finish the porting
Feature flag all of this - to test performance implications
Frontend frontend
Location one:
In app/assets/javascripts/ci/pipeline_details/header/pipeline_header.vue add canceled by user <username> after the duration text. According to the design We use the GraphQL query app/assets/javascripts/ci/pipeline_details/header/graphql/queries/get_pipeline_header_data.query.graphql to get data so we will need backend to implement a way for us to determine who cancelled the pipeline. Add test coverage!
Location two:
In app/assets/javascripts/ci/common/pipeline_summary/pipeline_summary.vue add canceled by user <username> according to the design We use the GraphQL query app/assets/javascripts/ci/common/pipeline_summary/graphql/queries/get_pipeline_summary.query.graphql for fetching data. It's the same GraphQL type as location one in the UI so backend can make only one change to support this feature. Add test coverage!