-
Notifications
You must be signed in to change notification settings - Fork 105
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
Azure DevOps Task 'AWS Tools for Windows PowerShell Script' - Ignore PS Module Check #520
Comments
The check is here: aws-toolkit-azure-devops/src/tasks/AWSPowerShellModuleScript/RunAWSPowerShellModuleScript.ps1 Line 39 in 2e99eec
If that takes 1 minute, that implies that the Possible improvements:
|
Hello @justinmk3, Thanks for your reply. However in this case, we are using the AWS Task 'AWS Tools for Windows PowerShell Script' in an Azure DevOps pipeline. This Azure DevOps task from AWS "uses cmdlets from the AWS Tools for Windows PowerShell module (AWSPowerShell) module. The module will be automatically installed if needed." Task reference: https://docs.aws.amazon.com/vsts/latest/userguide/awspowershell-module-script.html So, the import of AWSPowerShell modules is handled by this Task which simply references our PowerShell scripts. Thank you |
Are you able to run |
Hello @justinmk3, Kindly note we tried above commands on our VM, and we found the below results: Thank you |
Great info, thanks!
So
ProposalBased on the above, perhaps we could improve performance of |
Hello @justinmk3, You're right, migrating from the legacy Thank you :) However, I think if we could add a checkbox to ignore/skip the PowerShell Module verification (i.e. make the Appreciate your thoughts on this. Thank you |
If there's a faster way to check that the module is already imported, we could use that and skip Adding a "skip" option is (1) a very special-case solution and (2) doesn't save much in terms of implementation cost, so it's unlikely we would take that approach. Instead the code should skip unnecessary things by default. |
@justinmk3 Well noted, thank you👍 Please feel free to proceed with your initial proposal, i.e. to migrate towards the use of Thank you |
Same issue here. |
Same here, 1 min mininum waiting time, AWSPowershell: 4.1.562 is pre-installed on all agents. |
Same here - 5 minutes to load on Azure hosted agent. Seems the problem isn't the Azure Devops task - it is AWS PowerShell. The first message in the task log file lists "Checking install status for AWS Tools for Windows PowerShell module" as the 5 minute offender . According to Microsoft, both the AWS CLI and AWS PowerShell are already installed on their hosted agents. Using a pipeline PowerShell task ( not an AWS PowerShell ) to run the get-awspowershellversion returns in 5 minutes. Doing some more testing using the PowerShell, other commands were tested
Still 5 minutes on Initialize-AWSDefaultConfiguration Similar AWS CLI commands run from the same PowerShell task don't exhibit the same problem. 40 seconds for the below
10 seconds for the below
This time delay gets out of control when you have 6 or 7 stages in a release pipeline, each using the AWS PowerShell task - this tacks on 30 minutes to the pipeline.... This delay can also be seen on AWS EC2 instances where the first call to Initialize-AWSDefaults takes 5 minutes.... |
Some additional testing indicates the speed problem may be related to AWSPowerShell running in Windows vs Linux. Removing AWS Tools for Windows PowerShell Script from the equation and soley using PowerShell and the AWSPowerShell module... Running the exact same script with an Ubuntu host executes the initialization in under 40 seconds, in Windows 4+ minutes. This was tested in an Azure Devops classic release by creating a Task with two hosted Agent jobs, one using Ubuntu-Latest the other Windows-Latest Under each Agent, add a PowerShell task and run the inline code below, uses your own AWS credentials Write-Host "Install"
Install-Module -Name AWSPowerShell -Force
Write-Host "Import"
Import-Module -Name AWSPowerShell
Write-Host "GetInstalled"
Get-InstalledModule -Name AWSPowerShell
Write-Host "Initialize"
# Initialize-AWSDefaultConfiguration -Region 'us-east-1' -AccessKey XXX -SecretKey XXX -SessionToken XXX
$Env:AWS_ACCESS_KEY_ID="ABC"
$Env:AWS_SECRET_ACCESS_KEY="DEF"
$Env:AWS_SESSION_TOKEN="GHI"
Initialize-AWSDefaultConfiguration -Region 'us-east-1'
Write-Host "GetEC2"
Get-EC2Instance
Write-Host "Done" Since it is already installed on Azure Windows Hosts, for the Windows task, you can comment out "Install-Module -Name AWSPowerShell -Force" You can slice and dice this a few ways, such as commenting out the Import-Module, which will result in Initalize-* taking 4 minutes vs 1 seconds. Pipeline logs are attached. Install AWS Powershell LINUX.log |
Current situation: Using Azure DevOps on a private Azure DevOps server to connect to AWS resources.
In Azure DevOps pipelines, the AWS Task 'AWS Tools for Windows PowerShell Script' is used to run PowerShell scripts against AWS resources. The scripts are executed on a Self-Hosted Agent (Private VM).
As per documentation 'The module will be automatically installed if needed', however every time this task is executed, it checks if the module is present on the Self-Hosted Agent.
Problematic Scenario: If we have have more than 10 similar tasks on the same pipeline, and the check is made every time, which consumes nearly 1 minute per task only for the checks. In total, this increases the pipeline execution time by 10 minutes.
Question: Is it possible to ignore this check?
Expected Solution: Add an option to ignore the Powershell Module checks in the AWS task.
Thank you
The text was updated successfully, but these errors were encountered: