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

ubuntu-20.04-arm runner doesn't seem to have the GitHub CLI installed #10192

Closed
2 of 14 tasks
jamilbk opened this issue Jul 9, 2024 · 16 comments
Closed
2 of 14 tasks

ubuntu-20.04-arm runner doesn't seem to have the GitHub CLI installed #10192

jamilbk opened this issue Jul 9, 2024 · 16 comments

Comments

@jamilbk
Copy link

jamilbk commented Jul 9, 2024

Description

gh: command not found

https://github.com/firezone/firezone/actions/runs/9847918080/job/27190842443#step:13:36

We've been running this CI pipeline successfully for months on the equivalent x86_64 runner.

Seems like the package is missing?

Platforms affected

  • Azure DevOps
  • GitHub Actions - Standard Runners
  • GitHub Actions - Larger Runners

Runner images affected

  • Ubuntu 20.04
  • Ubuntu 22.04
  • Ubuntu 24.04
  • macOS 11
  • macOS 12
  • macOS 13
  • macOS 13 Arm64
  • macOS 14
  • macOS 14 Arm64
  • Windows Server 2019
  • Windows Server 2022

Image version and build link

https://github.com/firezone/firezone/actions/runs/9847918080/job/27190842443#step:13:36

20.04.202407040

Is it regression?

Not sure

Expected behavior

gh command to be available

Actual behavior

gh is not in $PATH.

Repro steps

  1. Start a job on a GH-hosted Ubuntu 20.04 ARM64 runner.
  2. Try to run the gh command.
@kishorekumar-anchala
Copy link
Contributor

Hi @jamilbk ,

Thank you for bringing this issue to us. We are looking into this issue and will update you on this issue after investigating.

@jamilbk
Copy link
Author

jamilbk commented Jul 9, 2024

hi @kishorekumar-anchala -- that does not resolve the bug. According to your documentation here, the GitHub CLI should be pre-installed in the runner image.

https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2004-Readme.md#cli-tools

@Prabhatkumar59
Copy link

Hi @jamilbk,

To resolve the gh: command not found error in your CI pipeline, please try using below steps:-

  • Install gh CLI: Add to your GitHub Actions workflow:-

steps:
name: Install GitHub CLI
run: |
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0
sudo apt-add-repository https://github.com/cli/cli/packages
sudo apt update
sudo apt install gh

*Using GitHub Actions setup-gh Action:-

steps:
name: Set up GitHub CLI
uses: actions/setup-gh@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
These steps ensure gh is installed and available in your CI environment.

Requesting you to try this resolution and provide the update on this, thanks:)

@jamilbk
Copy link
Author

jamilbk commented Jul 9, 2024

Hi @Prabhatkumar59 -- I understand how to install the GitHub CLI. That's not the issue. The issue is that the arm64 runner image does not contain the same software the x86_64 runner has, and your documentation states it does.

Are we expected to install the GitHub CLI on all runner images? Is it expected that the arm64 runners do not have the GitHub CLI pre-installed like the documentation states?

Either the docs need to be updated or the runner image needs to be fixed.

@Prabhatkumar59
Copy link

@jamilbk-- Thanks for your reply, will look into this and will update you after investigating.

@ReactorScram
Copy link

Similarly, the Windows 11 ARM image doesn't have Bash installed https://github.com/firezone/firezone/actions/runs/9863219247/job/27235517455#step:3:28

Should I open another issue for that? I can't tell if these images are provided by GitHub or by us

@Prabhatkumar59
Copy link

Hi @jamilbk-- You can try by adding a conditional installation step in your CI workflow for the GitHub CLI:-

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

  - name: Install GitHub CLI if not present
    run: |
      if ! command -v gh &> /dev/null; then
        sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0
        sudo apt-add-repository https://github.com/cli/cli/packages
        sudo apt update
        sudo apt install gh
      fi

  - name: Verify GitHub CLI installation
    run: gh --version

  - name: Run Upload Release Assets Script
    run: ../scripts/build/tauri-upload-ubuntu.sh

Basically, this approach states that your CI pipeline behaves consistently across different runner images (x86_64 and arm64).

