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

Publish module to ACR #236

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Publish module to ACR #236

wants to merge 2 commits into from

Conversation

vthiebaut10
Copy link
Collaborator

Publish module to ACR as an intermediate step to publish module to MAR.

PR Summary

PR Context

Add step to run Ev2 shell extension that publishes module to our ACR.

Comment on lines +222 to +234
- pwsh: |
$modulePath = Join-Path $(drop) -ChildPath 'Microsoft.PowerShell.SecretManagement.$(version).nupkg'
$fileExists = Test-Path $modulePath
Write-Verbose -Verbose "Module file $modulePath Exists: $fileExists"

$srcDir = Join-Path '$(Build.SourcesDirectory)/EV2Specs/ServiceGroupRoot' -ChildPath 'SrcFiles'
New-Item $srcDir -ItemType Directory

$dest = Join-Path $srcDir -ChildPath 'Microsoft.PowerShell.SecretManagement.$(version).nupkg'
Copy-Item -Path $modulePath -Destination $dest

Get-ChildItem '$(Build.SourcesDirectory)/EV2Specs/ServiceGroupRoot/SrcFiles/'
displayName: Move artifact to Ev2 folder
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- pwsh: |
$modulePath = Join-Path $(drop) -ChildPath 'Microsoft.PowerShell.SecretManagement.$(version).nupkg'
$fileExists = Test-Path $modulePath
Write-Verbose -Verbose "Module file $modulePath Exists: $fileExists"
$srcDir = Join-Path '$(Build.SourcesDirectory)/EV2Specs/ServiceGroupRoot' -ChildPath 'SrcFiles'
New-Item $srcDir -ItemType Directory
$dest = Join-Path $srcDir -ChildPath 'Microsoft.PowerShell.SecretManagement.$(version).nupkg'
Copy-Item -Path $modulePath -Destination $dest
Get-ChildItem '$(Build.SourcesDirectory)/EV2Specs/ServiceGroupRoot/SrcFiles/'
displayName: Move artifact to Ev2 folder
- task: CopyFiles@2
SourceFolder: $(drop)
Contents: Microsoft.PowerShell.SecretManagement.$(version).nupkg
TargetFolder: $(Build.SourcesDirectory)/EV2Specs/ServiceGroupRoot/SrcFiles/

Comment on lines +235 to +241
- pwsh: |
$srcPath = Join-Path '$(Build.SourcesDirectory)/EV2Specs/ServiceGroupRoot' -ChildPath 'Shell'
$pathToRunTarFile = Join-Path '$(Build.SourcesDirectory)/EV2Specs/ServiceGroupRoot/Shell' -ChildPath "Run.tar"
tar -cvf $pathToRunTarFile -C $srcPath ./Run
$tarExists = Test-Path $pathToRunTarFile
Write-Verbose -Verbose "Tar file $pathToRunTarFile exists: $tarExists"
displayName: Compress Run script into tar file as needed for EV2 Shell extension
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- pwsh: |
$srcPath = Join-Path '$(Build.SourcesDirectory)/EV2Specs/ServiceGroupRoot' -ChildPath 'Shell'
$pathToRunTarFile = Join-Path '$(Build.SourcesDirectory)/EV2Specs/ServiceGroupRoot/Shell' -ChildPath "Run.tar"
tar -cvf $pathToRunTarFile -C $srcPath ./Run
$tarExists = Test-Path $pathToRunTarFile
Write-Verbose -Verbose "Tar file $pathToRunTarFile exists: $tarExists"
displayName: Compress Run script into tar file as needed for EV2 Shell extension
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: $(Build.SourcesDirectory)/EV2Specs/ServiceGroupRoot/Shell/Run
includeRootFolder: false
archiveType: tar
tarCompression: None
archiveFile: $(Build.SourcesDirectory)/EV2Specs/ServiceGroupRoot/Shell/Run.tar
displayName: Compress Run script into tar file as needed for EV2 Shell extension

[xml]$xml = Get-Content Directory.Build.props
$version = $xml.Project.PropertyGroup.ModuleVersion

for ($i=0; $i -lt $envVarArrayLen; $i++)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per Viv's idea: we remove the predefined values from the environmentValues array and simply build its contents here, instead of having to iterate over it with a bunch of checks and sets.

Comment on lines +329 to +338
- task: DownloadPipelineArtifact@2
inputs:
targetPath: '$(Pipeline.Workspace)'
artifact: drop_PrepForEV2_CopyEv2FilesToArtifact
displayName: 'Download drop_PrepForEV2_CopyEv2FilesToArtifact artifact that has all files needed'
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
targetPath: '$(Pipeline.Workspace)'
displayName: 'Download to get EV2 Files'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- task: DownloadPipelineArtifact@2
inputs:
targetPath: '$(Pipeline.Workspace)'
artifact: drop_PrepForEV2_CopyEv2FilesToArtifact
displayName: 'Download drop_PrepForEV2_CopyEv2FilesToArtifact artifact that has all files needed'
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
targetPath: '$(Pipeline.Workspace)'
displayName: 'Download to get EV2 Files'
- download: current
displayName: Download artifacts

$secretManagementFileName = "Microsoft.PowerShell.SecretManagement.$($env:SECRET_MANAGEMENT_VERSION).nupkg"

Write-Verbose -Verbose "Download files"
Invoke-WebRequest -Uri $env:SECRET_MANAGEMENT_MODULE -OutFile $secretManagementFileName
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're both just curious what the original value of SECRET_MANAGEMENT_MODULE is, and why we have to "download" it in the container. Like, is it a local URI?

@@ -0,0 +1 @@
1.0.1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will we need to update this? When? Is it tied to the package version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants