From 8ac18789bc65206a7dffd6374c10397ba52f8e7f Mon Sep 17 00:00:00 2001 From: MrMCake Date: Fri, 30 Sep 2022 13:11:34 +0200 Subject: [PATCH] Removed checkout repository leftovers --- .../pipelineTemplates/jobs.publishModule.yml | 40 +++---------------- .../jobs.validateModulePester.yml | 32 +-------------- 2 files changed, 8 insertions(+), 64 deletions(-) diff --git a/.azuredevops/pipelineTemplates/jobs.publishModule.yml b/.azuredevops/pipelineTemplates/jobs.publishModule.yml index 9bb91ae535..d60dbb4247 100644 --- a/.azuredevops/pipelineTemplates/jobs.publishModule.yml +++ b/.azuredevops/pipelineTemplates/jobs.publishModule.yml @@ -45,7 +45,6 @@ parameters: # Pipeline-related parameters - checkoutRepositories: '' displayName: 'Publishing' serviceConnection: '$(serviceConnection)' poolName: '$(poolName)' @@ -93,11 +92,6 @@ jobs: #-------------------------------- - checkout: self fetchDepth: 0 - - ${{ if ne(parameters.checkoutRepositories, '') }}: - - ${{ each checkoutRepository in parameters.checkoutRepositories }}: - - checkout: ${{ checkoutRepository }} - fetchDepth: 1 # the depth of commits to ask Git to fetch; if not set defaults to no limit - path: 's/${{ checkoutRepository }}' # [Agent] Prepare environment #---------------------------- @@ -120,28 +114,6 @@ jobs: # Set agent up Set-EnvironmentOnAgent -PSModules $Modules - # [Multi Repo] Support task - #-------------------------- - - task: PowerShell@2 - displayName: Handle Multi-Repo Invocation - inputs: - targetType: inline - pwsh: true - script: | - # ---------------------------- # - # HANDLE MULTI-REPO INVOCATION # - # ---------------------------- # - - # Handle multiple-repositories - if( "${{ join(';',parameters.checkoutRepositories) }}".length -gt 0) { - Write-Verbose "Multi-Repo Checkout" -Verbose - $modulePath = Join-Path '$(System.DefaultWorkingDirectory)' '$(modulesRepository)' '${{ parameters.modulePath }}' - } else { - Write-Verbose "No Multi-Repo Checkout" -Verbose - $modulePath = Join-Path '$(System.DefaultWorkingDirectory)' '${{ parameters.modulePath }}' - } - Write-Output "##vso[task.setvariable variable=ENVMODULEPATH]$modulePath" - # [Universal Artifact-feed publish] task(s) #------------------------------------------ - task: PowerShell@2 @@ -160,9 +132,9 @@ jobs: . (Join-Path '$(System.DefaultWorkingDirectory)' '$(pipelineFunctionsPath)' 'resourcePublish' 'Publish-ModuleToUniversalArtifactFeed.ps1') #Prioritizing the bicep file - $TemplateFilePath = Join-Path '$(ENVMODULEPATH)' 'deploy.bicep' + $TemplateFilePath = Join-Path '$(System.DefaultWorkingDirectory)' '${{ parameters.modulePath }}' 'deploy.bicep' if (-not (Test-Path $TemplateFilePath)) { - $TemplateFilePath = Join-Path '$(ENVMODULEPATH)' 'deploy.json' + $TemplateFilePath = Join-Path '$(System.DefaultWorkingDirectory)' '${{ parameters.modulePath }}' 'deploy.json' } $functionInput = @{ @@ -219,9 +191,9 @@ jobs: . (Join-Path '$(System.DefaultWorkingDirectory)' '$(pipelineFunctionsPath)' 'resourcePublish' 'Publish-ModuleToTemplateSpec.ps1') #Prioritizing the bicep file - $TemplateFilePath = Join-Path '$(ENVMODULEPATH)' 'deploy.bicep' + $TemplateFilePath = Join-Path '$(System.DefaultWorkingDirectory)' '${{ parameters.modulePath }}' 'deploy.bicep' if (-not (Test-Path $TemplateFilePath)) { - $TemplateFilePath = Join-Path '$(ENVMODULEPATH)' 'deploy.json' + $TemplateFilePath = Join-Path '$(System.DefaultWorkingDirectory)' '${{ parameters.modulePath }}' 'deploy.json' } $functionInput = @{ @@ -279,9 +251,9 @@ jobs: . (Join-Path '$(System.DefaultWorkingDirectory)' '$(pipelineFunctionsPath)' 'resourcePublish' 'Publish-ModuleToPrivateBicepRegistry.ps1') #Prioritizing the bicep file - $TemplateFilePath = Join-Path '$(ENVMODULEPATH)' 'deploy.bicep' + $TemplateFilePath = Join-Path '$(System.DefaultWorkingDirectory)' '${{ parameters.modulePath }}' 'deploy.bicep' if (-not (Test-Path $TemplateFilePath)) { - $TemplateFilePath = Join-Path '$(ENVMODULEPATH)' 'deploy.json' + $TemplateFilePath = Join-Path '$(System.DefaultWorkingDirectory)' '${{ parameters.modulePath }}' 'deploy.json' } $functionInput = @{ diff --git a/.azuredevops/pipelineTemplates/jobs.validateModulePester.yml b/.azuredevops/pipelineTemplates/jobs.validateModulePester.yml index 74a485a7b5..a8a0acaa38 100644 --- a/.azuredevops/pipelineTemplates/jobs.validateModulePester.yml +++ b/.azuredevops/pipelineTemplates/jobs.validateModulePester.yml @@ -28,7 +28,6 @@ ## | poolName | '$(poolName)' | You can provide either a [poolname] or [vmImage] to run the job on | 'Custom Deployment Pool' | ## | vmImage | '$(vmImage)' | You can provide either a [poolname] or [vmImage] to run the job on | 'ubuntu20.04' | ## | defaultJobTimeoutInMinutes | 120 | The timeout for the job in this pipeline | 120 | -## | checkoutRepositories | '' | An optional list of repositories to check out at the beginning of this job in addition to the source | 'Components' | ## | modulePath | '$(modulePath)' | The path to the module to deploy. | 'c:/KeyVault' | ## | moduleTestFilePath | '$(moduleTestFilePath)' | The path to the module Pester tests. | 'utilities/pipelines/staticValidation/module.tests.ps1' | ## | location | '$(location)' | The location to validate with | 'France Central' | @@ -49,7 +48,6 @@ parameters: poolName: '$(poolName)' vmImage: '$(vmImage)' defaultJobTimeoutInMinutes: 120 - checkoutRepositories: '' # Logic-related parameters modulePath: '$(modulePath)' moduleTestFilePath: '$(moduleTestFilePath)' @@ -79,32 +77,6 @@ jobs: # [Checkout Repositories] task(s) #-------------------------------- - checkout: self - - ${{ if ne(parameters.checkoutRepositories, '') }}: - - ${{ each checkoutRepository in parameters.checkoutRepositories }}: - - checkout: ${{ checkoutRepository }} - fetchDepth: 1 # the depth of commits to ask Git to fetch; if not set defaults to no limit - path: 's/${{ checkoutRepository }}' - - # [Multi Repo] Support task - #-------------------------- - - task: PowerShell@2 - displayName: Handle Multi-Repo Invocation - inputs: - targetType: inline - pwsh: true - script: | - # Handle multiple-repositories - if( "${{ join(';',parameters.checkoutRepositories) }}".length -gt 0) { - Write-Verbose "Multi-Repo Checkout" -Verbose - $moduleRepoRoot = Join-Path '$(System.DefaultWorkingDirectory)' '$(modulesRepository)' - $parametersRepoRoot = Join-Path '$(System.DefaultWorkingDirectory)' '${{ parameters.parametersRepository }}' - } else { - Write-Verbose "No Multi-Repo Checkout" -Verbose - $moduleRepoRoot = '$(System.DefaultWorkingDirectory)' - $parametersRepoRoot = '$(System.DefaultWorkingDirectory)' - } - Write-Output "##vso[task.setvariable variable=ModuleRepoRoot]$moduleRepoRoot" - Write-Output "##vso[task.setvariable variable=ParametersRepoRoot]$parametersRepoRoot" # [Agent] Prepare environment #---------------------------- @@ -115,7 +87,7 @@ jobs: pwsh: true script: | # Load used functions - . (Join-Path '$(moduleRepoRoot)' 'utilities' 'pipelines' 'sharedScripts' 'Set-EnvironmentOnAgent.ps1') + . (Join-Path '$(System.DefaultWorkingDirectory)' 'utilities' 'pipelines' 'sharedScripts' 'Set-EnvironmentOnAgent.ps1') # Define PS modules to install on the runner $Modules = @( @@ -140,7 +112,7 @@ jobs: pwsh: true inline: | # Set repo root path - $repoRootPath = '$(moduleRepoRoot)' + $repoRootPath = '$(System.DefaultWorkingDirectory)' # Get Service Principal Object ID $context = Get-AzContext