debian-mirror-gitlab/doc/user/admin_area/settings/continuous_integration.md
2023-07-09 08:55:56 +05:30

18 KiB

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

Continuous Integration and Deployment Admin Area settings (FREE SELF)

The Admin Area has the instance settings for Auto DevOps, runners, and job artifacts.

Auto DevOps

To enable (or disable) Auto DevOps for all projects:

  1. On the top bar, select Main menu > Admin.
  2. On the left sidebar, select Settings > CI/CD.
  3. Check (or uncheck to disable) the box that says Default to Auto DevOps pipeline for all projects.
  4. Optionally, set up the Auto DevOps base domain which is used for Auto Deploy and Auto Review Apps.
  5. Select Save changes for the changes to take effect.

From now on, every existing project and newly created ones that don't have a .gitlab-ci.yml use the Auto DevOps pipelines.

If you want to disable it for a specific project, you can do so in its settings.

Enable shared runners for new projects

You can set all new projects to have the instance's shared runners available by default.

  1. On the top bar, select Main menu > Admin.
  2. On the left sidebar, select Settings > CI/CD.
  3. Expand Continuous Integration and Deployment.
  4. Select the Enable shared runners for new projects checkbox.

Any time a new project is created, the shared runners are available.

Shared runners CI/CD minutes

As an administrator you can set either a global or namespace-specific limit on the number of CI/CD minutes you can use.

Enable a project runner for multiple projects

If you have already registered a project runner you can assign that runner to other projects.

To enable a project runner for more than one project:

  1. On the top bar, select Main menu > Admin.
  2. From the left sidebar, select CI/CD > Runners.
  3. Select the runner you want to edit.
  4. In the upper-right corner, select Edit ({pencil}).
  5. Under Restrict projects for this runner, search for a project.
  6. To the left of the project, select Enable.
  7. Repeat this process for each additional project.

Add a message for shared runners

To display details about the instance's shared runners in all projects' runner settings:

  1. On the top bar, select Main menu > Admin.

  2. On the left sidebar, select Settings > CI/CD.

  3. Expand Continuous Integration and Deployment.

  4. Enter text, including Markdown if you want, in the Shared runner details field. For example:

    Shared runner details input

To view the rendered details:

  1. On the top bar, select Main menu, and:
    • For a project, select Projects and find your project.
    • For a group, select Groups and find your group.
  2. On the left sidebar, select Settings > CI/CD.
  3. Expand Runners.

Shared runner details example

Maximum artifacts size

The maximum size of the job artifacts can be set at:

For the setting on GitLab.com, see Artifacts maximum size.

The value is in MB and the default is 100 MB per job. To change it at the:

  • Instance level:

    1. On the top bar, select Main menu > Admin.
    2. On the left sidebar, select Settings > CI/CD > Continuous Integration and Deployment.
    3. Change the value of Maximum artifacts size (MB).
    4. Select Save changes for the changes to take effect.
  • Group level (this overrides the instance setting):

    1. Go to the group's Settings > CI/CD > General Pipelines.
    2. Change the value of Maximum artifacts size (in MB).
    3. Select Save changes for the changes to take effect.
  • Project level (this overrides the instance and group settings):

    1. Go to the project's Settings > CI/CD > General Pipelines.
    2. Change the value of maximum artifacts size (in MB).
    3. Select Save changes for the changes to take effect.

NOTE: The setting at all levels is only available to GitLab administrators.

Default artifacts expiration

The default expiration time of the job artifacts can be set in the Admin Area of your GitLab instance. The syntax of duration is described in artifacts:expire_in and the default value is 30 days.

  1. On the top bar, select Main menu > Admin.
  2. On the left sidebar, select Settings > CI/CD.
  3. Change the value of default expiration time.
  4. Select Save changes for the changes to take effect.

This setting is set per job and can be overridden in .gitlab-ci.yml. To disable the expiration, set it to 0. The default unit is in seconds.

NOTE: Any changes to this setting applies to new artifacts only. The expiration time is not be updated for artifacts created before this setting was changed. The administrator may need to manually search for and expire previously-created artifacts, as described in the troubleshooting documentation.

Keep the latest artifacts for all jobs in the latest successful pipelines

Introduced in GitLab 13.9.

When enabled (default), the artifacts of the most recent pipeline for each Git ref (branches and tags) are locked against deletion and kept regardless of the expiry time.

When disabled, the latest artifacts for any new successful or fixed pipelines are allowed to expire.

This setting takes precedence over the project level setting. If disabled at the instance level, you cannot enable this per-project.

To disable the setting:

  1. On the top bar, select Main menu > Admin.
  2. On the left sidebar, select Settings > CI/CD.
  3. Expand Continuous Integration and Deployment.
  4. Clear the Keep the latest artifacts for all jobs in the latest successful pipelines checkbox.
  5. Select Save changes

When you disable the feature, the latest artifacts do not immediately expire. A new pipeline must run before the latest artifacts can expire and be deleted.

NOTE: All application settings have a customizable cache expiry interval which can delay the settings affect.

Archive jobs

Archiving jobs is useful for reducing the CI/CD footprint on the system by removing some of the capabilities of the jobs (metadata stored in the database needed to run the job), but persisting the traces and artifacts for auditing purposes.

To set the duration for which the jobs are considered as old and expired:

  1. On the top bar, select Main menu > Admin.
  2. On the left sidebar, select Settings > CI/CD.
  3. Expand the Continuous Integration and Deployment section.
  4. Set the value of Archive jobs.
  5. Select Save changes for the changes to take effect.

After that time passes, the jobs are archived in the background and no longer able to be retried. Make it empty to never expire jobs. It has to be no less than 1 day, for example: 15 days, 1 month, 2 years.

For the value set for GitLab.com, see Scheduled job archiving.

Protect CI/CD variables by default

To set all new CI/CD variables as protected by default:

  1. On the top bar, select Main menu > Admin.
  2. On the left sidebar, select Settings > CI/CD.
  3. Select Protect CI/CD variables by default.

Maximum includes

The maximum number of includes per pipeline can be set at the instance level. The default is 150.

  1. On the top bar, select Main menu > Admin.
  2. On the left sidebar, select Settings > CI/CD.
  3. Change the value of Maximum includes.
  4. Select Save changes for the changes to take effect.

Default CI/CD configuration file

Introduced in GitLab 12.5.

The default CI/CD configuration file and path for new projects can be set in the Admin Area of your GitLab instance (.gitlab-ci.yml if not set):

  1. On the top bar, select Main menu > Admin.
  2. On the left sidebar, select Settings > CI/CD.
  3. Input the new file and path in the Default CI/CD configuration file field.
  4. Select Save changes for the changes to take effect.

It is also possible to specify a custom CI/CD configuration file for a specific project.

Set CI/CD limits

Introduced in GitLab 14.10.

You can configure some CI/CD limits from the Admin Area:

  1. On the top bar, select Main menu > Admin.
  2. On the left sidebar, select Settings > CI/CD.
  3. Expand the Continuous Integration and Deployment section.
  4. In the CI/CD limits section, you can set the following limits:
    • Maximum number of jobs in a single pipeline
    • Total number of jobs in currently active pipelines
    • Maximum number of active pipelines per project
    • Maximum number of pipeline subscriptions to and from a project
    • Maximum number of pipeline schedules
    • Maximum number of DAG dependencies that a job can have
    • Maximum number of runners registered per group
    • Maximum number of runners registered per project
    • Maximum number of downstream pipelines in a pipeline's hierarchy tree

Enable or disable the pipeline suggestion banner

By default, a banner displays in merge requests with no pipeline suggesting a walkthrough on how to add one.

Suggest pipeline banner

To enable or disable the banner:

  1. On the top bar, select Main menu > Admin.
  2. On the left sidebar, select Settings > CI/CD.
  3. Select or clear the Enable pipeline suggestion banner checkbox.
  4. Select Save changes.

Required pipeline configuration (ULTIMATE SELF)

  • Moved from GitLab Premium to GitLab Ultimate in 15.0.
  • Deprecated in GitLab 15.9.

WARNING: This feature was deprecated in GitLab 15.9 and is planned for removal in 17.0. Use compliance pipelines instead. This change is a breaking change.

You can set a CI/CD template as a required pipeline configuration for all projects on a GitLab instance. You can use a template from:

  • The default CI/CD templates.

  • A custom template stored in an instance template repository.

    NOTE: When you use a configuration defined in an instance template repository, nested include: keywords (including include:file, include:local, include:remote, and include:template) do not work.

The project CI/CD configuration merges into the required pipeline configuration when a pipeline runs. The merged configuration is the same as if the required pipeline configuration added the project configuration with the include keyword. To view a project's full merged configuration, View full configuration in the pipeline editor.

To select a CI/CD template for the required pipeline configuration:

  1. On the top bar, select Main menu > Admin.
  2. On the left sidebar, select Settings > CI/CD.
  3. Expand the Required pipeline configuration section.
  4. Select a CI/CD template from the dropdown list.
  5. Select Save changes.

Package Registry configuration

Maven Forwarding (PREMIUM SELF)

GitLab administrators can disable the forwarding of Maven requests to Maven Central.

To disable forwarding Maven requests:

  1. On the top bar, select Menu > Admin.
  2. On the left sidebar, select Settings > CI/CD.
  3. Expand the Package Registry section.
  4. Clear the checkbox Forward Maven package requests to the Maven Registry if the packages are not found in the GitLab Package Registry.
  5. Select Save changes.

npm Forwarding (PREMIUM SELF)

GitLab administrators can disable the forwarding of npm requests to npmjs.com.

To disable it:

  1. On the top bar, select Main menu > Admin.
  2. On the left sidebar, select Settings > CI/CD.
  3. Expand the Package Registry section.
  4. Clear the checkbox Forward npm package requests to the npm Registry if the packages are not found in the GitLab Package Registry.
  5. Select Save changes.

PyPI Forwarding (PREMIUM SELF)

GitLab administrators can disable the forwarding of PyPI requests to pypi.org.

To disable it:

  1. On the top bar, select Main menu > Admin.
  2. On the left sidebar, select Settings > CI/CD.
  3. Expand the Package Registry section.
  4. Clear the checkbox Forward PyPI package requests to the PyPI Registry if the packages are not found in the GitLab Package Registry.
  5. Select Save changes.

Package file size limits

GitLab administrators can adjust the maximum allowed file size for each package type.

To set the maximum file size:

  1. On the top bar, select Main menu > Admin.
  2. On the left sidebar, select Settings > CI/CD.
  3. Expand the Package Registry section.
  4. Find the package type you would like to adjust.
  5. Enter the maximum file size, in bytes.
  6. Select Save size limits.

Restrict runner registration by all users in an instance

GitLab administrators can adjust who is allowed to register runners, by showing and hiding areas of the UI.

When the registration sections are hidden in the UI, members of the project or group must contact administrators to enable runner registration in the group or project. If you plan to prevent registration, ensure users have access to the runners they need to run jobs.

By default, all members of a project and group are able to register runners.

To restrict all users in an instance from registering runners:

  1. On the top bar, select Main menu > Admin.
  2. On the left sidebar, select Settings > CI/CD.
  3. Expand Runners.
  4. In the Runner registration section, clear the Members of the project can register runners and Members of the group can register runners checkboxes to remove runner registration from the UI.
  5. Select Save changes.

NOTE: After you disable runner registration by members of a project, the registration token automatically rotates. The token is no longer valid and you must use the new registration token for the project.

Restrict runner registration by all members in a group

Prerequisites:

GitLab administrators can adjust group permissions to restrict runner registration by group members.

To restrict runner registration by members in a specific group:

  1. On the top bar, select Main menu > Admin.
  2. On the left sidebar, select Overview > Groups and find your group.
  3. Select Edit.
  4. Clear the New group runners can be registered checkbox if you want to disable runner registration by all members in the group. If the setting is read-only, you must enable runner registration for the instance.
  5. Select Save changes.

Disable runner version management

Introduced in GitLab 15.10.

By default, GitLab instances periodically fetch official runner version data from GitLab.com to determine whether the runners need upgrades.

To disable your instance fetching this data:

  1. On the top bar, select Main menu > Admin.
  2. On the left sidebar, select Settings > CI/CD.
  3. Expand Runners.
  4. In the Runner version management section, clear the Fetch GitLab Runner release version data from GitLab.com checkbox.
  5. Select Save changes.

Troubleshooting

413 Request Entity Too Large

When build jobs fail with the following error, increase the maximum artifacts size.

Uploading artifacts as "archive" to coordinator... too large archive <job-id> responseStatus=413 Request Entity Too Large status=413" at end of a build job on pipeline when trying to store artifacts to <object-storage>.