Skip to content

[WINDOWS SELF-HOSTED] Issues with "extracting" non .zip files #563

Closed

Description

@darkwolfie37

Description:
when using a selfHosted runner on github The Windows machine will fail to install java due to powershell not liking non .zip files

image

Task version:
Specify the task version

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Repro steps:
Make a fabric minecraft mod template, add a selfhosted runner to a private or public repo on github. upload the code changing the build to run on a self-hosted box, then watch as it fails.

Video of rerun showing issue: https://file.io/sk4EnEGMViVD

Expected behavior:
Installed Java and Moves on to build the fabric mod

Actual behavior:
Fails to install java due to powershell limits.

Activity

  1. IvanZosimov commented on Dec 5, 2023

    @IvanZosimov
    Contributor

    Hi, @darkwolfie37 👋 Thanks for the issue, we will take a look at it!

  2. IvanZosimov commented on Dec 27, 2023

    @IvanZosimov
    Contributor

    Hi, @darkwolfie37 it seems that to resolve you problem you need to rename downloaded JDK archive to this pattern: nameOfJdk.zip. After that the powershell will be able to extract this archive correctly. Another solution is to install a newer version of PowerShell (so called PowerShell Core).

  3. darkwolfie37 commented on Jan 1, 2024

    @darkwolfie37
    Author

    Hi, @darkwolfie37 it seems that to resolve you problem you need to rename downloaded JDK archive to this pattern: nameOfJdk.zip. After that the powershell will be able to extract this archive correctly. Another solution is to install a newer version of PowerShell (so called PowerShell Core).

    Ok so I need to somehow edit your scripts to use powershell core or other software to make it work? Just make your script to have it download to a zip. Not my problem.

  4. darkwolfie37 commented on Jan 29, 2024

    @darkwolfie37
    Author

    As this seems to gone dark, I am posting this as a "bump".

  5. ed-erwin-tf commented on Feb 15, 2024

    @ed-erwin-tf

    Even after installing powershell 7, the action still uses the older powershell. Powershell 7 installer seems to be designed so that it does not replace older versions, but both versions can co-exist. Both are added to the PATH but they have different exe file names.

    Older Powershell.exe is here:
    C:\Windows\System32\WindowsPowerShell\v1.0

    Newer Powershell is called pwsh.exe and is installed here:
    C:\Program Files\PowerShell\7

    I'd love to get this working. Is there any way I can tell it to use pwsh.exe instead of "powershell.exe" ?

  6. darkwolfie37 commented on Feb 15, 2024

    @darkwolfie37
    Author

    Even after installing powershell 7, the action still uses the older powershell. Powershell 7 installer seems to be designed so that it does not replace older versions, but both versions can co-exist. Both are added to the PATH but they have different exe file names.

    Older Powershell.exe is here: C:\Windows\System32\WindowsPowerShell\v1.0

    Newer Powershell is called pwsh.exe and is installed here: C:\Program Files\PowerShell\7

    I'd love to get this working. Is there any way I can tell it to use pwsh.exe instead of "powershell.exe" ?

    I wish, but they have said that its a windows issue instead of their issue which makes them very incompetent to do this job. Like srsly, I brought a real issue to these people then they have the audacity to just Ghost this issue after now. Honestly kinda just not going to use their action anymore and build my minecraft mods manually.

  7. ed-erwin-tf commented on Feb 16, 2024

    @ed-erwin-tf

    Hi, @darkwolfie37 it seems that to resolve you problem you need to rename downloaded JDK archive to this pattern: nameOfJdk.zip. After that the powershell will be able to extract this archive correctly.

    The downloaded file in this case already does end with the ".zip" filename. It seems that this action is re-naming it to /_work/_tmp/hashcode before trying to uncompress it.

    If the action would include the ".zip" extension on the end of the hashcode filename, then I expect it would work correctly.

  8. darkwolfie37 commented on Feb 16, 2024

    @darkwolfie37
    Author

    Hi, @darkwolfie37 it seems that to resolve you problem you need to rename downloaded JDK archive to this pattern: nameOfJdk.zip. After that the powershell will be able to extract this archive correctly.

    The downloaded file in this case already does end with the ".zip" filename. It seems that this action is re-naming it to /_work/_tmp/hashcode before trying to uncompress it.

    If the action would include the ".zip" extension on the end of the hashcode filename, then I expect it would work correctly.

    Agreed! This is why I made this issue as it wont open till the code renames it to a .zip. Instead I was told to rename it manually when you cant because it deletes the file so fast after failing lol

  9. milan-alphaM commented on Sep 14, 2024

    @milan-alphaM

    I have the same issue and have alignment with @darkwolfie37

    Any chance of having this issue considered for resolution?

    I have tried all the above and have no success

  10. darkwolfie37 commented on Sep 15, 2024

    @darkwolfie37
    Author

    I forgot that this issue was open LOL

  11. v-priyagupta108 commented on Sep 18, 2024

    @v-priyagupta108
    Contributor

    Hello 👋, 

    Apologies for the delayed response. To assist in resolving this issue, could you please provide the following details:

    • The architecture of your self-hosted runner.
    • The configuration details of the actions/setup-java step in your workflow.

    Thank you!

  12. milan-alphaM commented on Sep 18, 2024

    @milan-alphaM
  13. ed-erwin-tf commented on Sep 18, 2024

    @ed-erwin-tf

    Priya, Thanks for looking into this.

    Windows 10 Enterprise, 64 bit

    Here is my script:

    name: Test of downloading corretto with actions/setup-java@v4
    
    on:
      workflow_dispatch:
    
    jobs:
      build:
    
        runs-on: [ self-hosted, my-machine-name ]
    
        steps:
    
        - name: Setup Java Corretto
          uses: actions/setup-java@v4
          with:
            distribution: 'corretto'
            java-version: '11'
            # tried overwrite-settings: false  and also true.
            overwrite-settings: true
            check-latest: true
            cache: maven
    
        - name: Check java version
          shell: cmd
          run: java -version
    

    I tried this first with overwrite-settings: false. In that case it seems to not download the new corretto version.

    Then I tried with overwrite-settings: true (which is the default). In this case, it does download the latest version of corretto and uses it in later steps, so that is basically working now.

    However, overwriting settings.xml is something I do NOT want. It is removing important stuff that I need in that file!

    But it seems to have a problem in the final clean-up step:

    Post job cleanup.
    "C:\Program Files\Git\usr\bin\tar.exe" --posix -cf cache.tgz --exclude cache.tgz -P -C C:/actions-runner/_work/MySecretLocation --files-from manifest.txt --force-local -z
    /bin/sh: line 1: gzip: command not found
    /usr/bin/tar: cache.tgz: Cannot write: Broken pipe
    /usr/bin/tar: Child returned status 127
    /usr/bin/tar: Error is not recoverable: exiting now
    Warning: Failed to save: "C:\Program failed with error: The process 'C:\Program Files\Git\usr\bin\tar.exe' failed with exit code 2
    Cache saved with the key: setup-java-Windows-maven-794f5fa9da.......
    

    Note that it is saying "gzip: command not found". But gzip.exe does exist in the directory "C:\Program Files\Git\usr\bin\tar.exe" which is where the "tar.exe" command also lives.

    Even though it says "cache saved", nothing with the given name is saved in the maven cache.

  14. ed-erwin-tf commented on Sep 18, 2024

    @ed-erwin-tf

    Another anoying thing that is happening is that ever time I run the action, it writes additional redundant information in to the maven toolchains.xml file.

      <toolchain>
        <type>jdk</type>
        <provides>
          <version>11</version>
          <vendor>corretto</vendor>
          <id>corretto_11</id>
        </provides>
        <configuration>
          <jdkHome>C:\actions-runner\_work\_tool\Java_Corretto_jdk\11.0.24-8.1\x64</jdkHome>
        </configuration>
      </toolchain>
      <toolchain>
        <type>jdk</type>
        <provides>
          <version>11</version>
          <vendor>corretto</vendor>
          <id>corretto_11</id>
        </provides>
        <configuration>
          <jdkHome>C:\actions-runner\_work\_tool\Java_Corretto_jdk\11.0.24-8.1\x64</jdkHome>
        </configuration>
      </toolchain>
    

    It just adds that info over and over and over! Possibly caused by failure earlier in the script? Anyway, this is more of an annoyance than any real problem.

  15. ed-erwin-tf commented on Sep 18, 2024

    @ed-erwin-tf

    After going through testing today to add to this bug, I realize I am no longer having the same issue as the original poster:

    Description:
    when using a selfHosted runner on github The Windows machine will fail to install java due to powershell not liking non .zip files
    

    That is not happening to me. The action seems to be working fine if I don't try to use caching. And If I set "overwrite-settings: false" then I don't have any problem with overwriting my settings. So, for me at least, the original problem is gone and I can use this action.

  16. darkwolfie37 commented on Sep 21, 2024

    @darkwolfie37
    Author

    Hello 👋, 
 Apologies for the delayed response. To assist in resolving this issue, could you please provide the following details:

    • The architecture of your self-hosted runner.
    • The configuration details of the actions/setup-java step in your workflow.

    Thank you!

    I will have to resetup my configs for this and I will get back to you

  17. milan-alphaM commented on Oct 3, 2024

    @milan-alphaM
  18. v-priyagupta108 commented on Oct 14, 2024

    @v-priyagupta108
    Contributor

    Hello 👋,
    We've merged the pull request with possible fix. Could you please try to use actions/setup-java@main to confirm that it works as expected.
    Thank you!

  19. fhirt commented on Oct 15, 2024

    @fhirt

    Hi, I tested your fix. It seems to work. Please Release 😊

  20. Dragmoria commented on Oct 15, 2024

    @Dragmoria

    Pretty much ran into this issue 10 minutes ago and

    • name: Set up JDK 17
      uses: actions/setup-java@main
      with:
      java-version: 17
      distribution: "zulu"

    Does indeed work, thank you

  21. v-priyagupta108 commented on Oct 23, 2024

    @v-priyagupta108
    Contributor

    Hi @darkwolfie37, have you had a chance to resetup your configs? We have merged a pull request with potential fix. Could you please try to use actions/setup-java@main and confirm if it resolves your issue?

    Thank you @fhirt and @Dragmoria for confirming the fix!

  22. darkwolfie37 commented on Oct 24, 2024

    @darkwolfie37
    Author

    Once I get home, I will go and test.

  23. darkwolfie37 commented on Oct 30, 2024

    @darkwolfie37
    Author

    Ran Nicely.

    image

    Thanks for the help. Sorry if i was an ass in the beginning when someone told me to not use default settings lol.

    Take care!

  24. v-priyagupta108 commented on Oct 30, 2024

    @v-priyagupta108
    Contributor

    @darkwolfie37 👋,
    Thank you for confirming the fix. We have released a new version of the action that includes this fix, and the major tag has been updated accordingly.
    I will be closing this issue. If you encounter any further issues, please feel free to reach out to us.

  25. ssbarnea commented on Nov 20, 2024

    @ssbarnea

    Interesting to see that I am facing an issue where actions/check fails to unzip the archive for no clear reason on self-hosted runner. The zip is downloaded but it fails to unzip it -- to be correct it reports it as unarchived but the only thing extracted is the main directory name, not the content. actions/checkout#1985

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

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions