debian-mirror-gitlab/doc/ci/pipeline_editor/index.md
2022-07-16 19:58:13 +02:00

7.1 KiB

stage group info type
Verify Pipeline Authoring To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments reference

Pipeline Editor (FREE)

The pipeline editor is the primary place to edit the GitLab CI/CD configuration in the .gitlab-ci.yml file in the root of your repository. To access the editor, go to CI/CD > Editor.

From the pipeline editor page you can:

In GitLab 13.9 and earlier, you must already have a .gitlab-ci.yml file on the default branch of your project to use the editor.

Validate CI configuration

As you edit your pipeline configuration, it is continually validated against the GitLab CI/CD pipeline schema. It checks the syntax of your CI YAML configuration, and also runs some basic logical validations.

The result of this validation is shown at the top of the editor page. If your configuration is invalid, a tip is shown to help you fix the problem:

Errors in a CI configuration validation

Lint CI configuration

To test the validity of your GitLab CI/CD configuration before committing the changes, you can use the CI lint tool. To access it, go to CI/CD > Editor and select the Lint tab.

This tool checks for syntax and logical errors but goes into more detail than the automatic validation in the editor.

The results are updated in real-time. Any changes you make to the configuration are reflected in the CI lint. It displays the same results as the existing CI Lint tool.

Linting errors in a CI configuration

View included CI/CD configuration

Introduced in GitLab 15.0 with a flag named pipeline_editor_file_tree. Disabled by default.

FLAG: On self-managed GitLab, by default this feature is not available. To make it available, ask an administrator to enable the feature flag named pipeline_editor_file_tree.

You can review configuration added with the include keyword in the pipeline editor. In the top right, select the file tree ({file-tree}) to see a list of all included configuration files. Selected files open in a new tab for review.

Visualize CI configuration

To view a visualization of your .gitlab-ci.yml configuration, in your project, go to CI/CD > Editor, and then select the Visualize tab. The visualization shows all stages and jobs. Any needs relationships are displayed as lines connecting jobs together, showing the hierarchy of execution:

CI configuration Visualization

Hover over a job to highlight its needs relationships:

CI configuration visualization on hover

If the configuration does not have any needs relationships, then no lines are drawn because each job depends only on the previous stage being completed successfully.

View expanded configuration

To view the fully expanded CI/CD configuration as one combined file, go to the pipeline editor's View merged YAML tab. This tab displays an expanded configuration where:

Using !refence tags can cause nested configuration that display with multiple hyphens (-) in the expanded view. This behavior is expected, and the extra hyphens do not affect the job's execution. For example, this configuration and fully expanded version are both valid:

  • .gitlab-ci.yml file:

    .python-req:
      script:
        - pip install pyflakes
    
    lint-python:
      image: python:latest
      script:
        - !reference [.python-req, script]
        - pyflakes python/
    
  • Expanded configuration in View merged YAML tab:

    ".python-req":
      script:
      - pip install pyflakes
    lint-python:
      script:
      - - pip install pyflakes  # <- The extra hyphens do not affect the job's execution.
      - pyflakes python/
      image: python:latest
    

Commit changes to CI configuration

The commit form appears at the bottom of each tab in the editor so you can commit your changes at any time.

When you are satisfied with your changes, add a descriptive commit message and enter a branch. The branch field defaults to your project's default branch.

If you enter a new branch name, the Start a new merge request with these changes checkbox appears. Select it to start a new merge request after you commit the changes.

The commit form with a new branch

Troubleshooting

Configuration validation currently not available message

This message is due to a problem with the syntax validation in the pipeline editor. If GitLab is unable to communicate with the service that validates the syntax, the information in these sections may not display properly:

  • The syntax status on the Edit tab (valid or invalid).
  • The Visualize tab.
  • The Lint tab.
  • The View merged YAML tab.

You can still work on your CI/CD configuration and commit the changes you made without any issues. As soon as the service becomes available again, the syntax validation should display immediately.