Make it clear when a project is missing gitlab-ci.yml file and make the fix easy
Currently, a project without a GitLab CI configuration file (.gitlab-ci.yml
) are not supported by compliance pipelines as the compliance pipeline configuration is merged with the project's CI configuration file. When that file doesn't exist, the pipeline fails and it cannot be merged.
More detail in Epic Handle missing gitlab-ci.yml files using compli... (&9089 - closed)
The purpose of this issue is to give the ability for users to more easily fix their pipelines when faced with the error.
We have already updated the documentation in MR 96332, which is great.
I think we can make further improvement by adding a button/link to the error and surface it in the following UI:
existing error |
---|
The link/button could be a 1-click solution to create an MR that adds the required CI file
Planning breakdown
There seem to be two possible approaches here:
Approach 1: reuse exiting ci/cd button
There is an existing button on a new project that opens up the web editor to create a ci file.
We could simply replicate this functionality on the error page.
- the benefits of this approach are code reuse and it would be straightforward to code.
- the downside is that it would be a 1-click solution.
Approach 2: use create file API
Alternatively, we could:
- use the create file API to commit a file to a unique branch name
- And then use the create MR API to create a merge request
- and then redirect the user from the error page to the newly created MR
I think this approach is preferable as we should be able to make it 1-click, however:
- special care needs to be taken to make sure we create a unique branch
- we should probably assign the MR to the user who clicked the button
Draft: Implementation plan
After working through the two closed MRs, the best approach here is Approach 1: Add a button to link to pipeline configuration when this error is surfaced. There will be no change to the error text. The button text will use the standard used elsewhere in the product Create CI/CD configuration file
and link to the CI/CD editor.
- Pipeline failures are handled in file
app/views/projects/pipelines/show.html.haml
and created herelib/gitlab/ci/config/external/file/project.rb:L48
- Migrate
app/views/projects/pipelines/show.html.haml
errors to a newdanger
component - Add a Button linking to the CI editor path
- Update specs
- Update ~"Documentation"
Note: From comment #378854 (comment 1291710285)
Just a reminder, as I mentioned above, some of the error messages may not be related to the CI YAML config.
The user will always be presented with the button to go to pipeline configuration editor. Even though this may not be the place to solve the issue (custom configuration or no syntax/formatting issues)