diff --git a/.pipelines/Package-Official.yml b/.pipelines/Package-Official.yml index 57154e66..9b88ddcd 100644 --- a/.pipelines/Package-Official.yml +++ b/.pipelines/Package-Official.yml @@ -1,13 +1,6 @@ trigger: none parameters: # parameters are shown up in ADO UI in a build queue time - - name: ForceAzureBlobDelete - displayName: Delete Azure Blob - type: string - values: - - true - - false - default: false - name: 'debug' displayName: 'Enable debug output' type: boolean @@ -20,8 +13,6 @@ variables: value: ${{ parameters.debug }} - name: ENABLE_PRS_DELAYSIGN value: 1 - - name: ForceAzureBlobDelete - value: ${{ parameters.ForceAzureBlobDelete }} - name: ob_outputDirectory value: '$(Build.ArtifactStagingDirectory)/ONEBRANCH_ARTIFACT' - name: WindowsContainerImage @@ -87,12 +78,7 @@ extends: tsaOptionsFile: .config\tsaoptions.json stages: - - stage: prep - jobs: - - template: /.pipelines/templates/check-Azure-container.yml@self - - stage: mac - dependsOn: [prep] jobs: - template: /.pipelines/templates/mac-package.yml@self parameters: @@ -102,7 +88,6 @@ extends: architecture: arm64 - stage: windows - dependsOn: [prep] jobs: - template: /.pipelines/templates/windows-package.yml@self parameters: @@ -115,7 +100,6 @@ extends: architecture: arm64 - stage: linux - dependsOn: [prep] jobs: - template: /.pipelines/templates/linux-package.yml@self parameters: @@ -125,16 +109,9 @@ extends: architecture: arm64 - stage: module - dependsOn: [prep] jobs: - template: /.pipelines/templates/module-package.yml@self - stage: nupkg - dependsOn: [prep] jobs: - template: /.pipelines/templates/nupkg-package.yml@self - - - stage: upload - dependsOn: [mac, windows, linux, module, nupkg] - jobs: - - template: /.pipelines/templates/upload-to-Azure.yml@self diff --git a/.pipelines/templates/check-Azure-container.yml b/.pipelines/templates/check-Azure-container.yml deleted file mode 100644 index dc1a7ede..00000000 --- a/.pipelines/templates/check-Azure-container.yml +++ /dev/null @@ -1,101 +0,0 @@ -jobs: -- job: DeleteBlob - variables: - - group: Azure Blob variable group - - group: AzureBlobServiceConnection - - name: ob_outputDirectory - value: '$(Build.ArtifactStagingDirectory)/ONEBRANCH_ARTIFACT' - - name: repoRoot - value: $(Build.SourcesDirectory)\ProjectMercury - - name: ob_sdl_sbom_enabled - value: false - - name: ob_sdl_codeSignValidation_enabled - value: false - - name: ob_sdl_tsa_configFile - value: $(repoRoot)\.config\tsaoptions.json - - name: ob_sdl_codeql_compiled_enabled - value: false - - displayName: Delete blob if exists - pool: - type: windows - steps: - - checkout: self - clean: true - env: - ob_restore_phase: true - - - template: /.pipelines/templates/update-nuget-config.yml@self - parameters: - repoRoot: $(repoRoot) - - - download: AIShellBuildPipeline - artifact: drop_module_sign - - - pwsh: | - Write-Verbose -Verbose "Downloaded artifacts:" - Get-ChildItem "$(Pipeline.Workspace)/AIShellBuildPipeline/drop_module_sign" -Recurse - - $version = (Get-Item "$(Pipeline.Workspace)/AIShellBuildPipeline/drop_module_sign/AIShell.Abstraction.dll").VersionInfo.ProductVersion - $vstsCommandString = "vso[task.setvariable variable=PackageVersion]$version" - Write-Host ("sending " + $vstsCommandString) - Write-Host "##$vstsCommandString" - displayName: 'List Downloaded Artifacts' - # Diagnostics is not critical it passes every time it runs - continueOnError: true - - # Needed as per FAQ here: https://eng.ms/docs/products/onebranch/build/troubleshootingfaqs - - task: PowerShell@2 - displayName: 'Update Az.Storage Module' - inputs: - targetType: 'inline' - script: | - Get-PackageProvider -Name NuGet -ForceBootstrap - Install-Module -Name Az.Storage -Verbose -Force -AllowClobber - Uninstall-AzureRm -Verbose - - - task: AzurePowerShell@5 - displayName: Check if blob exists and delete if specified - inputs: - azureSubscription: az-blob-cicd-infra - scriptType: inlineScript - azurePowerShellVersion: latestVersion - inline: | - Write-Verbose -Verbose 'Create storage context for $(PSInfraStorageAccount)' - $context = New-AzStorageContext -StorageAccountName '$(PSInfraStorageAccount)' -UseConnectedAccount - $containersToDelete = @{ - '$web' = 'aish/$(PackageVersion)' - 'aish' = '$(PackageVersion)' - } - - foreach ($entry in $containersToDelete.GetEnumerator()) { - try { - $container = $entry.Key - $blobPrefix = $entry.Value - $virtualContainer = "$container/$blobPrefix" - - Write-Verbose -Verbose "Operate on virtual container $virtualContainer ..." - $blobs = Get-AzStorageBlob -Container $container -Context $context | Where-Object Name -Like "$blobPrefix/*" -ErrorAction Stop - if ($null -ne $blobs) { - if ('$(ForceAzureBlobDelete)' -eq 'true') { - Write-Verbose -Verbose "Removing container '$virtualContainer' due to 'ForceAzureBlobDelete' parameter" - foreach ($blob in $blobs) { - Remove-AzStorageBlob -Blob $blob.Name -Container $container -Context $context -Force - } - } else { - throw "Azure blob container '$virtualContainer' already exists. To overwrite, use the 'ForceAzureBlobDelete' parameter" - } - } else { - Write-Verbose -Verbose "No blob found under '$virtualContainer'" - } - } - catch { - if ($_.FullyQualifiedErrorId -eq 'RequestFailedException,Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet.GetAzureStorageBlobCommand') { - Write-Verbose -Verbose "Container '$virtualContainer' does not exist." - } else { - throw $_ - } - } - } - - - template: /.pipelines/templates/finalize.yml@self diff --git a/.pipelines/templates/release-msix-bundle.yml b/.pipelines/templates/release-msix-bundle.yml index 36af12a6..7494e587 100644 --- a/.pipelines/templates/release-msix-bundle.yml +++ b/.pipelines/templates/release-msix-bundle.yml @@ -8,7 +8,7 @@ jobs: - group: msixTools - group: 'Azure Blob variable group' - name: ob_outputDirectory - value: '$(Build.ArtifactStagingDirectory)/ONEBRANCH_ARTIFACT' + value: '$(Build.ArtifactStagingDirectory)\ONEBRANCH_ARTIFACT' steps: - download: AIShellPackagePipeline @@ -76,39 +76,16 @@ jobs: retryCountOnTaskFailure: 1 - pwsh: | - $azureRmModule = Get-InstalledModule AzureRM -ErrorAction SilentlyContinue -Verbose - if ($azureRmModule) { - Write-Host 'AzureRM module exists. Removing it' - Uninstall-AzureRm - Write-Host 'AzureRM module removed' + if (-not (Test-Path '$(ob_outputDirectory)')) { + New-Item -ItemType Directory -Path '$(ob_outputDirectory)' -Force } - Install-Module -Name Az.Storage -Force -AllowClobber -Scope CurrentUser -Verbose - displayName: Remove AzRM modules and install Az.Storage - - - task: AzurePowerShell@5 - displayName: Upload msix to blob - inputs: - azureSubscription: az-blob-cicd-infra - scriptType: inlineScript - azurePowerShellVersion: LatestVersion - pwsh: true - inline: | - $containerName = 'aish' - $storageAccount = '$(PSInfraStorageAccount)' - - $storageContext = New-AzStorageContext -StorageAccountName $storageAccount -UseConnectedAccount - - if ($env:BundleDir) { - $bundleFile = (Get-Item "$env:BundleDir\*.msixbundle").FullName - $fileName = $bundleFile | Split-Path -Leaf - - $version = [System.IO.Path]::GetFileNameWithoutExtension($fileName).Replace('AIShell-', '') - $blobName = "$version/$fileName" - - Write-Verbose -Verbose "Uploading $bundleFile to $containerName/$blobName" - $null = Set-AzStorageBlobContent -File $bundleFile -Container $containerName -Blob $blobName -Context $storageContext - } - else{ - throw "BundleDir not found" - } + Write-Verbose -Verbose "Copying msixbundle to output directory" + if ($env:BundleDir) { + $bundleFile = (Get-Item "$env:BundleDir\*.msixbundle").FullName + Copy-Item -Path $bundleFile -Destination '$(ob_outputDirectory)' -Force -Verbose + } + else{ + throw "BundleDir not found" + } + displayName: Copy msixbundle to output directory diff --git a/.pipelines/templates/upload-to-Azure.yml b/.pipelines/templates/upload-to-Azure.yml deleted file mode 100644 index b07f8758..00000000 --- a/.pipelines/templates/upload-to-Azure.yml +++ /dev/null @@ -1,173 +0,0 @@ -jobs: -- job: upload_packages - displayName: Upload packages - condition: succeeded() - pool: - type: windows - variables: - - group: Azure Blob variable group - - name: runCodesignValidationInjection - value: false - - name: NugetSecurityAnalysisWarningLevel - value: none - - name: ob_outputDirectory - value: '$(Build.ArtifactStagingDirectory)/ONEBRANCH_ARTIFACT' - - name: repoRoot - value: $(Build.SourcesDirectory)\ProjectMercury - - name: ob_sdl_codeSignValidation_enabled - value: false - - name: ob_sdl_binskim_enabled - value: false - - name: ob_sdl_tsa_configFile - value: $(repoRoot)\.config\tsaoptions.json - - name: ob_sdl_codeql_compiled_enabled - value: false - - steps: - - checkout: self - clean: true - env: - ob_restore_phase: true - - - pwsh: | - Get-ChildItem Env: - displayName: 'Capture Environment Variables' - - - pwsh: | - New-Item -Path '$(Build.ArtifactStagingDirectory)/downloads' -ItemType Directory -Force - displayName: Create downloads directory - - - task: DownloadPipelineArtifact@2 - inputs: - buildType: 'current' - artifact: macos-pkgs - targetPath: '$(Build.ArtifactStagingDirectory)/downloads' - displayName: Download macOS x64 packages - - - task: DownloadPipelineArtifact@2 - inputs: - buildType: 'current' - artifact: drop_linux_package_x64 - targetPath: '$(Build.ArtifactStagingDirectory)/downloads' - displayName: Download Linux x64 packages - - - task: DownloadPipelineArtifact@2 - inputs: - buildType: 'current' - artifact: drop_linux_package_arm64 - targetPath: '$(Build.ArtifactStagingDirectory)/downloads' - displayName: Download Linux arm64 packages - - - task: DownloadPipelineArtifact@2 - inputs: - buildType: 'current' - artifact: drop_windows_package_x86 - targetPath: '$(Build.ArtifactStagingDirectory)/downloads' - displayName: Download Windows x86 packages - - - task: DownloadPipelineArtifact@2 - inputs: - buildType: 'current' - artifact: drop_windows_package_x64 - targetPath: '$(Build.ArtifactStagingDirectory)/downloads' - displayName: Download Windows x64 packages - - - task: DownloadPipelineArtifact@2 - inputs: - buildType: 'current' - artifact: drop_windows_package_arm64 - targetPath: '$(Build.ArtifactStagingDirectory)/downloads' - displayName: Download Windows arm64 packages - - - task: DownloadPipelineArtifact@2 - inputs: - buildType: 'current' - artifact: drop_module_package - targetPath: '$(Build.ArtifactStagingDirectory)/downloads' - displayName: Download module package - - - task: DownloadPipelineArtifact@2 - inputs: - buildType: 'current' - artifact: drop_nupkg_package - targetPath: '$(Build.ArtifactStagingDirectory)/downloads' - displayName: Download SDK NuGet package - - - pwsh: | - Get-ChildItem '$(Build.ArtifactStagingDirectory)/downloads' | ForEach-Object FullName - displayName: 'Capture downloads' - - - pwsh: | - # Create output directory for packages which have been uploaded to blob storage - New-Item -Path $(Build.ArtifactStagingDirectory)/uploaded -ItemType Directory -Force - displayName: Create output directory for packages - - - pwsh: | - $azureRmModule = Get-InstalledModule AzureRM -ErrorAction SilentlyContinue -Verbose - if ($azureRmModule) { - Write-Host 'AzureRM module exists. Removing it' - Uninstall-AzureRm - Write-Host 'AzureRM module removed' - } - - Install-Module -Name Az.Storage -Force -AllowClobber -Scope CurrentUser -Verbose - displayName: Remove AzRM modules - - - task: AzurePowerShell@5 - displayName: Upload packages to blob - inputs: - azureSubscription: az-blob-cicd-infra - scriptType: inlineScript - azurePowerShellVersion: LatestVersion - pwsh: true - inline: | - $downloadsDirectory = '$(Build.ArtifactStagingDirectory)/downloads' - $uploadedDirectory = '$(Build.ArtifactStagingDirectory)/uploaded' - - $nupkgFile = Get-ChildItem $downloadsDirectory -Filter AIShell.Abstraction.*.nupkg - $nupkgName = [System.IO.Path]::GetFileNameWithoutExtension($nupkgFile.Name) - $version = $nupkgName.Replace('AIShell.Abstraction.', '') - - $storageAccountName = '$(PSInfraStorageAccount)' - $context = New-AzStorageContext -StorageAccountName $storageAccountName -UseConnectedAccount - - # Create the public blob container if it doesn't exist - $publicContainer = '$web' - $blobPrefix = "aish/${version}/" - $containerExists = Get-AzStorageContainer -Name $publicContainer -Context $context -ErrorAction SilentlyContinue - if (-not $containerExists) { - $null = New-AzStorageContainer -Name $publicContainer -Context $context - Write-Host "Blob container $publicContainer created successfully." - } - - Write-Verbose -Verbose "Uploading packages to blob storage account: $storageAccountName container: $publicContainer" - Get-ChildItem -Path $downloadsDirectory -Exclude *.nupkg, *.msix | ForEach-Object { - $blobName = $blobPrefix + $_.Name - Write-Verbose -Verbose "Uploading $($_.FullName) to $publicContainer/$blobName" - $null = Set-AzStorageBlobContent -File $_.FullName -Container $publicContainer -Blob $blobName -Context $context - - # Move to folder so we won't upload again - Move-Item -Path $_.FullName -Destination $uploadedDirectory -Force -Verbose - } - - # Create the private blob container if it doesn't exist - $privateContainer = 'aish' - $blobPrefix = "${version}/" - $containerExists = Get-AzStorageContainer -Name $privateContainer -Context $context -ErrorAction SilentlyContinue - if (-not $containerExists) { - $null = New-AzStorageContainer -Name $privateContainer -Context $context - Write-Host "Blob container $privateContainer created successfully." - } - - Write-Verbose -Verbose "Uploading packages to blob storage account: $storageAccountName container: $privateContainer" - Get-ChildItem -Path $downloadsDirectory | ForEach-Object { - $blobName = $blobPrefix + $_.Name - Write-Verbose -Verbose "Uploading $($_.FullName) to $privateContainer/$blobName" - $null = Set-AzStorageBlobContent -File $_.FullName -Container $privateContainer -Blob $blobName -Context $context - - # Move to folder so we won't upload again - Move-Item -Path $_.FullName -Destination $uploadedDirectory -Force -Verbose - } - - Write-Verbose -Verbose "Capture all uploaded files:" - Get-ChildItem $uploadedDirectory | ForEach-Object FullName diff --git a/shell/AIShell.Integration/AIShell.psd1 b/shell/AIShell.Integration/AIShell.psd1 index 0f148b3f..53f6b11c 100644 --- a/shell/AIShell.Integration/AIShell.psd1 +++ b/shell/AIShell.Integration/AIShell.psd1 @@ -7,7 +7,7 @@ CompanyName = 'Microsoft Corporation' Copyright = '(c) Microsoft Corporation. All rights reserved.' Description = 'Integration with the AIShell to provide intelligent shell experience' - PowerShellVersion = '7.4.6' + PowerShellVersion = '7.4.5' FunctionsToExport = @() CmdletsToExport = @('Start-AIShell','Invoke-AIShell','Resolve-Error') VariablesToExport = '*'