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

Paths to binaries put in GITHUB_PATH are not correctly set #2637

Open
gotha opened this issue Jan 29, 2025 · 1 comment
Open

Paths to binaries put in GITHUB_PATH are not correctly set #2637

gotha opened this issue Jan 29, 2025 · 1 comment
Labels
kind/bug Something isn't working

Comments

@gotha
Copy link

gotha commented Jan 29, 2025

Bug report info

act version:            0.2.71
GOOS:                   darwin
GOARCH:                 arm64
NumCPU:                 14
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
        /var/run/docker.sock
        $HOME/.docker/run/docker.sock
Config files:
        /Users/gotha/Library/Application Support/act/actrc:
                -P ubuntu-latest=catthehacker/ubuntu:act-latest
                -P ubuntu-22.04=catthehacker/ubuntu:act-22.04
                -P ubuntu-20.04=catthehacker/ubuntu:act-20.04
                -P ubuntu-18.04=catthehacker/ubuntu:act-18.04
Build info:
        Go version:            go1.23.4
        Module path:           github.com/nektos/act
        Main version:          (devel)
        Main path:             github.com/nektos/act
        Main checksum:
        Build settings:
                -buildmode:           exe
                -compiler:            gc
                -trimpath:            true
                CGO_ENABLED:          1
                GOARCH:               arm64
                GOOS:                 darwin
                GOARM64:              v8.0
Docker Engine:
        Engine version:        27.4.0
        Engine runtime:        runc
        Cgroup version:        2
        Cgroup driver:         cgroupfs
        Storage driver:        overlay2
        Registry URI:          https://index.docker.io/v1/
        OS:                    Docker Desktop
        OS type:               linux
        OS version:
        OS arch:               aarch64
        OS kernel:             6.10.14-linuxkit
        OS CPU:                1
        OS memory:             1974 MB
        Security options:
                name=seccomp,profile=unconfined
                name=cgroupns

Command used with act

act -W .github/workflows/test.yaml

Describe issue

When a step in the workflow installs a binary and puts it into $GITHUB_PATH it is not found by other scripts in the same step or job.

Expected behavior:
When test1.sh is executed and the it puts something in $GITHUB_PATH, the binary should be visible to

  • other scripts in the same step
  • scripts in the following step/s
  • steps in a job that depends on the current

The described behaviour works with Github Actions, but fails with act (you can see the workflow in the attachment).

test1.sh

#!/usr/bin/env bash

version="v1.31.4"
arch
case $(uname -m) in
    i686)               arch="386" ;;
    x86_64)             arch="amd64" ;;
    arm|aarch64|arm64)  arch="arm64" ;;
    *) exit 1 ;;
esac

cache_dir="${RUNNER_TOOL_CACHE}/tmp/${version}/${arch}"
echo "cache_dir: $cache_dir"

kubectl_dir="${cache_dir}/kubectl/bin/"
echo "kubectl_dir: $kubectl_dir"
mkdir -p "${kubectl_dir}"
ls -las "$kubectl_dir"

echo "https://dl.k8s.io/release/${version}/bin/linux/${arch}/kubectl"
curl -sSLo "${kubectl_dir}/kubectl" "https://dl.k8s.io/release/${version}/bin/linux/${arch}/kubectl"
chmod +x "${kubectl_dir}/kubectl"

echo 'Adding kubectl directory to PATH...'
echo "${kubectl_dir}" >> "${GITHUB_PATH}"

test2.sh

#!/usr/bin/env bash

echo "which:"
which kubectl
echo "kubectl ver"
kubectl version --client

Link to GitHub repository

Here is an example of pipeline that succeeds with running the scripts:
https://github.com/gotha/kind-action/actions/runs/13030156289/job/36347477256

The behavior was originally observed when using helm/kind-action@v1

Workflow content

name: Manually trigger a pipeline to test how GITUB_PATH works

on:
  pull_request:
  push:
    branches:
      - *
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@v4
    - name: dbg1
      run: |
        ./test1.sh
        ./test2.sh
    - name: dbg2
      run: |
        ./test2.sh

  test:
    runs-on: ubuntu-latest
    needs: build
    steps:
    - name: Checkout code
      uses: actions/checkout@v4
    - name: dbg3
      run: |
        ./test2.sh

Relevant log output

[CI/build]   ✅  Success - Main Checkout code
[CI/build] ⭐ Run Main dbg1
[CI/build]   🐳  docker exec cmd=[bash -e /var/run/act/workflow/1] user= workdir=
| aarch64
| cache_dir: /opt/hostedtoolcache/tmp/v1.31.4/arm64
| kubectl_dir: /opt/hostedtoolcache/tmp/v1.31.4/arm64/kubectl/bin/
| https://dl.k8s.io/release/v1.31.4/bin/linux/arm64/kubectl
| Adding kubectl directory to PATH...
| which:
| kubectl ver
| .test2.sh: line 6: kubectl: command not found
[CI/build]   ❌  Failure - Main dbg1
[CI/build]   ⚙  ::add-path:: /opt/hostedtoolcache/tmp/v1.31.4/arm64/kubectl/bin/
[CI/build] exitcode '127': command not found, please refer to https://github.com/nektos/act/issues/107 for more information

Additional information

No response

@gotha gotha added the kind/bug Something isn't working label Jan 29, 2025
@ChristopherHX
Copy link
Contributor

  • other scripts in the same step
  • steps in a job that depends on the current

I disagree, btw the vm image used on GitHub contains kubectl https://github.com/actions/runner-images/blob/ubuntu24/20250126.1/images/ubuntu/Ubuntu2404-Readme.md#tools

So you don't observe that your workflow might be broken?

You could download it if you like, its tag full-24.04 of the default images listed in the act user guide runner page

scripts in the following step/s

I agree about this should work, is this broken?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants