Skip to content

Fails to write lockfile for multiple modules with different versions #96

Description

@picccard

error

My pipeline errors out:

...
2024-10-13T21:43:40.6358609Z �[36mVERBOSE: Az.Accounts(3.0.2): Added to install plan�[0m
...
2024-10-13T21:43:41.1731039Z �[36mVERBOSE: Az.Accounts(3.0.4): Added to install plan�[0m
...
2024-10-13T21:43:45.2143307Z �[36mVERBOSE: ✅ All required modules installed! Exiting.�[0m
2024-10-13T21:43:45.2183731Z 
2024-10-13T21:43:45.2208006Z �[36mVERBOSE: Writing lockfile to /home/runner/work/miscellaneous/miscellaneous/requires.lock.json�[0m
2024-10-13T21:43:45.2770822Z �[31;1mInstall-ModuleFast : �[31;1mException calling "Add" with "2" argument(s): "An item with the same key has already been added. Key: Az.Accounts"�[0m
2024-10-13T21:43:45.2773238Z �[31;1m�[31;1mAt /home/runner/work/_actions/JustinGrote/ModuleFast-action/v0.0.1/action.ps1:37 char:1�[0m
2024-10-13T21:43:45.2774764Z �[31;1m�[31;1m+ Install-ModuleFast @imfParams @imfCommonParams @args�[0m
2024-10-13T21:43:45.2775819Z �[31;1m�[31;1m+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~�[0m
2024-10-13T21:43:45.2777525Z �[31;1m�[31;1m+ CategoryInfo          : NotSpecified: (:) [Install-ModuleFast], MethodInvocationException�[0m
2024-10-13T21:43:45.2778522Z �[31;1m�[31;1m+ FullyQualifiedErrorId : ArgumentException,Install-ModuleFast�[0m
2024-10-13T21:43:45.4000743Z ##[error]Process completed with exit code 1.

possible cause

It seems the lockfile-hashtable cant accept the same module-name as the key multiple times:

ModuleFast/ModuleFast.psm1

Lines 443 to 450 in 8457844

$installPlan
| ForEach-Object {
$lockFile.Add($PSItem.Name, $PSItem.ModuleVersion)
}
$lockFile
| ConvertTo-Json -Depth 2
| Out-File -FilePath $CILockFilePath -Encoding UTF8

pipeline / error context

- name: ⚡ ModuleFast with Specification
  uses: JustinGrote/ModuleFast-action@v0.0.1
  with:
    path: './modules.requires.psd1'

The content of specfile modules.requires.psd1:

@{
  'Microsoft365DSC'='=1.24.1002.1'
  'Az.Accounts'='=3.0.2'
  'Az.Resources'='=7.2.0'
  'Az.ResourceGraph'='=1.0.0'
  'Az.SecurityInsights'='=3.1.2'
  'DSCParser'='=2.0.0.10'
  'ExchangeOnlineManagement'='=3.4.0'
  'Microsoft.Graph.Applications'='=2.23.0'
  'Microsoft.Graph.Beta.Applications'='=2.23.0'
  'Microsoft.Graph.Authentication'='=2.23.0'
  'Microsoft.Graph.Beta.DeviceManagement'='=2.23.0'
  'Microsoft.Graph.Beta.Devices.CorporateManagement'='=2.23.0'
  'Microsoft.Graph.Beta.DeviceManagement.Administration'='=2.23.0'
  'Microsoft.Graph.Beta.DeviceManagement.Enrollment'='=2.23.0'
  'Microsoft.Graph.Beta.Identity.DirectoryManagement'='=2.23.0'
  'Microsoft.Graph.Beta.Identity.Governance'='=2.23.0'
  'Microsoft.Graph.Beta.Identity.SignIns'='=2.23.0'
  'Microsoft.Graph.Beta.Reports'='=2.23.0'
  'Microsoft.Graph.Beta.Search'='=2.23.0'
  'Microsoft.Graph.Beta.Teams'='=2.23.0'
  'Microsoft.Graph.DeviceManagement.Administration'='=2.23.0'
  'Microsoft.Graph.Beta.DirectoryObjects'='=2.23.0'
  'Microsoft.Graph.Groups='='=2.23.0'
  'Microsoft.Graph.Beta.Groups'='=2.23.0'
  'Microsoft.Graph.Planner'='=2.23.0'
  'Microsoft.Graph.Sites'='=2.23.0'
  'Microsoft.Graph.Users'='=2.23.0'
  'Microsoft.Graph.Users.Actions'='=2.23.0'
  'Microsoft.PowerApps.Administration.PowerShell'='=2.0.191'
  'MicrosoftTeams'='=6.5.0'
  'MSCloudLoginAssistant'='=1.1.25'
  'PnP.PowerShell'='=1.12.0'
  'ReverseDSC'='=2.0.0.20'
}            

*the list of powershell modules is the modules that will be installed by Microsoft365DSC-cmdlet "Update-M365DSCDependencies"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions