-
Notifications
You must be signed in to change notification settings - Fork 235
Add script/pipeline for manual cpex attestation #12444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| trigger: none | ||
| pr: none | ||
|
|
||
| pool: | ||
| name: azsdk-pool | ||
| demands: ImageOverride -equals ubuntu-24.04 | ||
|
|
||
| parameters: | ||
| - name: TableName | ||
| type: string | ||
| default: 'ProdKpiEvidenceStream' | ||
|
|
||
| jobs: | ||
| - job: AttestCPEXKPIs | ||
| steps: | ||
| - checkout: self | ||
| - task: AzureCLI@2 | ||
| displayName: Invoke CPEX KPI Attestation Automation | ||
| inputs: | ||
| azureSubscription: opensource-api-connection | ||
| scriptType: pscore | ||
| scriptPath: eng/scripts/Invoke-CPEX-Attestation-Automation.ps1 | ||
| arguments: > | ||
| -AzureSDKEmailUri "$(AzureSDKEmailerSasURL)" | ||
| -TableName "$(TableName)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| trigger: none | ||
| pr: none | ||
|
|
||
| pool: | ||
| name: azsdk-pool | ||
| demands: ImageOverride -equals ubuntu-24.04 | ||
|
|
||
| parameters: | ||
| - name: TableName | ||
| type: string | ||
| default: 'ProdKpiEvidenceStream' | ||
| displayName: Table Name | ||
| - name: ActionItemId | ||
| type: string | ||
| displayName: KPI ID | ||
| - name: TargetId | ||
| type: string | ||
| displayName: Product ID | ||
| - name: TargetType | ||
| type: string | ||
| values: | ||
| - Service | ||
| - Offering | ||
| - ProductSku | ||
| - Feature | ||
| displayName: Target Type | ||
| - name: Status | ||
| type: int | ||
| displayName: Status (0 - Incomplete, 1 - Complete, 3 - N/A) | ||
| values: | ||
| - 0 | ||
| - 1 | ||
| - 3 | ||
| - name: EvidenceUrl | ||
| type: string | ||
| displayName: Evidence Link | ||
|
|
||
| jobs: | ||
| - job: ManualAttestationEntry | ||
| steps: | ||
| - checkout: self | ||
| - task: AzureCLI@2 | ||
| displayName: Submit Manual CPEX KPI Entry | ||
| inputs: | ||
| azureSubscription: opensource-api-connection | ||
| scriptType: pscore | ||
| scriptPath: eng/scripts/Add-CPEX-Attestation-Entry.ps1 | ||
| arguments: > | ||
| -TableName "$(TableName)" | ||
| -ActionItemId "$(ActionItemId)" | ||
| -TargetId "$(TargetId)" | ||
| -TargetType "$(TargetType)" | ||
| -Status "$(Status)" | ||
| -EvidenceUrl "$(EvidenceUrl)" | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| <# | ||
| .SYNOPSIS | ||
| Adds a CPEX KPI attestation entry to the Kusto database. | ||
|
|
||
| .DESCRIPTION | ||
| This script is designed to support both automated and manual workflows for CPEX KPI attestation. | ||
| It inserts a single attestation record into the specified Kusto table, capturing key metadata such as the action item ID, target product ID and type, attestation status, and evidence URL. | ||
| In automated scenarios, it can be invoked as part of a larger pipeline to log attestations programmatically. | ||
| For manual use, it enables engineers to insert individual entries when automation is not applicable or when validating edge cases. | ||
|
|
||
| .PARAMETER TableName | ||
| The name of the Kusto table where attestation entries will be written. | ||
|
|
||
| .PARAMETER ActionItemId | ||
| The unique identifier for the KPI action item being attested. | ||
|
|
||
| .PARAMETER TargetId | ||
| The Service Tree ID of the product being attested. | ||
|
|
||
| .PARAMETER TargetType | ||
| The type of the product (e.g., ProductSku, Feature, Offering). | ||
|
|
||
| .PARAMETER Status | ||
| The attestation status value (e.g., 0 for Incomplete, 1 for Completed, 3 for Not Applicable). | ||
|
|
||
| .PARAMETER EvidenceUrl | ||
| The URL pointing to the evidence supporting the attestation, i.e. link to release plan | ||
| #> | ||
|
|
||
| param ( | ||
| [Parameter(Mandatory = $true)] | ||
| [string] $TableName, | ||
|
|
||
| [Parameter(Mandatory = $true)] | ||
| [string] $ActionItemId, | ||
|
|
||
| [Parameter(Mandatory = $true)] | ||
| [string] $TargetId, | ||
|
|
||
| [Parameter(Mandatory = $true)] | ||
| [string] $TargetType, | ||
|
|
||
| [Parameter(Mandatory = $true)] | ||
| [int] $Status, | ||
|
|
||
| [Parameter(Mandatory = $true)] | ||
| [string] $EvidenceUrl | ||
|
|
||
| ) | ||
|
|
||
| function InvokeKustoCommand($command) { | ||
| try { | ||
| $clusterUri = "https://azsdk-cpex-attestation.westus2.kusto.windows.net" | ||
| $databaseName = "CPEX_Attestation_DB" | ||
| $accessToken = az account get-access-token --resource "https://api.kusto.windows.net" --query "accessToken" --output tsv | ||
| $headers = @{ Authorization="Bearer $accessToken" } | ||
| $body = @{ csl = $command; db = $databaseName } | ConvertTo-Json -Depth 3 | ||
| Invoke-RestMethod -Uri "$clusterUri/v1/rest/mgmt" -Headers $headers -Method Post -Body $body -ContentType "application/json" | ||
| } catch { | ||
| Write-Error "Failed to invoke Kusto command: $command" | ||
| Write-Error "Exception message: $($_.Exception.Message)" | ||
| throw "Terminating due to failure in invoking kusto command" | ||
| } | ||
|
|
||
| } | ||
|
|
||
| $command = @" | ||
| .append $TableName <| | ||
| ActionItemId = "$ActionItemId", | ||
| TargetId = "$TargetId", | ||
| TargetType = "$TargetType", | ||
| Status = int($Status), | ||
| CreatedTime = datetime(now), | ||
| EvidenceUrl = "$EvidenceUrl" | ||
| "@ | ||
|
|
||
| Write-Host "Adding attestation entry for product [$targetId], with status [$status] for KPI action id [$actionItemId]." | ||
| InvokeKustoCommand $command | ||
| Write-Host "Added attestation entry for product [$targetId], with status [$status] for KPI action id [$actionItemId]." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.