act icon indicating copy to clipboard operation
act copied to clipboard

Container option `--pull always` is not supported

Open fpfaff opened this issue 1 year ago • 3 comments

Bug report info

❯ gh act --bug-report
act version:            0.2.53
GOOS:                   linux
GOARCH:                 amd64
NumCPU:                 4
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
        /var/run/docker.sock
Config files:           
        /home/user/.actrc:
                --secret-file .act_secrets
                -P z=catthehacker/ubuntu:full-20.04
                -P ubuntu-latest=catthehacker/ubuntu:full-20.04
Build info:
        Go version:            go1.20.10
        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:          0
                GOARCH:               amd64
                GOOS:                 linux
                GOAMD64:              v1
                vcs:                  git
                vcs.revision:         e8856f0fb00fcdd16eef2325b845f55f5d346f51
                vcs.time:             2023-08-21T16:17:06Z
                vcs.modified:         true
Docker Engine:
        Engine version:        23.0.2
        Engine runtime:        runc
        Cgroup version:        2
        Cgroup driver:         systemd
        Storage driver:        overlay2
        Registry URI:          https://index.docker.io/v1/
        OS:                    Ubuntu 22.04.2 LTS
        OS type:               linux
        OS version:            22.04
        OS arch:               x86_64
        OS kernel:             5.15.0-79-generic
        OS CPU:                4
        OS memory:             7870 MB
        Security options:
                name=apparmor
                name=seccomp,profile=builtin
                name=cgroupns

Command used with act

gh act -W .github/workflows/test-pull.yml

Describe issue

GitHub actions support the container option: options: --pull always. We use this to ensure our builds always use the latest build container.

However, running a workflow with this container option using act fails with: Error: Cannot parse container options: '--pull always': 'unknown flag: --pull'

This is probably related to how the containers are created/started

Link to GitHub repository

No response

Workflow content

on:
  push:

jobs:
  test:
    runs-on: [self-hosted, Linux, static ]
    container:
      image: "busybox:latest"
      options: --pull always
    
    steps:
      - run: echo just testing

Relevant log output

[test-pull.yml/test]   🐳  docker create image=busybox:latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[test-pull.yml/test] [DEBUG] Common container.Config ==> &{Hostname: Domainname: User: AttachStdin:false AttachStdout:false AttachStderr:false ExposedPorts:map[] Tty:true OpenStdin:false StdinOnce:false Env:[RUNNER_TOOL_CACHE=/opt/hostedtoolcache RUNNER_OS=Linux RUNNER_ARCH=X64 RUNNER_TEMP=/tmp LANG=C.UTF-8] Cmd:[] Healthcheck:<nil> ArgsEscaped:false Image:busybox:latest Volumes:map[] WorkingDir:/home/user/tester-ui Entrypoint:[] NetworkDisabled:false MacAddress: OnBuild:[] Labels:map[] StopSignal: StopTimeout:<nil> Shell:[]}
[test-pull.yml/test] [DEBUG] Common container.HostConfig ==> &{Binds:[/var/run/docker.sock:/var/run/docker.sock] ContainerIDFile: LogConfig:{Type: Config:map[]} NetworkMode:host PortBindings:map[] RestartPolicy:{Name: MaximumRetryCount:0} AutoRemove:false VolumeDriver: VolumesFrom:[] ConsoleSize:[0 0] Annotations:map[] CapAdd:[] CapDrop:[] CgroupnsMode: DNS:[] DNSOptions:[] DNSSearch:[] ExtraHosts:[] GroupAdd:[] IpcMode: Cgroup: Links:[] OomScoreAdj:0 PidMode: Privileged:false PublishAllPorts:false ReadonlyRootfs:false SecurityOpt:[] StorageOpt:map[] Tmpfs:map[] UTSMode: UsernsMode: ShmSize:0 Sysctls:map[] Runtime: Isolation: Resources:{CPUShares:0 Memory:0 NanoCPUs:0 CgroupParent: BlkioWeight:0 BlkioWeightDevice:[] BlkioDeviceReadBps:[] BlkioDeviceWriteBps:[] BlkioDeviceReadIOps:[] BlkioDeviceWriteIOps:[] CPUPeriod:0 CPUQuota:0 CPURealtimePeriod:0 CPURealtimeRuntime:0 CpusetCpus: CpusetMems: Devices:[] DeviceCgroupRules:[] DeviceRequests:[] KernelMemory:0 KernelMemoryTCP:0 MemoryReservation:0 MemorySwap:0 MemorySwappiness:<nil> OomKillDisable:<nil> PidsLimit:<nil> Ulimits:[] CPUCount:0 CPUPercent:0 IOMaximumIOps:0 IOMaximumBandwidth:0} Mounts:[{Type:volume Source:act-test-pull-yml-test-524e1861e31eda06f58dbbb7a1ae9af531d51f45d4f116c3f87b205d22810f06-env Target:/var/run/act ReadOnly:false Consistency: BindOptions:<nil> VolumeOptions:<nil> TmpfsOptions:<nil> ClusterOptions:<nil>} {Type:volume Source:act-test-pull-yml-test-524e1861e31eda06f58dbbb7a1ae9af531d51f45d4f116c3f87b205d22810f06 Target:/home/user/tester-ui ReadOnly:false Consistency: BindOptions:<nil> VolumeOptions:<nil> TmpfsOptions:<nil> ClusterOptions:<nil>} {Type:volume Source:act-toolcache Target:/toolcache ReadOnly:false Consistency: BindOptions:<nil> VolumeOptions:<nil> TmpfsOptions:<nil> ClusterOptions:<nil>}] MaskedPaths:[] ReadonlyPaths:[] Init:<nil>}
Error: Cannot parse container options: '--pull always': 'unknown flag: --pull'

Additional information

No response

fpfaff avatar Nov 13 '23 16:11 fpfaff

We use this to ensure our builds always use the latest build container

Isn't this the default behavior of both actions/runner and act?

While actions/runner has no opt out.

actions/runner performs these steps

  • docker pull this pulls regardless if such a flag exists
  • Then something like docker run/create ... tail -f /dev/null

actions/runner directly pass options to docker cli, act doesn't use the cli interface

GitHub actions support the container option

Is this documented? I believe undocumented stuff only works, but does not mean supported.

ChristopherHX avatar Nov 13 '23 17:11 ChristopherHX

We added it because we had the issue that actions/runner did not pull the latest image. I will investigate if this is still the case.

fpfaff avatar Nov 14 '23 14:11 fpfaff

GitHub actions support the container option

Is this documented? I believe undocumented stuff only works, but does not mean supported.

The Github Actions documentation states:

Use jobs.<job_id>.container.options to configure additional Docker container resource options. For a list of options, see "docker create options."

Warning: The --network and --entrypoint options are not supported.

Given that it explicitly states the options that are not supported, I assume all others are supported.

fpfaff avatar Nov 14 '23 14:11 fpfaff

Issue is stale and will be closed in 14 days unless there is new activity

github-actions[bot] avatar May 13 '24 00:05 github-actions[bot]

I have encountered the same issue when setting a container name with options: --name abc. I think https://github.com/nektos/act/issues/2412 is related to this as well.

pavel-kalmykov avatar Aug 10 '24 09:08 pavel-kalmykov