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

environment variables should be case sensitive #1488

Closed
jsoref opened this issue Dec 2, 2022 · 3 comments · Fixed by #1493
Closed

environment variables should be case sensitive #1488

jsoref opened this issue Dec 2, 2022 · 3 comments · Fixed by #1493
Assignees
Labels
kind/bug Something isn't working

Comments

@jsoref
Copy link
Contributor

jsoref commented Dec 2, 2022

Bug report info

act version:            0.2.34
GOOS:                   darwin
GOARCH:                 arm64
NumCPU:                 10
Docker host:            DOCKER_HOST environment variable is unset/empty.
Sockets found:
	/var/run/docker.sock
	/Users/jsoref/.docker/run/docker.sock
Config files:           
	/Users/jsoref/.actrc:
		#-P ubuntu-latest=node:12.20.1-buster-slim
		#-P ubuntu-20.04=node:12.20.1-buster-slim
		#-P ubuntu-18.04=node:12.20.1-buster-slim
		-P ubuntu-latest=catthehacker/ubuntu:act-latest
		-P ubuntu-20.04=catthehacker/ubuntu:act-20.04
		-P ubuntu-18.04=catthehacker/ubuntu:act-18.04
		-P ubuntu-16.04=catthehacker/ubuntu:act-16.04
		-P self-hosted=catthehacker/ubuntu:act-latest
Build info:
	Go version:            go1.19.3
	Module path:           command-line-arguments
	Main version:          
	Main path:             
	Main checksum:         
	Build settings:
		-compiler:            gc
		-ldflags:             -X main.version=0.2.34
		CGO_ENABLED:          1
		CGO_CFLAGS:           
		CGO_CPPFLAGS:         
		CGO_CXXFLAGS:         
		CGO_LDFLAGS:          
		GOARCH:               arm64
		GOOS:                 darwin
Docker Engine:
	Engine version:        20.10.18
	Engine runtime:        runc
	Cgroup version:        1
	Cgroup driver:         cgroupfs
	Storage driver:        overlay2
	Registry URI:          https://index.docker.io/v1/
	OS:                    Alpine Linux v3.16
	OS type:               linux
	OS version:            3.16.2
	OS arch:               aarch64
	OS kernel:             5.15.64-0-virt
	OS CPU:                2
	OS memory:             7938 MB
	Security options:
		name=seccomp,profile=default

Command used with act

act

Describe issue

