Fix multi project pipeline viz being disabled for wrong users
What does this MR do and why?
Most users were seeing the expand button on the linked pipelines graph as disabled because we were checking for users permissions instead of groups. This commit now uses the proper permissions check and update the tests accordingly.
Screenshots or screen recordings
Before | After |
---|---|
Screen_Recording_2022-03-07_at_9.27.08_AM | Screen_Recording_2022-03-07_at_9.25.59_AM |
How to set up and validate locally
- Make sure that you have local runner setup.
- Create a multi-project pipeline => To do so, here is a the shortest way I know of:
- Create a new project and create a CI config file (
.gitlab-ci.yml
). - Inside that file, add the following:
stages:
- build
- test
- deploy
hi:
stage: "test"
script: "echo I am from the main project"
trigger_other_project:
stage: deploy
trigger:
include:
- project: "'root/my-other-project" # root is my namespace, then what's after the /, replace with your project name project
file: ".gitlab-ci.yml"
- Create another new project
- Create a CI config file (
.gitlab-ci.yml
). - Inside the file, add the following:
stages:
- build
- test
- deploy
build_job:
script: echo build
stage: build
test_job:
script: echo test
stage: test
deploy_job:
script: echo deploy
stage: deploy
Now whenever you run the pipeline of PROJECT A
, the main pipeline of project will also be triggered.
To verify as a free user:
- Login as a free user
- Go to
CI/CD => Pipelines
- Click on
Run pipeline
- Go in the pipeline page of this newly triggered pipeline
- Let the pipeline finish
- Hover on the downstream card arrow button on the right
- Notice the tooltip that explains that this feature is disabled
To verify that it still works for paying users
- Login as a paid user
- Go to
CI/CD => Pipelines
- Click on
Run pipeline
- Go in the pipeline page of this newly triggered pipeline
- Let the pipeline finish
- Hover on the downstream card arrow button on the right
- Click on the arrow
- Notice that the pipeline is expanded.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Frédéric Caplette