While ideally, the runner images should have consistent software pre-installed but in mean time, I will investigate more on this and update you, thanks:)

@Prabhatkumar59
Copy link

Hi @ReactorScram-- I will investigate on "the Windows 11 ARM image doesn't have Bash installed" and then will update you, thanks.

@jamilbk
Copy link
Author

jamilbk commented Jul 9, 2024

While ideally, the runner images should have consistent software pre-installed but in mean time, I will investigate more on this and update you, thanks:)

Thanks, we've already implemented this work-around but we would prefer waiting for an official response from GitHub here.

@Prabhatkumar59
Copy link

Hi @ReactorScram-- The issue you're experiencing with the Windows 11 ARM image not having Bash installed which is similar to this issue with the GitHub CLI on the arm64 runner.

For this, you can modify your workflow to handle the absence of Bash on Windows ARM images. You can install Bash or use PowerShell scripts as an alternative.

You can try by using below steps with example:-

Install GitHub CLI (if needed):-
Ensure the GitHub CLI is installed

Use PowerShell Instead of Bash:-
Modify your scripts to use PowerShell commands. If Bash is essential, you can install Git for Windows, which includes Git Bash.

Example Workflow
Here’s an example of how you might adapt your workflow:--

jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

  - name: Install GitHub CLI (if needed)
    run: |
      if (-not (Get-Command gh -ErrorAction SilentlyContinue)) {
        Invoke-WebRequest -Uri https://github.com/cli/cli/releases/latest/download/gh_2.13.0_windows_amd64.msi -OutFile gh.msi
        Start-Process msiexec.exe -ArgumentList '/i gh.msi /quiet' -Wait
        Remove-Item gh.msi -Force
      }
    shell: pwsh

  - name: Install Git for Windows (if Bash is needed)
    run: |
      Invoke-WebRequest -Uri https://github.com/git-for-windows/git/releases/latest/download/Git-2.36.0-64-bit.exe -OutFile GitInstaller.exe
      Start-Process -FilePath ./GitInstaller.exe -ArgumentList '/VERYSILENT' -Wait
      Remove-Item GitInstaller.exe -Force
    shell: pwsh

  - name: Set up environment variables (PowerShell alternative to Bash)
    run: |
      echo "SCCACHE_GCS_BUCKET=firezone-staging-sccache" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
      echo "SCCACHE_GCS_RW_MODE=READ_WRITE" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
    shell: pwsh

  - name: Run Upload Release Assets Script (adapted to PowerShell)
    run: .\scripts\build\tauri-upload-ubuntu.ps1
    shell: pwsh

You can modify your workflows to install the necessary tools (gh CLI, Bash) as needed. also can use PowerShell scripts where possible.

so, by following these above steps, you can maintain functionality in your CI pipeline while addressing the underlying issues with the runner images.

@ReactorScram
Copy link

@Prabhatkumar59 Will the amd64 MSI and exe work on ARM?
Did you test this locally?

@Prabhatkumar59
Copy link

@ReactorScram-- The amd64 MSI and EXE installers are intended for x86_64 architecture and will not work directly on ARM architecture. For ARM-based Windows systems, you need to ensure that you use ARM-compatible binaries or installers.
I didn't test it locally but I have some insights on this as per my experience.
I will check more on this and will update you, thanks:)

@Prabhatkumar59
Copy link

Hi @ReactorScram- Did you get the resolution for above Windows 11 ARM image?

@Prabhatkumar59
Copy link

Prabhatkumar59 commented Aug 2, 2024

@jamilbk - As I did not any update from you so, we are closing this issue. Feel free to reach out to us...thanks

@jamilbk
Copy link
Author

jamilbk commented Aug 2, 2024

Was this issue resolved? What's the reason for closing the issue?

@ReactorScram
Copy link

ReactorScram commented Aug 2, 2024

@Prabhatkumar59 No I did not try it because I was so perplexed by the example code showing an x86_64 MSI on ARM

Also I think it turned out Git for Windows just doesn't build for ARM yet

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

No branches or pull requests

4 participants