Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions eng/common/TestResources/New-TestResources.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,15 @@ try {
# Make sure the provisioner OID is set so we can pass it through to the deployment.
if (!$ProvisionerApplicationId -and !$ProvisionerApplicationOid) {
if ($context.Account.Type -eq 'User') {
# HomeAccountId format is '<object id>.<tenant id>'
$userAccountId = (Get-AzContext).Account.ExtendedProperties.HomeAccountId.Split('.')[0]
# Calls to graph API in corp tenant get blocked by conditional access policy now
# but not in TME. For corp tenant we get the user's id from the login context
# but for TME it is different so we have to source it from graph
$userAccountId = if ($wellKnownTMETenants.Contains($TenantId)) {
(Get-AzADUser -SignedIn).Id
} else {
# HomeAccountId format is '<object id>.<tenant id>'
(Get-AzContext).Account.ExtendedProperties.HomeAccountId.Split('.')[0]
}
if ($null -eq $userAccountId) {
throw "Failed to find entra object ID for the current user"
}
Expand Down Expand Up @@ -430,12 +437,20 @@ try {

if (!$CI -and !$ServicePrincipalAuth) {
if ($TestApplicationId) {
Write-Warning "The specified TestApplicationId '$TestApplicationId' will be ignored when -ServicePrincipalAutth is not set."
Write-Warning "The specified TestApplicationId '$TestApplicationId' will be ignored when -ServicePrincipalAuth is not set."
}

$userAccountName = (Get-AzContext).Account.Id
# HomeAccountId format is '<object id>.<tenant id>'
$userAccountId = (Get-AzContext).Account.ExtendedProperties.HomeAccountId.Split('.')[0]
# Calls to graph API in corp tenant get blocked by conditional access policy now
# but not in TME. For corp tenant we get the user's id from the login context
# but for TME it is different so we have to source it from graph
$userAccountId = if ($wellKnownTMETenants.Contains($TenantId)) {
(Get-AzADUser -SignedIn).Id
} else {
# HomeAccountId format is '<object id>.<tenant id>'
(Get-AzContext).Account.ExtendedProperties.HomeAccountId.Split('.')[0]
}
if ($null -eq $userAccountId) {
throw "Failed to find entra object ID for the current user"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
description: 'Check API Readiness for SDK Generation'
---
Your goal is to check if API spec pull request is ready for SDK generation. Identify the next action required from user based on the comments on spec pull request if spec is not ready and notify the user.
Before running, get spec pull request link for current branch or from user if not available in current context. If pull request has APIView links, then highlight them to user.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
description: 'This prompt is designed to check the release readiness of a SDK package.'
---
## Goal
Check the release readiness of an SDK package by collecting the required information from the user and executing the readiness check.

## Instructions
1. **Collect Required Information**:
- Prompt the user for the exact package name
- Prompt the user to select the programming language from the following options (case sensitive):
- Python
- Java
- JavaScript
- .NET
- Go

2. **Execute Readiness Check**:
- Use the `azsdk_check_package_release_readiness` tool with the provided package name and selected language
- Do not check for existing pull requests to run this step.
- Do not ask the user to create a release plan to run this step.

3. **Present Results**:
- If the package is ready for release, highlight and provide the link to the release pipeline
- If the package is not ready, display the specific issues that need to be resolved

4. **Follow-up Actions**:
- Provide clear next steps based on the readiness status
- If issues are found, offer guidance on how to resolve them

## Expected User Interaction Flow
1. Ask: "What is the exact name of the package you want to check for release readiness?"
2. Ask: "Please select the programming language for this package: Python, Java, JavaScript, .NET, or Go"
3. Execute the readiness check using the provided information
4. Display results and next steps
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Release Plan Creation Process
You goal is to create a valid release plan. You must prompt user to provide all required information and all input must match the format and requirement mentioned in step 3 below.
Follow these steps in order to create or manage a release plan for an API specification pull request:

## Step 1: Validate Prerequisites
- Check if an API spec pull request is available in the current context
- If no pull request is available, prompt the user to provide the API spec pull request link
- Validate that the provided pull request link is accessible and valid

## Step 2: Check Existing Release Plan
- Use `azsdk_get_release_plan_for_spec_pr` to check if a release plan already exists for the API spec pull request
- If a release plan exists:
- Display the existing release plan details to the user
- Skip to Step 5 (Link SDK Pull Requests)
- If no release plan exists, proceed to Step 3

## Step 3: Gather Release Plan Information
Collect the following required information from the user. Do not create a release plan with temporary values. Confirm the values with the user before proceeding to create the release plan.
If any details are missing, prompt the user accordingly:

- **API Lifecycle Stage**: Must be one of:
- Private Preview
- Public Preview
- GA (Generally Available)
- **Service Tree ID**: GUID format identifier for the service in Service Tree. Before creating release plan, always show the value to user and ask them to confirm it's a valid value in service tree.
- **Product Service Tree ID**: GUID format identifier for the product in Service Tree. Before creating release plan, always show the value to user and ask them to confirm it's a valid value in service tree.
- **Expected Release Timeline**: Format must be in "Month YYYY"
- **API Version**: The version of the API being released
- **SDK Release Type**: Value must be beta or stable.
- "beta" for preview API versions
- "stable" for GA API versions

## Step 4: Create Release Plan
- If the user doesn't know the required details, direct them to create a release plan using the release planner
- Provide this resource: [Release Plan Creation Guide](https://eng.ms/docs/products/azure-developer-experience/plan/release-plan-create)
- Once all information is gathered, use `azsdk_create_release_plan` to create the release plan
- Display the newly created release plan details to the user for confirmation
- Refer to #file:sdk-details-in-release-plan.instructions.md to identify languages configured in the TypeSpec project and add them to the release plan

## Step 5: Update SDK Details in Release Plan
- Refer to #file:sdk-details-in-release-plan.instructions.md to add languages and package names to the release plan
- If the TypeSpec project is for a management plane, refer to #file:verify-namespace-approval.instructions.md if this is first release of SDK.

## Step 6: Link SDK Pull Requests (if applicable)
- Ask the user if they have already created SDK pull requests locally for any programming language
- If SDK pull requests exist:
- Collect the pull request links from the user
- Use `azsdk_link_sdk_pull_request_to_release_plan` to link each SDK pull request to the release plan
- Confirm successful linking for each SDK pull request

## Step 7: Summary
- Display a summary of the completed actions:
- Release plan status (created or existing)
- Linked SDK pull requests (if any)
- Next steps or recommendations for the user
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Your goal is to help guide the user to create SDK locally for TypeSpec changes. This is currently supported for **Python** only. User can generate SDK for other languages using SDK generation pipeline.
## Steps to create Python SDK locally from TypeSpec
### Step 1: Check for existing azure-sdk-for-python repository
- Prompt the user to provide the path to their cloned azure-sdk-for-python repository.
### Step 2: Validate repository path
- If the user provides a path to the azure-sdk-for-python repository:
- Check if the repository exists at the specified path.
- If the repository exists, proceed to Step 5.
### Step 3: Guide user to set up azure-sdk-for-python repository (if not found)
- If the user does not have the repository or the path is invalid:
- Go to parent directory of current repo root path.
- Provide instructions to fork https://github.com/Azure/azure-sdk-for-python repository to the user's GitHub account.
- Provide instructions to clone the forked repository to the local machine:
```bash
git clone https://github.com/<github-username>/azure-sdk-for-python.git
```
### Step 4: Set repository path
- Consider the cloned path as the path to the azure-sdk-for-python repository.
### Step 5: Open azure-sdk-for-python repository in VSCode
- Do not ask the user to run tsp compile.
- Prompt user to open the azure-sdk-for-python repository in VSCode.
### Step 6: Provide SDK generation instructions
- Inform user to use the following prompt to start SDK generation using GitHub Copilot agent:
```
"Help me generate SDK for Python from TypeSpec API specification for project <path to TypeSpec project root>."
```
### Step 7: Inform user about SDK generation
- Inform user to provide link to SDK pull request if they generate SDK locally and created a pull request for it. SDK generation
step below will skip it for the language and reuse the pull request link provided by the user.
- In some cases, user will come back and make more changes to TypeSpec so start the process from step 1 again.
- If user provides a link to SDK pull request then link SDK pull request to release plan if a release plan already exists and skip SDK generation for that language.
- If a release plan does not exits then link the SDK pull request when release plan is created.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Your goal is to identify modified TypeSpec project in current branch and create a pull request for it.
Check if a pull request already exists using GetPullRequestForCurrentBranch. If a pull request exists, inform the user and show the pull request details. If no pull request exists, create a new pull request using CreatePullRequest.

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
description: 'Generate SDKs from TypeSpec using pipeline'
---
Your goal is to generate SDKs from the TypeSpec spec pull request. Get API spec pull request link for current branch or from user if not available in current context.
Provide links to SDK pull request when generated for each language.

## Steps for SDK Generation

### Step 1: Check for Existing SDK Pull Requests
- Check if SDK pull requests exist from local SDK generation for any languages
- If SDK pull request exists for a language, skip SDK generation for that language
- Link existing SDK pull request to release plan

### Step 2: Retrieve and Validate Release Plan
- Retrieve the release plan for the API spec
- If API Lifecycle Stage is `Private Preview` then inform user that SDK generation is not supported for this stage and complete the workflow.
- Check if SDK generation has already occurred for each language
- Verify if SDK pull requests exist for each language:
- If an SDK pull request exists, display its details
- If no pull request exists or regeneration is needed, proceed to next step

### Step 3: Execute SDK Generation Pipeline
- Run SDK generation for each required language: Python, .NET, JavaScript, Java, and Go
- Execute the SDK generation pipeline with the following required parameters:
- TypeSpec project root path
- Pull request number (if the API spec is not merged to the main branch)
- API version
- SDK release type (beta for preview API versions, stable otherwise)
- Language options: `Python`, `.NET`, `JavaScript`, `Java`, `Go`
- Release plan work item ID

### Step 4: Monitor Pipeline Status
- Check the status of SDK generation pipeline every 2 minutes
- Continue monitoring until pipeline succeeds or fails
- Get SDK pull request link from pipeline once available

### Step 5: Display Results
- Show all pipeline details once pipeline is in completed status
- Highlight the language name for each SDK generation task when displaying details
- Once SDK pull request URL is available:
- Inform the user of successful SDK generation
- Display the pull request details for each language
- Provide links to each generated SDK pull request
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
description: 'Identify languages configured in the TypeSpec project and add it to release plan'
---
# Step 1: Find the list of languages and package names
**Goal**: Identify languages configured in the TypeSpec project and generate the json object with language and package name.
1. Identify the language emitter configuration in the `tspconfig.yaml` file in the TypeSpec project root.
2. Identify the package name or namespace for each language emitter.
3. Map the language name in emitter to one of the following in Pascal case(except .NET):
- .NET
- Java
- Python
- JavaScript
- Go
4. Remove `github.com/Azure/azure-sdk-for-go/` from Go package name.
4. Create a JSON array object with the following structure:
```json
[
{
"language": "<LanguageName>",
"packageName": "<PackageName>"
},
...
]
```
5. If no languages are configured, inform the user: "No languages configured in TypeSpec project. Please add at least one language emitter in tspconfig.yaml."
**Success Criteria**: JSON object with languages and package names created.

# Step 2: Check if release plan exists
**Goal**: Determine if a release plan exists for the API spec pull request or work item Id or release plan Id in current context.
1. Get release plan
2. If no release plan exists, inform the user: "No release plan exists for the API spec pull request. Please create a release plan first."
3. If a release plan exists, proceed to Step 3.
**Success Criteria**: Release plan exists or user informed to create one.

# Step 3: Update Release Plan with SDK Information
**Goal**: Update the release plan with the languages and package names identified in Step 1.
1. Use `azsdk_update_sdk_details_in_release_plan` to update the release plan work item with the JSON object created in Step 1.
2. Confirm successful update of the release plan with the SDK information and summary of languages and package names.
**Success Criteria**: Release plan updated with languages and package names.
Loading
Loading