Skip to content

[#2571] Added label-driven deployment gate to deploy router.#2575

Open
AlexSkrypnyk wants to merge 4 commits into
mainfrom
feature/2571-deploy-label-gate
Open

[#2571] Added label-driven deployment gate to deploy router.#2575
AlexSkrypnyk wants to merge 4 commits into
mainfrom
feature/2571-deploy-label-gate

Conversation

@AlexSkrypnyk
Copy link
Copy Markdown
Member

@AlexSkrypnyk AlexSkrypnyk commented Jun 5, 2026

Closes #2571

Summary

Added an opt-in label gate to the deploy router: when VORTEX_DEPLOY_ALLOW_LABEL is set to a label name, a pull request is deployed only if it carries that label. Without the label, the deployment is skipped cleanly with an informational note. The gate is inactive by default (empty variable) so existing deployments are unaffected. Branch and tag builds are never gated - only PR builds.

Changes

.vortex/tooling/src/deploy - Added two new variables (VORTEX_DEPLOY_ALLOW_LABEL, VORTEX_DEPLOY_PR_LABELS) and the gate logic: after the skip-list checks, if VORTEX_DEPLOY_ALLOW_LABEL is set and the build is for a PR, the script checks whether the label is present in the comma-separated VORTEX_DEPLOY_PR_LABELS list using an exact-match grep. Deployment is skipped if the label is absent; it proceeds with a confirmation note if present.

.github/workflows/build-test-deploy.yml - Wired VORTEX_DEPLOY_PR_LABELS (populated from github.event.pull_request.labels.*.name via join) and VORTEX_DEPLOY_ALLOW_LABEL (from repository variable vars.VORTEX_DEPLOY_ALLOW_LABEL) into the deploy job environment.

.vortex/installer/tests/Fixtures/ - Updated both baseline and deploy_types_none_gha fixtures to reflect the two new environment variables in the workflow.

.vortex/tooling/tests/unit/deploy.bats - Added 9 new BATS tests covering: gate inactive when variable is unset, PR carries the label (proceeds), PR lacks the label (skipped), non-PR builds unaffected, label among multiple labels, skip-list takes precedence over gate, empty label list, partial-match rejection, and labels containing spaces.

.vortex/docs/ - Added a "Gating deployments on a PR label" section to the deployment README and registered VORTEX_DEPLOY_ALLOW_LABEL in the CI variables reference and the auto-generated variables table.

Before / After

Before (skip-list only):
┌──────────────────────┐
│  Deploy called       │
└──────────┬───────────┘
           │
           ▼
┌──────────────────────┐   yes  ┌─────────────────┐
│ In skip list?        ├───────►│ Skip deployment  │
└──────────┬───────────┘        └─────────────────┘
           │ no
           ▼
┌──────────────────────┐
│ Run deployment       │
└──────────────────────┘

After (skip-list + label gate):
┌──────────────────────┐
│  Deploy called       │
└──────────┬───────────┘
           │
           ▼
┌──────────────────────┐   yes  ┌─────────────────┐
│ In skip list?        ├───────►│ Skip deployment  │
└──────────┬───────────┘        └─────────────────┘
           │ no
           ▼
┌──────────────────────┐   no   ┌─────────────────┐
│ ALLOW_LABEL set AND  ├───────►│ Run deployment   │
│ this is a PR build?  │        └─────────────────┘
└──────────┬───────────┘
           │ yes
           ▼
┌──────────────────────┐   no   ┌─────────────────┐
│ PR carries the label?├───────►│ Skip deployment  │
└──────────┬───────────┘        └─────────────────┘
           │ yes
           ▼
┌──────────────────────┐
│ Run deployment       │
└──────────────────────┘

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 5, 2026

Review Change Stack

Walkthrough

This PR implements a label-driven deployment gate for pull requests. When enabled via VORTEX_DEPLOY_ALLOW_LABEL, pull requests deploy only if they carry the specified GitHub label. The feature gathers PR labels from GitHub Actions, passes them to the deploy router script, implements conditional gating logic, and includes comprehensive test coverage.

Changes

PR Label Deployment Gate

Layer / File(s) Summary
Deploy script contract and label gating logic
\.vortex/tooling/src/deploy
New environment variables VORTEX_DEPLOY_ALLOW_LABEL and VORTEX_DEPLOY_PR_LABELS are documented, and conditional logic checks whether the required label is present; if not present and gate is enabled for a PR, deployment is skipped early and exits cleanly.
GitHub Actions workflow integration
\.github/workflows/build-test-deploy.yml
The deploy step exports VORTEX_DEPLOY_PR_LABELS (comma-separated PR label names from GitHub context) and VORTEX_DEPLOY_ALLOW_LABEL (from GitHub Actions variables) to the deploy router.
Variable definitions and documentation
\.vortex/docs/.utils/variables/extra/ci.variables.sh, \.vortex/docs/content/development/variables.mdx, \.vortex/docs/content/deployment/README.mdx
VORTEX_DEPLOY_ALLOW_LABEL is defined in CI variable documentation and added to the variables reference; deployment docs explain gating semantics, label sourcing from VORTEX_DEPLOY_PR_LABELS, that branch/tag deployments are unaffected, and that skip lists take precedence.
Unit tests for label gate behavior
\.vortex/tooling/tests/unit/deploy.bats
Nine new test cases cover: gate inactive when unset, deployment with label present, skipping when label absent, gate not applying to non-PR builds, label matching within multiple labels, skip-list precedence, skipping with empty labels, exact label matching (not substring), and correct matching of labels containing spaces.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A label so small, yet gates the deploy,
With a click and a check, maintainers enjoy,
No more every PR spins up a new home,
Just label the worthy, and let them roam! 🚀

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed All core requirements from issue #2571 are met: label-driven gate implemented, opt-in via VORTEX_DEPLOY_ALLOW_LABEL, provider-agnostic placement in deploy router, PR-scoped (guarded by VORTEX_DEPLOY_PR), skip-list precedence preserved, CI wiring for GitHub Actions, and comprehensive tests/documentation added.
Out of Scope Changes check ✅ Passed All changes are directly in scope: deploy router logic, CI workflow updates, variable definitions, tests, and related documentation for the label-gate feature. No unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately summarizes the main change: adding a label-driven deployment gate to the deploy router, which aligns with the PR objectives and changes across all modified files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/2571-deploy-label-gate

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

This comment has been minimized.

@AlexSkrypnyk

This comment has been minimized.

2 similar comments
@AlexSkrypnyk

This comment has been minimized.

@AlexSkrypnyk

This comment has been minimized.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.11%. Comparing base (3f946c4) to head (537a524).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2575      +/-   ##
==========================================
- Coverage   86.56%   86.11%   -0.46%     
==========================================
  Files          94       87       -7     
  Lines        4661     4502     -159     
  Branches       47        3      -44     
==========================================
- Hits         4035     3877     -158     
+ Misses        626      625       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot added the CONFLICT Pull request has a conflict that needs to be resolved before it can be merged label Jun 5, 2026
@AlexSkrypnyk AlexSkrypnyk force-pushed the feature/2571-deploy-label-gate branch from fc33c9b to 537a524 Compare June 5, 2026 12:03
@github-actions github-actions Bot removed the CONFLICT Pull request has a conflict that needs to be resolved before it can be merged label Jun 5, 2026
@AlexSkrypnyk AlexSkrypnyk changed the title [#2571] Gated environment deployments on a PR label. [#2571] Added label-driven deployment gate to deploy router. Jun 5, 2026
@AlexSkrypnyk AlexSkrypnyk added this to the 1.40.0 milestone Jun 5, 2026
@AlexSkrypnyk AlexSkrypnyk added the A4 Board worker 4 label Jun 5, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 5, 2026

Code coverage (threshold: 90%)

  Classes: 100.00% (1/1)
  Methods: 100.00% (2/2)
  Lines:   98.56% (205/208)
Per-class coverage
Drupal\ys_demo\Plugin\Block\CounterBlock
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% ( 10/ 10)

@AlexSkrypnyk

This comment has been minimized.

2 similar comments
@AlexSkrypnyk

This comment has been minimized.

@AlexSkrypnyk
Copy link
Copy Markdown
Member Author

Code coverage (threshold: 90%)

  Classes: 100.00% (1/1)
  Methods: 100.00% (2/2)
  Lines:   98.56% (205/208)
Per-class coverage
Drupal\ys_demo\Plugin\Block\CounterBlock
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% ( 10/ 10)

@github-actions github-actions Bot added the CONFLICT Pull request has a conflict that needs to be resolved before it can be merged label Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A4 Board worker 4 CONFLICT Pull request has a conflict that needs to be resolved before it can be merged

Projects

Status: BACKLOG

Development

Successfully merging this pull request may close these issues.

Gate environment deployments on the presence of a PR label

1 participant