Feature flag rollout: `package_metadata_sync_using_labels`

Summary

This issue is to roll out the feature on production, that is currently behind the package_metadata_sync_using_labels feature flag.

This flag gates the new fast path in the GCP connector for package metadata sync, which reads bucket labels to determine available deltas instead of calling listObjects. The old listObjects path remains as a fallback when the flag is disabled or labels are absent.

Owners

  • Most appropriate Slack channel to reach out to: #g_composition_analysis
  • Best individual to reach out to: @azaydan

Expectations

What are we expecting to happen?

When enabled, the package metadata sync worker will read GCP bucket labels to determine which delta files to fetch, skipping the expensive listObjects API call for registries that have labels available. This reduces GCP API costs and speeds up sync for large registries (e.g. maven, npm, pypi). In case of errors when using the

What can go wrong and how would we detect it?

What can go wrong: If label code errors in a way that's not caught and execution never reaches listObjects, the instance will not be able to sync advisory and license data.

How can we detect it: in Sentry, filter by: Gitlab::PackageMetadata::Connector::Gcp::MissingChunkFileError . On instance, grep structured logs: grep 'package_metadata_sync' /var/log/gitlab/gitlab-rails/application_json.log | jq '{msg: .message, purl: .purl_type, path: .message}'

Rollout Steps

Note: Please make sure to run the chatops commands in the Slack channel that gets impacted by the command.

Rollout on non-production environments

  • Verify the MR with the feature flag is merged to master and has been deployed to non-production environments with /chatops gitlab run auto_deploy status <merge-commit-of-your-feature>
  • Deploy the feature flag at a percentage (recommended percentage: 50%) with /chatops gitlab run feature set package_metadata_sync_using_labels 50 --actors --dev --pre --staging --staging-ref
  • Monitor that the error rates did not increase (repeat with a different percentage as necessary).
  • Enable the feature globally on non-production environments with /chatops gitlab run feature set package_metadata_sync_using_labels true --dev --pre --staging --staging-ref
  • Verify that the feature works as expected. The best environment to validate the feature in is staging-canary as this is the first environment deployed to. Make sure you are configured to use canary.
  • If the feature flag causes end-to-end tests to fail, disable the feature flag on staging to avoid blocking deployments.

Before production rollout

  • If the change is significant and you wanted to announce in #whats-happening-at-gitlab, it best to do it before rollout to gitlab-org/gitlab-com.

Specific rollout on production

For visibility, all /chatops commands that target production must be executed in the #production Slack channel and cross-posted (with the command results) to the responsible team's Slack channel.

  • Ensure that the feature MRs have been deployed to both production and canary with /chatops gitlab run auto_deploy status <merge-commit-of-your-feature>
  • Enable globally (this flag has no per-actor scoping since it's an instance-wide Sidekiq worker): /chatops gitlab run feature set package_metadata_sync_using_labels true
  • Verify that the feature works (monitor sync job logs and Sentry for errors).

Preparation before global rollout

  • Set a milestone to this rollout issue to signal for enabling and removing the feature flag when it is stable.
  • Check if the feature flag change needs to be accompanied with a change management issue. Cross link the issue here if it does.
  • Ensure that you or a representative in development can be available for at least 2 hours after feature flag updates in production.
  • Ensure that documentation exists for the feature, and the version history text has been updated.
  • Notify the #support_gitlab-com Slack channel and your team channel.

Global rollout on production

For visibility, all /chatops commands that target production must be executed in the #production Slack channel and cross-posted (with the command results) to the responsible team's Slack channel.

  • After the feature has been 100% enabled, wait for at least one day before releasing the feature.

Release the feature with the feature flag (set default_enabled: true)

Per the agreed rollout plan: deploy with FF disabled, enable on .com, then set default_enabled: true so self-hosted instances get it in the next milestone with a kill-switch.

  • Create a merge request with the following changes:
    • Ensure the feature has been enabled globally on production: /chatops gitlab run feature get package_metadata_sync_using_labels
    • Set default_enabled: true in config/feature_flags/beta/package_metadata_sync_using_labels.yml.
    • Add a changelog entry.
  • Ensure that the default-enabling MR has been included in the release package.
  • After the default-enabling MR has been deployed, clean up the feature flag from all environments: /chatops gitlab run feature delete package_metadata_sync_using_labels --dev --pre --staging --staging-ref --production
  • Close the feature issue.
  • Set the next milestone to this rollout issue for scheduling the flag removal.

Release the feature (full cleanup)

  • Create a merge request to remove the package_metadata_sync_using_labels feature flag:
    • Remove all references to the feature flag from the codebase.
    • Remove config/feature_flags/beta/package_metadata_sync_using_labels.yml.
  • Ensure that the cleanup MR has been included in the release package.
  • Close the feature issue.
  • Once the cleanup MR has been deployed to production, clean up the feature flag: /chatops gitlab run feature delete package_metadata_sync_using_labels --dev --pre --staging --staging-ref --production
  • Close this rollout issue.

Rollback Steps

  • This feature can be disabled on production by running the following Chatops command:
/chatops gitlab run feature set package_metadata_sync_using_labels false


  • Disable the feature flag on non-production environments:
/chatops gitlab run feature set package_metadata_sync_using_labels false --dev --pre --staging --staging-ref


  • Delete feature flag from all environments:
/chatops gitlab run feature delete package_metadata_sync_using_labels --dev --pre --staging --staging-ref --production


Edited by Ahmad Zaydan