Skip to content

Conversation

@warren830
Copy link
Contributor

… names from job/stage names

This enhancement addresses the issue where the Azure DevOps plugin was unable to correctly detect production deployments when the environment name is embedded in job/stage names rather than being in a standard format.

Changes:

  • Add environment_pattern scope config field that supports regex capture groups to extract environment names from job/stage names
  • Collect both Job and Stage records from the timeline API (previously only Job)
  • Add identifier, type, and parent_id fields to the Job model
  • Update environment detection logic:
    • If environment_pattern is configured, extract the environment name first
    • Apply production_pattern to the extracted environment name
    • Fall back to matching production_pattern against job name if no extraction
  • Fix default environment behavior: only default to PRODUCTION when production_pattern is not configured (was defaulting PRODUCTION always)
  • Add comprehensive tests for the new functionality

Example configuration for pipelines with jobs like 'deploy_xxxx-prod_helm':

  • deployment_pattern: deploy
  • production_pattern: prod
  • environment_pattern: (?:deploy|predeploy)_-(?:_-)?$

This extracts 'xxxx-prod' from the job name and then applies production_pattern to correctly identify it as a production deployment.

🤖 Generated with Claude Code

⚠️ Pre Checklist

Please complete ALL items in this checklist, and remove before submitting

  • I have read through the Contributing Documentation.
  • I have added relevant tests.
  • I have added relevant documentation.
  • I will add labels to the PR, such as pr-type/bug-fix, pr-type/feature-development, etc.

Summary

What does this PR do?

Does this close any open issues?

Closes 8869

Screenshots

Include any relevant screenshots here.

Other Information

Any other information that is important to this PR.

… names from job/stage names

This enhancement addresses the issue where the Azure DevOps plugin was unable to
correctly detect production deployments when the environment name is embedded in
job/stage names rather than being in a standard format.

Changes:
- Add `environment_pattern` scope config field that supports regex capture groups
  to extract environment names from job/stage names
- Collect both Job and Stage records from the timeline API (previously only Job)
- Add `identifier`, `type`, and `parent_id` fields to the Job model
- Update environment detection logic:
  - If environment_pattern is configured, extract the environment name first
  - Apply production_pattern to the extracted environment name
  - Fall back to matching production_pattern against job name if no extraction
- Fix default environment behavior: only default to PRODUCTION when
  production_pattern is not configured (was defaulting PRODUCTION always)
- Add comprehensive tests for the new functionality

Example configuration for pipelines with jobs like 'deploy_xxxx-prod_helm':
- deployment_pattern: deploy
- production_pattern: prod
- environment_pattern: (?:deploy|predeploy)[_-](.+?)(?:[_-](?:helm|terraform))?$

This extracts 'xxxx-prod' from the job name and then applies production_pattern
to correctly identify it as a production deployment.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. component/plugins This issue or PR relates to plugins improvement pr-type/feature-development This PR is to develop a new feature priority/medium This issue is medium important labels Dec 31, 2025
Copy link
Contributor

@abeizn abeizn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@warren830 warren830 merged commit a0f1c98 into main Dec 31, 2025
10 checks passed
@warren830 warren830 deleted the fix-8669 branch December 31, 2025 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/plugins This issue or PR relates to plugins improvement pr-type/feature-development This PR is to develop a new feature priority/medium This issue is medium important size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants