actions / runner-images

GitHub Actions runner images
MIT License
10.12k stars 3.04k forks source link

windows-latest: 7-Zip not found #9361

Closed FlorinChess closed 8 months ago

FlorinChess commented 8 months ago

Description

I have a job that uses 7-Zip in one of the steps which came preinstalled. Trying to run the job a few months later, the window-latest runner no longer has 7-Zip preinstalled which causes the job to fail.

Platforms affected

Runner images affected

Image version and build link

Image: windows-2022 Version: 20240211.1.0

https://github.com/FlorinChess/Music/actions/runs/7944706780/job/21690977695

Is it regression?

Inconclusive: run logs no longer available

Expected behavior

When the workflow was first written, windows-latest runners had 7-Zip installed, no extra setup required.

Actual behavior

The windows-latest images no longer have 7-Zip preinstalled.

Repro steps

 # Install virutal audio device
    - name: Install Scream
      shell: powershell
      run: |
          Start-Service audio*
          Invoke-WebRequest https://github.com/duncanthrax/scream/releases/download/3.6/Scream3.6.zip -OutFile C:\Scream3.6.zip
          Extract-7Zip -Path C:\Scream3.6.zip -DestinationPath C:\Scream
          $cert = (Get-AuthenticodeSignature C:\Scream\Install\driver\Scream.sys).SignerCertificate
          $store = [System.Security.Cryptography.X509Certificates.X509Store]::new("TrustedPublisher", "LocalMachine")
          $store.Open("ReadWrite")
          $store.Add($cert)
          $store.Close()
          cd C:\Scream\Install\driver
          C:\Scream\Install\helpers\devcon install Scream.inf *Scream

The build fails on Extract-7Zip -Path C:\Scream3.6.zip -DestinationPath C:\Scream with the powershell error:

Extract-7Zip : The term 'Extract-7Zip' is not recognized as the name of a cmdlet, function, script file, or operable 
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At D:\a\_temp\54fe7281-0807-4b2b-b7a9-1c88f50e3333.ps1:4 char:1
+ Extract-7Zip -Path C:\Scream3.6.zip -DestinationPath C:\Scream
+ ~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Extract-7Zip:String) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : CommandNotFoundException

For more information, check out the public build: https://github.com/FlorinChess/Music/actions/runs/7944706780/job/21690977695

sergei-pyshnoi commented 8 months ago

Hello @FlorinChess . Extract-7Zip cmdlet was part of functions that using for image generation only and we do not recommend use it in workflows. It was replaced with Expand-7ZipArchive function during runner-images major repo refactoring.