Skip to content

Conversation

@tejaswiMinnu
Copy link
Contributor

Overview
The ARM lease validation system makes it easy to check Azure Resource Manager resource provider leases automatically when you open or update a pull request. It helps teams confirm they've got valid leases before making changes to resource providers in the azure-rest-api-specs repo.

Core Components
There are two main modules: detect-arm-leases.js, which handles the lease validation with the checkLease(serviceName, resourceProvider) function, and detect-new-resource-provider.js, which spots new resource provider namespaces and connects with the lease check.

Resource Provider Detection Workflow
Whenever a pull request comes in, the workflow checks for changes in specification/**/resource-manager directories to find new RP namespaces. The extractResourceProviders function gives you a Map of namespace-to-serviceName pairs, which are checked against existing paths with resourceProviderExists. For each new namespace found, checkLease runs and the results are collected and output is designed for consumption by GitHub Actions through the GitHub Script action, enabling automated PR comments that direct contributors to attend office hours for missing or expired leases.

Lease Validation Logic
The checkLease function reads YAML lease files from arm-leases///lease.yaml and checks if the lease is still valid using today <= (startDate + duration). It returns true if the lease is good, or false if it's missing or expired. The system works with different duration formats and handles issues like missing files, invalid YAML, and future start dates without crashing

Just a heads up, this workflow is currently behind a feature flag, so the PMs will decide when and how it gets released.

@github-actions
Copy link

github-actions bot commented Jan 13, 2026

Next Steps to Merge

Next steps that must be taken to merge this PR:
  • ❌ The required check named Protected Files has failed. Refer to the check in the PR's 'Checks' tab for details on how to fix it and consult the aka.ms/ci-fix guide
  • ❌ The required check named SpellCheck has failed. Refer to the check in the PR's 'Checks' tab for details on how to fix it and consult the aka.ms/ci-fix guide


Comment generated by summarize-checks workflow run.

@tejaswiMinnu tejaswiMinnu changed the title Detect new Resource Provider Namespaces, check and validate arm-leases for the new RP's Detect new Resource Provider Namespaces, check and validate arm-leases for the RP's Jan 13, 2026
@@ -0,0 +1,73 @@
import { existsSync, readFileSync } from 'fs';
import { join } from 'path';
Copy link
Member

Choose a reason for hiding this comment

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

Is this file just being checked in and not used currently ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

const SPECIFICATION_PATH = 'specification';
// Match pattern: specification/<service>/resource-manager/<ResourceProvider.Namespace>/...
const RESOURCE_MANAGER_PATTERN = /^specification\/[^\/]+\/resource-manager\/([^\/]+)/;

Copy link
Member

Choose a reason for hiding this comment

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

We probably need to consider the folder structure for new service groups as well eventually right ? for example Microsoft.Compute :

https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated code considering service group as optional

export function checkLease(serviceName, resourceProvider) {
try {
const repoRoot = process.env.TEST_REPO_ROOT || execSync('git rev-parse --show-toplevel', { encoding: 'utf-8' }).trim();
const leasePath = join(repoRoot, '.github', 'arm-leases', serviceName, resourceProvider, 'lease.yaml');
Copy link
Member

Choose a reason for hiding this comment

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

resourceProvider

here again we need to take in servicergoup as optional param. Look at Microsoft.Compute as an example :

https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants