Repository: nektos/act (language: go)

Issue:
Cannot process container options if device is provided as container option
### Bug report info

```plain text
act version:            0.2.45
GOOS:                   linux
GOARCH:                 amd64
NumCPU:                 120
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
        /var/run/docker.sock
Config files:           
        /nethome/mwizak/.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.18.10
        Module path:           github.com/nektos/act
        Main version:          (devel)
        Main path:             github.com/nektos/act
        Main checksum:         
        Build settings:
                -compiler:            gc
                -ldflags:             -s -w -X main.version=0.2.45 -X main.commit=f1df2ca5d6b315935cf9bb0d2a989175adf4e894 -X main.date=2023-05-01T02:18:49Z -X main.builtBy=goreleaser
                CGO_ENABLED:          0
                GOARCH:               amd64
                GOOS:                 linux
                GOAMD64:              v1
                vcs:                  git
                vcs.revision:         f1df2ca5d6b315935cf9bb0d2a989175adf4e894
                vcs.time:             2023-05-01T02:18:34Z
                vcs.modified:         false
Docker Engine:
        Engine version:        20.10.21
        Engine runtime:        runc
        Cgroup version:        1
        Cgroup driver:         cgroupfs
        Storage driver:        overlay2
        Registry URI:          https://index.docker.io/v1/
        OS:                    Ubuntu 20.04.6 LTS
        OS type:               linux
        OS version:            20.04
        OS arch:               x86_64
        OS kernel:             5.4.0-152-generic
        OS CPU:                120
        OS memory:             100664 MB
        Security options:
                name=apparmor
                name=seccomp,profile=default
```


### Command used with act

```sh
act --actor $USER -v -P ubuntu-latest --container-architecture="linux/amd64" --container-options="--device=/dev/infiniband"
```


### Describe issue

No error if a device is provided as a container option.

### Link to GitHub repository

_No response_

### Workflow content

```yml
name: CI
on: push

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-node@v1
    - run: npm install
    - run: npm test
```


### Relevant log output

```sh
DEBU[0000] Loading environment from /nethome/mwizak/sandbox/github-actions-demo/.env 
DEBU[0000] Loading action inputs from /nethome/mwizak/sandbox/github-actions-demo/.input 
DEBU[0000] Loading secrets from /nethome/mwizak/sandbox/github-actions-demo/.secrets 
DEBU[0000] Evaluated matrix inclusions: map[]           
DEBU[0000] Loading workflows from '/nethome/mwizak/sandbox/github-actions-demo/.github/workflows' 
DEBU[0000] Loading workflows recursively                
DEBU[0000] Conditional GET for notices etag=665a07b1-e67b-4b13-be6f-2db82ea2573e 
DEBU[0000] Found workflow 'main.yml' in '/nethome/mwizak/sandbox/github-actions-demo/.github/workflows/main.yml' 
DEBU[0000] Reading workflow '/nethome/mwizak/sandbox/github-actions-demo/.github/workflows/main.yml' 
DEBU[0000] Preparing plan with all jobs                 
DEBU[0000] Using the only detected workflow event: push 
DEBU[0000] Planning jobs for event: push                
DEBU[0000] gc: 2023-07-14 08:01:18.851121719 +0000 UTC m=+0.012689486  module=artifactcache
DEBU[0000] Final matrix after applying user inclusions '[map[]]' 
DEBU[0000] Loading revision from git directory          
DEBU[0000] Found revision: 5c6f585b1f9d8526c8e1672c5f8f00883b895d93 
DEBU[0000] HEAD points to '5c6f585b1f9d8526c8e1672c5f8f00883b895d93' 
DEBU[0000] using github ref: refs/heads/master          
DEBU[0000] Found revision: 5c6f585b1f9d8526c8e1672c5f8f00883b895d93 
[CI/test] [DEBUG] evaluating expression 'success()'
[CI/test] [DEBUG] expression 'success()' evaluated to 'true'
[CI/test] 🚀  Start image=catthehacker/ubuntu:act-latest
[CI/test]   🐳  docker pull image=catthehacker/ubuntu:act-latest platform=linux/amd64 username= forcePull=true
[CI/test] [DEBUG]   🐳  docker pull catthehacker/ubuntu:act-latest
[CI/test] [DEBUG] pulling image 'docker.io/catthehacker/ubuntu:act-latest' (linux/amd64)
DEBU[0000] Saving notices etag=665a07b1-e67b-4b13-be6f-2db82ea2573e 
DEBU[0000] No new notices                               
[CI/test] [DEBUG] Pulling from catthehacker/ubuntu :: act-latest
[CI/test] [DEBUG] Digest: sha256:d085cc1ba1fe924746ea9ff572c7b7a8feb630a07d2124d2af11cf9e8ad95ef2 :: 
[CI/test] [DEBUG] Status: Image is up to date for catthehacker/ubuntu:act-latest :: 
[CI/test]   🐳  docker create image=catthehacker/ubuntu:act-latest platform=linux/amd64 entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[CI/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:catthehacker/ubuntu:act-latest Volumes:map[] WorkingDir:/nethome/mwizak/sandbox/github-actions-demo Entrypoint:[] NetworkDisabled:false MacAddress: OnBuild:[] Labels:map[] StopSignal: StopTimeout:<nil> Shell:[]}
[CI/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] 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-toolcache Target:/toolcache ReadOnly:false Consistency: BindOptions:<nil> VolumeOptions:<nil> TmpfsOptions:<nil> ClusterOptions:<nil>} {Type:volume Source:act-CI-test-7587b47f572787ca4bc647c2581a917f05f439a38e66ca9abce9eb5337031daf-env Target:/var/run/act ReadOnly:false Consistency: BindOptions:<nil> VolumeOptions:<nil> TmpfsOptions:<nil> ClusterOptions:<nil>} {Type:volume Source:act-CI-test-7587b47f572787ca4bc647c2581a917f05f439a38e66ca9abce9eb5337031daf Target:/nethome/mwizak/sandbox/github-actions-demo ReadOnly:false Consistency: BindOptions:<nil> VolumeOptions:<nil> TmpfsOptions:<nil> ClusterOptions:<nil>}] MaskedPaths:[] ReadonlyPaths:[] Init:<nil>}
Error: Cannot process container options: '--device=/dev/infiniband': 'unknown server OS: '
```


### Additional information

I believe the error is due to a bug at this [line](https://github.com/nektos/act/blob/e343ea9d5f6fa478a364b1f502b4859eed63fa38/pkg/container/docker_run.go#L354C1-L355C1). The server OS is forced to an empty string and so `validateDevice(device, serverOS)` results in error.

docker_run.go
```
	containerConfig, err := parse(flags, copts, "")
	if err != nil {
		return nil, nil, fmt.Errorf("Cannot process container options: '%s': '%w'", input.Options, err)
	}
```

docker_cli.go
```
validated, err = validateDevice(device, serverOS)
		if err != nil {
			return nil, err
		}
```




Discussion / hints:

Fix patch:
diff --git a/pkg/container/docker_run.go b/pkg/container/docker_run.go
index 6eab90df548..cf58aee902d 100644
--- a/pkg/container/docker_run.go
+++ b/pkg/container/docker_run.go
@@ -351,7 +351,7 @@ func (cr *containerReference) mergeContainerConfigs(ctx context.Context, config
 		}
 	}
 
-	containerConfig, err := parse(flags, copts, "")
+	containerConfig, err := parse(flags, copts, runtime.GOOS)
 	if err != nil {
 		return nil, nil, fmt.Errorf("Cannot process container options: '%s': '%w'", input.Options, err)
 	}


Test patch: