warren830 opened a new pull request, #8671:
URL: https://github.com/apache/incubator-devlake/pull/8671
… 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)
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
### ⚠️ Pre Checklist
> Please complete _ALL_ items in this checklist, and remove before submitting
- [ ] I have read through the [Contributing
Documentation](https://devlake.apache.org/community/).
- [ ] 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.
<!--
Thanks for submitting a pull request!
We appreciate you spending the time to work on these changes.
Please fill out as many sections below as possible.
-->
### 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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]