Skip to content
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

[CI Environment] Change Task Type for ADO in the publishing to bicep registry #1340

Merged
merged 4 commits into from
Apr 29, 2022
Merged
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: 13 additions & 10 deletions .azuredevops/pipelineTemplates/jobs.publishModule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -255,20 +255,23 @@ jobs:

# [private bicep registry publish] task(s)
#-------------------------------------------
SeSeicht marked this conversation as resolved.
Show resolved Hide resolved
- task: AzurePowerShell@5
- task: AzureCLI@2
displayName: 'Publish module to private bicep registry'
condition: and(
eq(variables['bicepRegistryDoPublish'], true),
succeeded()
)
enabled: true
inputs:
addSpnToEnvironment: true
azureSubscription: '${{ parameters.serviceConnection }}'
azurePowerShellVersion: ${{ parameters.azurePowerShellVersion }}
preferredAzurePowerShellVersion: ${{ parameters.preferredAzurePowerShellVersion }}
pwsh: true
ScriptType: InlineScript
inline: |
scriptType: pscore
scriptLocation: inlineScript
inlineScript: |
# Log into Az-PowerShell context
$SecuredPassword = ConvertTo-SecureString -AsPlainText -String $env:servicePrincipalKey
SeSeicht marked this conversation as resolved.
Show resolved Hide resolved
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $env:servicePrincipalId, $SecuredPassword
Connect-AzAccount -ServicePrincipal -TenantId $env:tenantId -Credential $Credential

# Load used functions
SeSeicht marked this conversation as resolved.
Show resolved Hide resolved
. (Join-Path '$(System.DefaultWorkingDirectory)' '$(pipelineFunctionsPath)' 'resourcePublish' 'Get-ModulesToPublish.ps1')
. (Join-Path '$(System.DefaultWorkingDirectory)' '$(pipelineFunctionsPath)' 'resourcePublish' 'Publish-ModuleToPrivateBicepRegistry.ps1')
Expand All @@ -295,16 +298,16 @@ jobs:
Write-Host "##[group]$(' - [{0}] [{1}]' -f $RelPath, $ModuleToPublish.Version)"

$functionInput = @{
TemplateFilePath = $ModuleToPublish.TemplateFilePath
TemplateFilePath = $ModuleToPublish.TemplateFilePath
BicepRegistryName = '${{ parameters.bicepRegistryName }}'
BicepRegistryRgName = '${{ parameters.bicepRegistryRgName }}'
BicepRegistryRgLocation = '${{ parameters.bicepRegistryRgLocation }}'
ModuleVersion = $ModuleToPublish.Version
ModuleVersion = $ModuleToPublish.Version
}

Write-Verbose "Invoke Publish-ModuleToPrivateBicepRegistry with" -Verbose
Write-Verbose ($functionInput | ConvertTo-Json | Out-String) -Verbose

Publish-ModuleToPrivateBicepRegistry @functionInput -Verbose
Write-Host "##[endgroup]"
}
}