Skip to content

Drop legacy artifacts usage as there are no leftovers

Shinya Maeda requested to merge drop-usage-of-leagcy-artifacts into master

What does this MR do?

After we've done https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24144/diffs, all legacy artifacts are gone.

We're going to disable all legacy artifacts usage with a feature flag.

Simplify queries which related to searching expired artifacts

Previous query of Ci::Build.with_expired_artifacts

SELECT "ci_builds"."id"
FROM "ci_builds"
WHERE "ci_builds"."type" IN ('Ci::Build') AND
    ((artifacts_file IS NOT NULL AND artifacts_file <> '') OR
        EXISTS (SELECT 1 FROM "ci_job_artifacts" WHERE (ci_builds.id = ci_job_artifacts.job_id) AND "ci_job_artifacts"."file_type" = 1))
    AND (artifacts_expire_at < '2019-01-10 09:36:50.618692');

New query of Ci::Build.with_expired_artifacts

SELECT "ci_builds"."id"
FROM "ci_builds"
WHERE "ci_builds"."type" IN ('Ci::Build') AND
    (EXISTS (SELECT 1 FROM "ci_job_artifacts" WHERE (ci_builds.id = ci_job_artifacts.job_id) AND "ci_job_artifacts"."file_type" = 1))
    AND (artifacts_expire_at < '2019-01-10 09:35:59.869233');

Feature flag

The usage can be leveraged by ci_enable_legacy_artifacts. We can technically remove all legacy artifacts related code, however, there might be an edge case or we encounter unexpected error. So using a feature flag is safer option. Also, this merge request accomplishes a part of https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/23358.

What are the relevant issue numbers?

Does this MR meet the acceptance criteria?

Edited by Kamil Trzciński

Merge request reports