GHA makes environment variables case sensitive on Linux/macOS. (On Windows, they're case preserving which is too complicated to fit in the margins.)

Link to GitHub repository

https://github.com/jsoref/nektos-act-env-case-sensitive

Workflow content

on: push

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
    - name: env
      env:
        a: 1
        B: 2
      run:
        echo "$a $B"

Relevant log output

level=warning msg= ⚠ You are using Apple M1 chip and you have not specified container architecture, you might encounter issues while running act. If so, try running it with '--container-architecture linux/amd64'. ⚠ 

time="2022-12-01T23:49:37-05:00" level=debug msg="Loading environment from /tmp/nektos-act-env-case-sensitive/.env"
time="2022-12-01T23:49:37-05:00" level=debug msg="Loading secrets from /tmp/nektos-act-env-case-sensitive/.secrets"
time="2022-12-01T23:49:37-05:00" level=debug msg="Loading workflows from '/tmp/nektos-act-env-case-sensitive/.github/workflows'"
time="2022-12-01T23:49:37-05:00" level=debug msg="Loading workflows recursively"
time="2022-12-01T23:49:37-05:00" level=debug msg="Found workflow 'test.yml' in '/tmp/nektos-act-env-case-sensitive/.github/workflows/test.yml'"
time="2022-12-01T23:49:37-05:00" level=debug msg="Reading workflow '/tmp/nektos-act-env-case-sensitive/.github/workflows/test.yml'"
time="2022-12-01T23:49:37-05:00" level=debug msg="Preparing plan with all jobs"
time="2022-12-01T23:49:37-05:00" level=debug msg="Using the only detected workflow event: push"
time="2022-12-01T23:49:37-05:00" level=debug msg="Planning jobs for event: push"
time="2022-12-01T23:49:37-05:00" level=debug msg="Loading slug from git directory '/tmp/nektos-act-env-case-sensitive/.git'"
time="2022-12-01T23:49:37-05:00" level=debug msg="Loading revision from git directory '/tmp/nektos-act-env-case-sensitive/.git'"
time="2022-12-01T23:49:37-05:00" level=debug msg="Found revision: 4bad47dbaefe882a6b5b278bad97c4bd2d939a39\n"
time="2022-12-01T23:49:37-05:00" level=debug msg="HEAD points to '4bad47dbaefe882a6b5b278bad97c4bd2d939a39'"
time="2022-12-01T23:49:37-05:00" level=debug msg="using github ref: refs/heads/main"
time="2022-12-01T23:49:37-05:00" level=debug msg="Found revision: 4bad47dbaefe882a6b5b278bad97c4bd2d939a39\n"
[test.yml/test] [DEBUG] evaluating expression 'success()'
[test.yml/test] [DEBUG] expression 'success()' evaluated to 'true'
[test.yml/test] 🚀  Start image=catthehacker/ubuntu:act-latest
[test.yml/test]   🐳  docker pull image=catthehacker/ubuntu:act-latest platform= username= forcePull=false
[test.yml/test] [DEBUG]   🐳  docker pull catthehacker/ubuntu:act-latest
[test.yml/test] [DEBUG] Image exists? true
[test.yml/test]   🐳  docker create image=catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[test.yml/test] [DEBUG] Common container.Config ==> &{Hostname: Domainname: User: AttachStdin:false AttachStdout:false AttachStderr:false ExposedPorts:map[] Tty:false OpenStdin:false StdinOnce:false Env:[RUNNER_TOOL_CACHE=/opt/hostedtoolcache RUNNER_OS=Linux RUNNER_ARCH=arm64 RUNNER_TEMP=/tmp] Cmd:[] Healthcheck:<nil> ArgsEscaped:false Image:catthehacker/ubuntu:act-latest Volumes:map[] WorkingDir:/tmp/nektos-act-env-case-sensitive Entrypoint:[] NetworkDisabled:false MacAddress: OnBuild:[] Labels:map[] StopSignal: StopTimeout:<nil> Shell:[]}
[test.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:[] 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: ConsoleSize:[0 0] 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>} {Type:volume Source:act-test-yml-test-env Target:/var/run/act ReadOnly:false Consistency: BindOptions:<nil> VolumeOptions:<nil> TmpfsOptions:<nil>} {Type:volume Source:act-test-yml-test Target:/tmp/nektos-act-env-case-sensitive ReadOnly:false Consistency: BindOptions:<nil> VolumeOptions:<nil> TmpfsOptions:<nil>}] MaskedPaths:[] ReadonlyPaths:[] Init:<nil>}
[test.yml/test] [DEBUG] Created container name=act-test-yml-test id=6a8c84f736ae5c326b7ac33bdd10ab82c8e66a77c73d6c33aad041af79ecb759 from image catthehacker/ubuntu:act-latest (platform: )
[test.yml/test] [DEBUG] ENV ==> [RUNNER_TOOL_CACHE=/opt/hostedtoolcache RUNNER_OS=Linux RUNNER_ARCH=arm64 RUNNER_TEMP=/tmp]
[test.yml/test]   🐳  docker run image=catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[test.yml/test] [DEBUG] Starting container: 6a8c84f736ae5c326b7ac33bdd10ab82c8e66a77c73d6c33aad041af79ecb759
[test.yml/test] [DEBUG] Started container: 6a8c84f736ae5c326b7ac33bdd10ab82c8e66a77c73d6c33aad041af79ecb759
[test.yml/test] [DEBUG] Writing entry to tarball workflow/event.json len:2
[test.yml/test] [DEBUG] Writing entry to tarball workflow/envs.txt len:0
[test.yml/test] [DEBUG] Writing entry to tarball workflow/paths.txt len:0
[test.yml/test] [DEBUG] Extracting content to '/var/run/act/'
[test.yml/test] [DEBUG] Loading slug from git directory '/tmp/nektos-act-env-case-sensitive/.git'
[test.yml/test] [DEBUG] Loading revision from git directory '/tmp/nektos-act-env-case-sensitive/.git'
[test.yml/test] [DEBUG] Found revision: 4bad47dbaefe882a6b5b278bad97c4bd2d939a39
[test.yml/test] [DEBUG] HEAD points to '4bad47dbaefe882a6b5b278bad97c4bd2d939a39'
[test.yml/test] [DEBUG] using github ref: refs/heads/main
[test.yml/test] [DEBUG] Found revision: 4bad47dbaefe882a6b5b278bad97c4bd2d939a39
[test.yml/test] [DEBUG] Loading slug from git directory '/tmp/nektos-act-env-case-sensitive/.git'
[test.yml/test] [DEBUG] Loading revision from git directory '/tmp/nektos-act-env-case-sensitive/.git'
[test.yml/test] [DEBUG] Found revision: 4bad47dbaefe882a6b5b278bad97c4bd2d939a39
[test.yml/test] [DEBUG] HEAD points to '4bad47dbaefe882a6b5b278bad97c4bd2d939a39'
[test.yml/test] [DEBUG] using github ref: refs/heads/main
[test.yml/test] [DEBUG] Found revision: 4bad47dbaefe882a6b5b278bad97c4bd2d939a39
[test.yml/test] [DEBUG] Loading slug from git directory '/tmp/nektos-act-env-case-sensitive/.git'
[test.yml/test] [DEBUG] Loading revision from git directory '/tmp/nektos-act-env-case-sensitive/.git'
[test.yml/test] [DEBUG] Found revision: 4bad47dbaefe882a6b5b278bad97c4bd2d939a39
[test.yml/test] [DEBUG] HEAD points to '4bad47dbaefe882a6b5b278bad97c4bd2d939a39'
[test.yml/test] [DEBUG] using github ref: refs/heads/main
[test.yml/test] [DEBUG] Found revision: 4bad47dbaefe882a6b5b278bad97c4bd2d939a39
[test.yml/test] [DEBUG] setupEnv => map[A:1 ACT:true AGENT_TOOLSDIRECTORY:/opt/hostedtoolcache B:2 CI:true DEBIAN_FRONTEND:noninteractive DEPLOYMENT_BASEPATH:/opt/runner GITHUB_ACTION:0 GITHUB_ACTIONS:true GITHUB_ACTION_PATH: GITHUB_ACTION_REF: GITHUB_ACTION_REPOSITORY: GITHUB_ACTOR:nektos/act GITHUB_API_URL:https://api.github.com GITHUB_BASE_REF: GITHUB_ENV:/var/run/act/workflow/envs.txt GITHUB_EVENT_NAME:push GITHUB_EVENT_PATH:/var/run/act/workflow/event.json GITHUB_GRAPHQL_URL:https://api.github.com/graphql GITHUB_HEAD_REF: GITHUB_JOB:test GITHUB_PATH:/var/run/act/workflow/paths.txt GITHUB_REF:refs/heads/main GITHUB_REF_NAME:main GITHUB_REF_TYPE:branch GITHUB_REPOSITORY:jsoref/nektos-act-env-case-sensitive GITHUB_REPOSITORY_OWNER:jsoref GITHUB_RETENTION_DAYS:0 GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SERVER_URL:https://github.com GITHUB_SHA:4bad47dbaefe882a6b5b278bad97c4bd2d939a39 GITHUB_TOKEN: GITHUB_WORKFLOW:test.yml GITHUB_WORKSPACE:/tmp/nektos-act-env-case-sensitive IMAGE_OS:ubuntu20 ImageOS:ubuntu20 LSB_OS_VERSION:2004 LSB_RELEASE:20.04 PATH:/opt/hostedtoolcache/node/16.18.1/arm64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin RUNNER_PERFLOG:/dev/null RUNNER_TRACKING_ID: RUNNER_USER:root RUN_TOOL_CACHE:/opt/hostedtoolcache USER:root]
[test.yml/test] [DEBUG] Loading slug from git directory '/tmp/nektos-act-env-case-sensitive/.git'
[test.yml/test] [DEBUG] Loading revision from git directory '/tmp/nektos-act-env-case-sensitive/.git'
[test.yml/test] [DEBUG] Found revision: 4bad47dbaefe882a6b5b278bad97c4bd2d939a39
[test.yml/test] [DEBUG] HEAD points to '4bad47dbaefe882a6b5b278bad97c4bd2d939a39'
[test.yml/test] [DEBUG] using github ref: refs/heads/main
[test.yml/test] [DEBUG] Found revision: 4bad47dbaefe882a6b5b278bad97c4bd2d939a39
[test.yml/test] [DEBUG] Loading slug from git directory '/tmp/nektos-act-env-case-sensitive/.git'
[test.yml/test] [DEBUG] Loading revision from git directory '/tmp/nektos-act-env-case-sensitive/.git'
[test.yml/test] [DEBUG] Found revision: 4bad47dbaefe882a6b5b278bad97c4bd2d939a39
[test.yml/test] [DEBUG] HEAD points to '4bad47dbaefe882a6b5b278bad97c4bd2d939a39'
[test.yml/test] [DEBUG] using github ref: refs/heads/main
[test.yml/test] [DEBUG] Found revision: 4bad47dbaefe882a6b5b278bad97c4bd2d939a39
[test.yml/test] [DEBUG] evaluating expression ''
[test.yml/test] [DEBUG] expression '' evaluated to 'true'
[test.yml/test] ⭐ Run Main env
[test.yml/test] [DEBUG] Writing entry to tarball workflow/outputcmd.txt len:0
[test.yml/test] [DEBUG] Writing entry to tarball workflow/statecmd.txt len:0
[test.yml/test] [DEBUG] Extracting content to '/var/run/act'
[test.yml/test] [DEBUG] Loading slug from git directory '/tmp/nektos-act-env-case-sensitive/.git'
[test.yml/test] [DEBUG] Loading revision from git directory '/tmp/nektos-act-env-case-sensitive/.git'
[test.yml/test] [DEBUG] Found revision: 4bad47dbaefe882a6b5b278bad97c4bd2d939a39
[test.yml/test] [DEBUG] HEAD points to '4bad47dbaefe882a6b5b278bad97c4bd2d939a39'
[test.yml/test] [DEBUG] using github ref: refs/heads/main
[test.yml/test] [DEBUG] Found revision: 4bad47dbaefe882a6b5b278bad97c4bd2d939a39
[test.yml/test] [DEBUG] Loading slug from git directory '/tmp/nektos-act-env-case-sensitive/.git'
[test.yml/test] [DEBUG] Loading revision from git directory '/tmp/nektos-act-env-case-sensitive/.git'
[test.yml/test] [DEBUG] Found revision: 4bad47dbaefe882a6b5b278bad97c4bd2d939a39
[test.yml/test] [DEBUG] HEAD points to '4bad47dbaefe882a6b5b278bad97c4bd2d939a39'
[test.yml/test] [DEBUG] using github ref: refs/heads/main
[test.yml/test] [DEBUG] Found revision: 4bad47dbaefe882a6b5b278bad97c4bd2d939a39
[test.yml/test] [DEBUG] Loading slug from git directory '/tmp/nektos-act-env-case-sensitive/.git'
[test.yml/test] [DEBUG] Loading revision from git directory '/tmp/nektos-act-env-case-sensitive/.git'
[test.yml/test] [DEBUG] Found revision: 4bad47dbaefe882a6b5b278bad97c4bd2d939a39
[test.yml/test] [DEBUG] HEAD points to '4bad47dbaefe882a6b5b278bad97c4bd2d939a39'
[test.yml/test] [DEBUG] using github ref: refs/heads/main
[test.yml/test] [DEBUG] Found revision: 4bad47dbaefe882a6b5b278bad97c4bd2d939a39
[test.yml/test] [DEBUG] Loading slug from git directory '/tmp/nektos-act-env-case-sensitive/.git'
[test.yml/test] [DEBUG] Loading revision from git directory '/tmp/nektos-act-env-case-sensitive/.git'
[test.yml/test] [DEBUG] Found revision: 4bad47dbaefe882a6b5b278bad97c4bd2d939a39
[test.yml/test] [DEBUG] HEAD points to '4bad47dbaefe882a6b5b278bad97c4bd2d939a39'
[test.yml/test] [DEBUG] using github ref: refs/heads/main
[test.yml/test] [DEBUG] Found revision: 4bad47dbaefe882a6b5b278bad97c4bd2d939a39
[test.yml/test] [DEBUG] Wrote command 

echo "$a $B"

 to 'workflow/0'
[test.yml/test] [DEBUG] Writing entry to tarball workflow/0 len:14
[test.yml/test] [DEBUG] Extracting content to '/var/run/act'
[test.yml/test]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0] user= workdir=
[test.yml/test] [DEBUG] Exec command '[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0]'
[test.yml/test] [DEBUG] Working directory '/tmp/nektos-act-env-case-sensitive'
[test.yml/test]   |  2
[test.yml/test]   ✅  Success - Main env
[test.yml/test] [DEBUG] Removed container: 6a8c84f736ae5c326b7ac33bdd10ab82c8e66a77c73d6c33aad041af79ecb759
[test.yml/test] [DEBUG]   🐳  docker volume rm act-test-yml-test
[test.yml/test] [DEBUG]   🐳  docker volume rm act-test-yml-test-env
[test.yml/test] 🏁  Job succeeded
[test.yml/test] [DEBUG] Loading slug from git directory '/tmp/nektos-act-env-case-sensitive/.git'
[test.yml/test] [DEBUG] Loading revision from git directory '/tmp/nektos-act-env-case-sensitive/.git'
[test.yml/test] [DEBUG] Found revision: 4bad47dbaefe882a6b5b278bad97c4bd2d939a39
[test.yml/test] [DEBUG] HEAD points to '4bad47dbaefe882a6b5b278bad97c4bd2d939a39'
[test.yml/test] [DEBUG] using github ref: refs/heads/main
[test.yml/test] [DEBUG] Found revision: 4bad47dbaefe882a6b5b278bad97c4bd2d939a39

Additional information

https://github.com/jsoref/nektos-act-env-case-sensitive/actions/runs/3598970524/jobs/6062193588#step:2:1

Run echo "$a $B"

1 2

|  2

The | is from the docker environment and doesn't count as output.

@jsoref jsoref added the kind/bug Something isn't working label Dec 2, 2022
@ChristopherHX
Copy link
Contributor

ChristopherHX commented Dec 2, 2022

Hmm, you found something I have not expected in the codebase

act/pkg/model/workflow.go

Lines 463 to 470 in 7754ba7

env := environment(s.Env)
for k, v := range env {
delete(env, k)
env[strings.ToUpper(k)] = v
}
return env

@KnisterPeter git blame tells me that it was your PR

@KnisterPeter
Copy link
Member

Yes I'm guilty. That seem to be a regression.

@KnisterPeter KnisterPeter self-assigned this Dec 7, 2022
@KnisterPeter
Copy link
Member

KnisterPeter commented Dec 7, 2022

I don't think I did a regression, it was like that before:

envKey = fmt.Sprintf("INPUT_%s", strings.ToUpper(envKey))

But anyway I'll look if I can provide a fix for that.

Hmm, maybe I'm wrong here 😄

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

Successfully merging a pull request may close this issue.

3 participants