nektos/act

Workflows hangs on apt install command

wawrzek opened this issue · 4 comments

Bug report info

act version:            0.2.67
GOOS:                   linux
GOARCH:                 amd64
NumCPU:                 4
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
	/var/run/docker.sock
Config files:
	/home/niewod/.config/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.21.13
	Module path:           github.com/nektos/act
	Main version:          (devel)
	Main path:             github.com/nektos/act
	Main checksum:
	Build settings:
		-buildmode:           exe
		-compiler:            gc
		-ldflags:             -s -w -X main.version=0.2.67 -X main.commit=f75a2d8b38cc3b929ab652c0994d6d33f6584ed9 -X main.date=2024-09-10T18:17:24Z -X main.builtBy=goreleaser
		CGO_ENABLED:          0
		GOARCH:               amd64
		GOOS:                 linux
		GOAMD64:              v1
		vcs:                  git
		vcs.revision:         f75a2d8b38cc3b929ab652c0994d6d33f6584ed9
		vcs.time:             2024-09-10T18:17:07Z
		vcs.modified:         false
Docker Engine:
	Engine version:        26.1.2
	Engine runtime:        runc
	Cgroup version:        1
	Cgroup driver:         cgroupfs
	Storage driver:        overlay2
	Registry URI:          https://index.docker.io/v1/
	OS:                    CRUX
	OS type:               linux
	OS version:
	OS arch:               x86_64
	OS kernel:             6.5.7
	OS CPU:                4
	OS memory:             15972 MB
	Security options:
		name=seccomp,profile=builtin

Command used with act

act -W .github/workflows/pre-commit.yml

Describe issue

One of the steps is to install a few Ubuntu packages. The process hangs

[Run PreCommit/pre-commit checks]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/2] user= workdir=
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
| pkg-config is already the newest version (0.29.2-1ubuntu3).
| pkg-config set to manually installed.
| The following additional packages will be installed:
|   libprotobuf-dev libprotobuf-lite23 libprotobuf23 libprotoc23 libssl3
| Suggested packages:
|   libssl-doc protobuf-mode-el
| The following NEW packages will be installed:
|   libprotobuf-dev libprotobuf-lite23 libprotobuf23 libprotoc23
|   protobuf-compiler
| The following packages will be upgraded:
|   libssl-dev libssl3
| 2 upgraded, 5 newly installed, 0 to remove and 24 not upgraded.
| Need to get 7405 kB of archives.
| After this operation, 17.5 MB of additional disk space will be used.

Link to GitHub repository

No response

Workflow content

name: Run PreCommit

on:
  push:
    branches-ignore:
      - dev
      - master

jobs:
  pre-commit:
    name: pre-commit checks
    runs-on: ubuntu-latest
    steps:
      - run: |
          apt update
      - name: Checkout code
        uses: actions/checkout@v4
      - name: Install  dependencies
        run: >
          sudo apt install
          protobuf-compiler
          pkg-config
          libssl-dev
      - name: Install official Rust
        run: |
          curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
      - name: Install machete
        run: |
          cargo install cargo-machete
      - name: Install nightly tool chain (for fmt)
        run: |
          rustup toolchain install nightly
      - name: Add nightly fmt
        run: >
          rustup component add
          --toolchain nightly-x86_64-unknown-linux-gnu
          rustfmt
      - name: Install precommit
        run: |
          python -m pip install pre-commit
      - name: Install hooks
        run: |
          pre-commit install --install-hooks
      - name: Prebuild tests
        run: |
          cargo build --tests
      - name: Run Pre-Commit
        run: >
          pre-commit run
          --all-files
          --show-diff-on-failure
          -v

Relevant log output

act -v does not show anything special.

Additional information

No response

hey @wawrzek

I would try something like this:

sudo apt install -y
protobuf-compiler
pkg-config
libssl-dev

It looks like apt is running in interactive mode.

@sebastien-perpignane good point. I'm quite surprised that the '-y' is missing. I wonder how it worked on GitHub? However, I lost '-y' quite recently, rewriting workflows to fit in 80 lines, and I didn't lose them everywhere. In the most case it's still there.

Anyway, thank you very much.

@wawrzek full github image probably contains a preconfigured apt command to always run in non interactive mode.

Good point. Maybe worth to add it to the documentation. I created the issue with similar "problem": #2462