Skip to content

GitLab Next

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • GitLab GitLab
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 43,083
    • Issues 43,083
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 1,366
    • Merge requests 1,366
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

GitLab 15.0 has launched! Please visit Breaking changes in 15.0 and 15.0 Removals to see which breaking changes may impact your workflow.

  • GitLab.org
  • GitLabGitLab
  • Merge requests
  • !50889

Make "keep latest artifact" an instance-level configuration

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Allison Browne requested to merge 276583-make-keep-latest-artifact-an-instance-level-configuration into master Jan 05, 2021
  • Overview 110
  • Commits 1
  • Pipelines 56
  • Changes 35

What does this MR do?

Adds an option in application settings that allows a user to enable or disable the 'keep latest artifact' functionality which preserves the artifacts from the latest pipeline run. It currently does this by 'locking' artifacts when a pipeline is first created and then and then unlocking them when new pipelines for the same branch succeed.

Locking explained: Artifacts for unlocked pipelines will expire according to normal expiration policies and artifacts with locked pipelines will never expire and currently.

This MR also provides querying mechanisms so that the project settings page which also has this setting applied to the project level can determine when to disable the checkbox.

Issue #276583 (closed)

Technical implementation

Add column

Adds a applications setting column for keeping the latest artifact

Add graphql query

Add Application setting to the root query in graphql with the keep latest artifact setting. This is to be used by the front end to disable the project level setting when the instance level setting is enabled:

query {
  ciApplicationSettings {
    keepLatestArtifact
  },
  project(fullPath: "root/merge-trains") {
    id,
    ciCdSettings {
      keepLatestArtifact
    }
  }
}

Add Application setting to public API

This is just for completeness of the API for customers programmatic needs (since most application settings are not yet in graphql)

haml/REST applications settings page

Because of design constraints, we could not port this page to vue and graphql at this time.

Database output

I did not add lock retries because the application_settings table has only 1 row on GitLab.com.

UP

exec ALTER TABLE “application_settings” ADD “keep_latest_artifact” boolean DEFAULT TRUE NOT NULL;
The query has been executed. Duration: 43.000 ms (edited) 

Down

exec ALTER TABLE "application_settings" DROP COLUMN "keep_latest_artifact"
The query has been executed. Duration: 12.000 ms 

Screenshots (strongly suggested)

Application Settings

before after
Screen_Shot_2021-01-08_at_3.24.16_PM Screen_Shot_2021-01-08_at_3.21.58_PM

Project disabled state based on instance

Instance Project
Screen_Shot_2021-01-13_at_11.58.35_AM Screen_Shot_2021-01-13_at_11.59.35_AM
Screen_Shot_2021-01-13_at_11.59.23_AM Screen_Shot_2021-01-14_at_12.50.52_PM

Does this MR meet the acceptance criteria?

Conformity

  • Changelog entry
  • Documentation (if required)
  • Code review guidelines
  • Merge request performance guidelines
  • Style guides
  • Database guides
  • Separation of EE specific content

Availability and Testing

  • Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process.
  • Tested in all supported browsers
  • Informed Infrastructure department of a default or new setting change, if applicable per definition of done

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited Feb 04, 2021 by Fabio Pitino
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: 276583-make-keep-latest-artifact-an-instance-level-configuration