Answers: <p>It refers to <a href="https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/models/concerns/ci/lockable.rb" rel="nofollow noreferrer">the Locable mixin</a>,</p>
  <pre><code># `locked` will be populated from the source of truth on Ci::Pipeline
  # in order to clean up expired job artifacts in a performant way.
  # The values should be the same as `Ci::Pipeline.lockeds` with the
  # additional value of `unknown` to indicate rows that have not
  # yet been populated from the parent Ci::Pipeline
  enum locked: {
    unlocked: 0,
    artifacts_locked: 1,
    unknown: 2
  }, _prefix
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2023-01-24T00:14:41.463Z
Answers: 2023-01-24T00:14:41.463Z
Answers: Evan Carroll
Body: <p>In the table <code>ci_job_artifacts</code> there is a column called <code>locked</code>. What does this column do? It's not documented in the <a href="https://docs.gitlab.com/ee/api/job_artifacts.html#get-job-artifacts" rel="nofollow noreferrer">Job Artifacts API</a>? It's currently a <code>smallint</code> and it has 3 possible values: 0, 1, 2.</p>
  <pre><code>SELECT locked, count(*)
  FROM ci_job_artifacts
  GROUP BY locked;
   locked | count  
  --------+--------
        0 |  18140
        1 |   2252
        2 | 203191
  (3 rows)
  </code></pre>
  <p><a href="https://gitlab.com/gitlab-org/gitlab/-/blob/master/spec/fixtures/api/schemas/job/artifact.json" rel="nofollow noreferrer">Even though I guess it should be?</a></p>
  
Tags: <gitlab>
Title: What is a GitLab locked artifact?
UserDisplayName: Evan Carroll
ThreadText: # What is a GitLab locked artifact?
  
  (Asked by: username_0 on 2023-01-23)
  
  In the table `ci_job_artifacts` there is a column called `locked`. What does this column do? It's not documented in the [Job Artifacts API](https://docs.gitlab.com/ee/api/job_artifacts.html#get-job-artifacts)? It's currently a `smallint` and it has 3 possible values: 0, 1, 2.
  
  ```
  SELECT locked, count(*)
  FROM ci_job_artifacts
  GROUP BY locked;
   locked | count  
  --------+--------
        0 |  18140
        1 |   2252
        2 | 203191
  (3 rows)
  
  ```
  
  [Even though I guess it should be?](https://gitlab.com/gitlab-org/gitlab/-/blob/master/spec/fixtures/api/schemas/job/artifact.json)
  
  **Tags:** gitlab
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2023-01-24. Score: 0 | Accepted answer
  
  It refers to [the Locable mixin](https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/models/concerns/ci/lockable.rb),
  
  ```
  # `locked` will be populated from the source of truth on Ci::Pipeline
  # in order to clean up expired job artifacts in a performant way.
  # The values should be the same as `Ci::Pipeline.lockeds` with the
  # additional value of `unknown` to indicate rows that have not
  # yet been populated from the parent Ci::Pipeline
  enum locked: {
    unlocked: 0,
    artifacts_locked: 1,
    unknown: 2
  }, _prefix
  
  ```
  
  
  ---
  
  