Skip to content
Open
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
12 changes: 12 additions & 0 deletions .pipelines/EV2Specs/ServiceGroupRoot/ConfigServiceGroup.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"Settings": {
"tenantid": "00000000-0000-0000-0000-000000000000",
"environment": "Prod",
"subscription": {
"backFilledSubscriptionId": "00000000-0000-0000-0000-000000000000",
"backFilledSubscriptionName": "default",
"subscriptionkey": "SubKey-Prod-PSResourceGetMAR"
},
"azureResourceGroup": "default"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"$schema": "https://ev2schema.azure.net/schemas/2020-01-01/rolloutParameters.json",
"contentVersion": "1.0.0.0",
"shellExtensions": [
{
"name": "Run",
"type": "Run",
"properties": {
"maxExecutionTime": "PT2H"
},
"package": {
"reference": {
"path": "Shell/Run.tar"
}
},
"launch": {
"command": [
"/bin/bash",
"-c",
"pwsh ./Run/Run.ps1"
],
"environmentVariables": [
{
"name": "NUPKG_PATH",
"reference":
{
"path": "default"
}
},
{
"name": "PSRESOURCE_NAME",
"value": "default"
},
{
"name": "PSRESOURCE_VERSION",
"value": "default"
},
{
"name": "DESTINATION_ACR_NAME",
"value": "default"
},
{
"name": "DESTINATION_ACR_URI",
"value": "default"
},
{
"name": "MI_CLIENTID",
"value": "default"
}
],
"identity": {
"type": "userAssigned",
"userAssignedIdentities": [
"default"
]
}
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://ev2schema.azure.net/schemas/2020-01-01/rolloutParameters.json",
"contentVersion": "1.0.0.0",
"subscriptions": [
{
"name": "SubscriptionProvisioning",
"displayName": "__BACKFILLED_SUBSCRIPTION_NAME__",
"backfilledSubscriptionId": "__BACKFILLED_SUBSCRIPTION_ID__"
}
]
}
33 changes: 33 additions & 0 deletions .pipelines/EV2Specs/ServiceGroupRoot/RolloutSpec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"$schema": "https://ev2schema.azure.net/schemas/2020-04-01/RegionAgnosticRolloutSpecification.json",
"contentVersion": "1.0.0.0",
"rolloutMetadata": {
"serviceModelPath": "ServiceModel.json",
"ScopeBindingsPath": "ScopeBindings.json",
"name": "Microsoft.Azure.PSCore.PSResourceGet",
"rolloutType": "Major",
"buildSource": {
"parameters": {
"versionFile": "buildver.txt"
}
},
"configuration": {
"serviceGroupScope": {
"specPath": "ConfigServiceGroup.json"
}
},
"Notification": {
"Email": {
"To": "default"
}
}
},
"orchestratedSteps": [
{
"name": "PSResourceGetMARRelease",
"targetType": "ServiceResourceDefinition",
"targetName": "PSResourceGetMARReleaseShell",
"actions": ["Shell/Run"]
}
]
}
36 changes: 36 additions & 0 deletions .pipelines/EV2Specs/ServiceGroupRoot/ScopeBindings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"$schema": "https://ev2schema.azure.net/schemas/2020-01-01/scopeBindings.json",
"contentVersion": "0.0.0.1",
"scopeBindings": [
{
"scopeTagName": "Global",
"bindings": [
{
"find": "__SUBSCRIPTION_ID__",
"replaceWith": "$azureSubscriptionId()"
},
{
"find": "__RESOURCE_GROUP__",
"replaceWith": "$azureResourceGroup()"
},
{
"find": "__BUILD_VERSION__",
"replaceWith": "$buildVersion()"
}
]
},
{
"scopeTagName": "scope.tag.subscriptionprovisioning",
"bindings": [
{
"find": "__BACKFILLED_SUBSCRIPTION_NAME__",
"replaceWith": "$config(subscription.backFilledSubscriptionName)"
},
{
"find": "__BACKFILLED_SUBSCRIPTION_ID__",
"replaceWith": "$config(subscription.backFilledSubscriptionId)"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "Microsoft.Azure.PSCore.PSResourceGet",
"description": "PSResourceGet Publish to MAR",
"ownerGroupObjectId": "00000000-0000-0000-0000-000000000000",
"ownerGroupContactEmail": "default",
"contentVersion": "1.0.0.0"
}
52 changes: 52 additions & 0 deletions .pipelines/EV2Specs/ServiceGroupRoot/ServiceModel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"$schema": "https://ev2schema.azure.net/schemas/2020-04-01/regionAgnosticServiceModel.json",
"contentVersion": "1.0.0.0",
"serviceMetadata": {
"serviceIdentifier": "00000000-0000-0000-0000-000000000000",
"serviceGroup": "Microsoft.Azure.PSCore.PSResourceGet",
"serviceSpecificationPath": "ServiceSpecification.json",
"serviceGroupSpecificationPath": "ServiceGroupSpecification.json",
"environment": "$config(environment)",
"displayName":"PSResourceGet-Ev2Release-MAR",
"tenantId":"$config(tenantid)"
},
"subscriptionProvisioning": {
"rolloutParametersPath": "Parameters\\subscriptionProvisioning.rolloutParameters.json",
"scopeTags": [
{
"name": "scope.tag.subscriptionprovisioning"
}
]
},
"serviceResourceGroupDefinitions": [
{
"name": "OneBranch-PSResourceGet-RGDef",
"azureResourceGroupName": "$config(azureResourceGroup)",
"subscriptionKey": "$config(subscription.subscriptionkey)",
"serviceResourceDefinitions": [
{
"name": "PSResourceGetMARReleaseShell",
"composedOf": {
"extension": {
"rolloutParametersPath": "PSResourceGetReleaseMAR.Rollout.json",
"shell": [
{
"type": "Run",
"properties": {
"imageName": "adm-azurelinux-30-l",
"imageVersion": "v2"
}
}
]
}
},
"scopeTags": [
{
"name": "Global"
}
]
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://ev2schema.azure.net/schemas/2020-01-01/serviceSpecification.json",
"providerType": "ServiceTree",
"identifier": "00000000-0000-0000-0000-000000000000",
"description": "PowerShell Core service for deployments.",
"ownerGroupContactEmail": "default",
"policyCheckEnabled": true,
"contentVersion": "1.0.0.0"
}
85 changes: 85 additions & 0 deletions .pipelines/EV2Specs/ServiceGroupRoot/Shell/Run/Run.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# ensure variables were passed in
if ($env:NUPKG_PATH -eq $null)
{
Write-Verbose -Verbose "NUPKG_PATH variable didn't get set properly"
return 1
}

if ($env:PSRESOURCE_NAME -eq $null)
{
Write-Verbose -Verbose "PSRESOURCE_NAME variable didn't get set properly"
return 1
}

if ($env:PSRESOURCE_VERSION -eq $null)
{
Write-Verbose -Verbose "PSRESOURCE_VERSION variable didn't get set properly"
return 1
}

if ($env:DESTINATION_ACR_NAME -eq $null)
{
Write-Verbose -Verbose "DESTINATION_ACR_NAME variable didn't get passed correctly"
return 1
}

if ($env:DESTINATION_ACR_URI -eq $null)
{
Write-Verbose -Verbose "DESTINATION_ACR_URI variable didn't get passed correctly"
return 1
}

if ($env:MI_CLIENTID -eq $null)
{
Write-Verbose -Verbose "MI_CLIENTID variable didn't get passed correctly"
return 1
}

try {
Write-Verbose -Verbose ".nupkg file path: $env:NUPKG_PATH"
Write-Verbose -Verbose "psresource name: $env:PSRESOURCE_NAME"
Write-Verbose -Verbose "psresource version: $env:PSRESOURCE_VERSION"
Write-Verbose -Verbose "ACR name: $env:DESTINATION_ACR_NAME"
Write-Verbose -Verbose "ACR uri: $env:DESTINATION_ACR_URI"
Write-Verbose -Verbose "MI client Id: $env:MI_CLIENTID"

$nupkgFileName = "$($env:PSRESOURCE_NAME).$($env:PSRESOURCE_VERSION).nupkg"
Write-Verbose -Verbose "Download file"
Invoke-WebRequest -Uri $env:NUPKG_PATH -OutFile $nupkgFileName

# Install PSResourceGet 1.1.0
Write-Verbose "Download PSResourceGet version 1.1.0"
Register-PSRepository -Name CFS -SourceLocation "https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell/nuget/v2" -InstallationPolicy Trusted
Install-Module -Repository CFS -Name Microsoft.PowerShell.PSResourceGet -RequiredVersion '1.1.0' -AllowPrerelease -Verbose
Import-Module Microsoft.PowerShell.PSResourceGet
Get-Module

# Login to Azure CLI using Managed Identity
Write-Verbose -Verbose "Login cli using managed identity"
az login --identity --client-id $env:MI_CLIENTID

# Register the target ACR as a PSResourceGet repository
Write-Verbose -Verbose "Register ACR as a PSResourceGet reposirory"
Register-PSResourceRepository -Uri $env:DESTINATION_ACR_URI -Name $env:DESTINATION_ACR_NAME -Trusted -Verbose

Get-PSResourceRepository

# Publish module to ACR
Write-Verbose -Verbose "Publish $env:PSRESOURCE_NAME from file $nupkgFileName to ACR $env:DESTINATION_ACR_NAME"

# unlisted
$prefix = "unlisted/psresource"
Publish-PSResource -NupkgPath $nupkgFileName -Repository $env:DESTINATION_ACR_NAME -ModulePrefix $prefix -Confirm:$false

# public
$prefix = "public/psresource"

Publish-PSResource -NupkgPath $nupkgFileName -Repository $env:DESTINATION_ACR_NAME -ModulePrefix $prefix -Confirm:$false
}
catch {
$_.Exception | Format-List -Force

return 1
}

return 0
1 change: 1 addition & 0 deletions .pipelines/EV2Specs/ServiceGroupRoot/buildVer.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.2.0.101
80 changes: 80 additions & 0 deletions .pipelines/PSResourceGet-Release-Official-Azure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#################################################################################
# OneBranch Pipelines #
# Documentation: https://aka.ms/onebranchrelease #
# Yaml Schema: https://aka.ms/obpipelines/yaml/schema #
# Support: https://aka.ms/onebranchsupport #
#################################################################################
name: PSResourceGet-Release-Official-$(Build.BuildId)
trigger: none # https://aka.ms/obpipelines/triggers
pr:
branches:
include:
- master
- release*

parameters: # parameters are shown up in ADO UI in a build queue time
- name: 'debug'
displayName: 'Enable debug output'
type: boolean
default: false
- name: 'rolloutType'
displayName: 'SDP rollout type'
type: string
default: 'normal'
values:
- normal
- emergency
- globaloutage
- name: 'overrideManagedValidationDuration'
displayName: 'Override standard SDP duration?'
type: boolean
default: false
- name: 'managedValidationDurationInHours'
displayName: 'Override standard SDP duration (in hours)'
type: number
default: 0
- name: 'icmIncidentId'
displayName: 'IcM Incident Id'
type: number
default: 0

variables:
- name: DOTNET_CLI_TELEMETRY_OPTOUT
value: 1
- name: POWERSHELL_TELEMETRY_OPTOUT
value: 1
- name: ob_sdl_tsa_configFile
value: $(Build.SourcesDirectory)\.config\tsaoptions.json
- name: WindowsContainerImage
value: onebranch.azurecr.io/windows/ltsc2022/vse2022:latest # Docker image which is used to build the project https://aka.ms/obpipelines/containers
- name: LinuxContainerImage
value: mcr.microsoft.com/onebranch/azurelinux/build:3.0

resources:
repositories:
- repository: templates
type: git
name: OneBranch.Pipelines/GovernedTemplates
ref: refs/heads/main
# https://learn.microsoft.com/en-us/azure/devops/pipelines/process/resources?view=azure-devops&tabs=example#define-a-pipelines-resource

pipelines:
- pipeline: PSResourceGetBuild
source: PSResourceGet-Official

extends:
template: v2/OneBranch.Official.CrossPlat.yml@templates # The Official template may only be used by Production-classified pipelines
parameters:
featureFlags:
linuxEsrpSigning: true
globalSdl:
tsaOptionsFile: .config\tsaoptions.json
ev2ManagedSdpRolloutConfig:
rolloutType: ${{parameters.rolloutType}}
overrideManagedValidationDuration: ${{parameters.overrideManagedValidationDuration}}
managedValidationOverrideDurationInHours: ${{parameters.managedValidationDurationInHours}}
icmIncidentId: ${{parameters.icmIncidentId}}

stages:
- template: /.pipelines/templates/release-publish-mar.yml@self

Loading