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

Handle assembly already loaded errors in deploy stress test script #2027

Merged
merged 2 commits into from
Sep 27, 2021

Conversation

benbp
Copy link
Member

@benbp benbp commented Sep 22, 2021

This issue has been showing up recently: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=1103685&view=logs&j=38a05975-7697-5434-099a-d7b3d4012883&t=b1e71580-9408-50be-13a0-b0783b8cb008&l=57

Installing module az with min version 6.4.0 from https://www.powershellgallery.com/api/v2
Using module Az with version 6.4.0.
Import-Module : Assembly with same name is already loaded
At /home/vsts/.local/share/powershell/Modules/Az/6.4.0/Az.psm1:113 char:1
+ Import-Module Az.Aks -RequiredVersion 2.4.0 -Global
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [Import-Module], FileLoadException
+ FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand

@benbp benbp requested a review from a team as a code owner September 22, 2021 16:50
@benbp benbp added the Central-EngSys This issue is owned by the Engineering System team. label Sep 22, 2021
@benbp benbp self-assigned this Sep 22, 2021
@benbp
Copy link
Member Author

benbp commented Sep 22, 2021

/azp run Stress Test Release

@azure-pipelines
Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@@ -21,8 +21,8 @@ $ErrorActionPreference = 'Stop'
$FailedCommands = New-Object Collections.Generic.List[hashtable]

. (Join-Path $PSScriptRoot "../Helpers" PSModule-Helpers.ps1)
Install-ModuleIfNotInstalled "powershell-yaml" "0.4.1" | Import-Module
Install-ModuleIfNotInstalled "az" "6.4.0" | Import-Module
Install-ModuleIfNotInstalled "powershell-yaml" "0.4.1" | Import-Module -ErrorAction Continue
Copy link
Member

Choose a reason for hiding this comment

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

If this is a common error we should consider adding a helper function for importing.

@weshaggard
Copy link
Member

Is this a real problem? We should only be importing it if it isn't already loaded.

@benbp
Copy link
Member Author

benbp commented Sep 22, 2021

@weshaggard I'm not quite sure what's going on here, or why it seems to be only affecting this pipeline and not ALL pipelines that use this. I thought of this as a short term workaround but I really would like to understand the root issue here.

@weshaggard
Copy link
Member

I'm not sure why it isn't correctly detecting the loaded module but it looks like you aren't using this in a normal powershell step but instead as part of some Azure CLI step is there a reason for that?

@benbp
Copy link
Member Author

benbp commented Sep 22, 2021

I'm not sure why it isn't correctly detecting the loaded module but it looks like you aren't using this in a normal powershell step but instead as part of some Azure CLI step is there a reason for that?

Now I'm not so sure why I even added this as a dependency at all. We don't use the Az cmdlets in this script...

@benbp
Copy link
Member Author

benbp commented Sep 22, 2021

@weshaggard updated the PR to check for azure cli not Az and added some more helpful prompts that don't require going to the README when tools aren't installed (automatically installing them is not easy given cross-platform usage).

I have been using the Azure CLI step in order to pass through the azure service connection to the azure cli usage in the script.

@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@benbp
Copy link
Member Author

benbp commented Sep 23, 2021

/azp run Stress Test Release

@azure-pipelines
Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@benbp benbp force-pushed the benbp/assembly-loaded-stress branch from 2bdfa96 to c3678e0 Compare September 23, 2021 16:27
@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@benbp benbp force-pushed the benbp/assembly-loaded-stress branch from c3678e0 to 09e8868 Compare September 23, 2021 16:38
@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@ghost
Copy link

ghost commented Sep 27, 2021

Hello @azure-sdk!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@benbp
Copy link
Member Author

benbp commented Sep 27, 2021

/check-enforcer override

@benbp benbp merged commit 61ed250 into Azure:main Sep 27, 2021
@benbp benbp deleted the benbp/assembly-loaded-stress branch September 27, 2021 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Central-EngSys This issue is owned by the Engineering System team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants