Page MenuHomePhabricator

Fix CI Pipeline Triggering Deploy Stage on Feature Branches
Closed, ResolvedPublic

Description

Description

Currently, every push to a feature or contributor branch triggers the full CI pipeline, including the deploy stage. Since deployment is intended only for main or release branches, the deploy step fails for non-production branches.

As a result, contributors frequently receive failed pipeline notifications, even though their changes are valid. This creates confusion, unnecessary noise, and a poor contributor experience.

This task focuses on updating the CI configuration so that deployment steps run only on appropriate branches, while ensuring that CI pipelines for feature and contributor branches complete successfully.

Domain

Coding (CI / DevOps)

Difficulty

Intermediate

Steps To Reproduce

  1. Create or push changes to a feature branch or contributor branch.
  2. Observe that the CI pipeline starts automatically.
  3. Notice that the pipeline includes the deploy stage.
  4. The deploy stage fails because deployment is not permitted or configured for non-main branches.
  5. Contributors receive a failure notification such as: isa | Failed pipeline for T413222 | f03a3607

Expected Output

  • The deploy stage does not run for feature or contributor branches.
  • CI pipelines for non-main branches complete successfully when tests pass.
  • Deployment is restricted to main and/or release branches only.
  • Contributors no longer receive false failure notifications.

Acceptance Criteria

  • Deploy stage is conditionally executed only on approved branches (e.g., main, release/*).
  • Feature and contributor branch pipelines pass when checks succeed.
  • No deploy-related failures occur on non-deployment branches.
  • CI configuration is clean, maintainable, and documented.
  • Contributor experience is improved with reduced CI noise.
  • No impact on production deployment workflows.

Details

Related Changes in GitLab:
TitleReferenceAuthorSource BranchDest Branch
Update GitLab CI/CD configuration for deploy stage and improve formattingtoolforge-repos/isa!51gopavasanthT413272main
Customize query in GitLab

Event Timeline

gopavasanth opened https://gitlab.wikimedia.org/toolforge-repos/isa/-/merge_requests/51

Update GitLab CI/CD configuration for deploy stage and improve formatting

CI Behavior Coverage

This setup covers all required cases:

  • Case 1: Commit directly to main
    • CI_COMMIT_BRANCH = main
    • Deploy runs ✅
  • Case 2: Merge request merged into main
    • Merge creates a new commit on main
    • CI_COMMIT_BRANCH = main
    • Deploy runs ✅
  • Case 3: Push to feature branch
    • CI_COMMIT_BRANCH = T413222
    • Deploy is skipped ✅
  • Case 4: Open merge request
    • Pipeline runs on the source branch
    • CI_COMMIT_BRANCH != main
    • Deploy is skipped ✅

PR: https://gitlab.wikimedia.org/toolforge-repos/isa/-/merge_requests/51

swayamagrahari merged https://gitlab.wikimedia.org/toolforge-repos/isa/-/merge_requests/51

Update GitLab CI/CD configuration for deploy stage and improve formatting

Swayam_Agrahari moved this task from Backlog to Merged on the ISA board.
Swayam_Agrahari subscribed.

Proof: The ci passed here

Resolving this. Thnaks fot the patch.
Status: Approved✅