agent-stack-k8s icon indicating copy to clipboard operation
agent-stack-k8s copied to clipboard

[bug] global environment int variables cause golang error

Open agates4 opened this issue 1 year ago • 3 comments

If global environment variables are set in the top level pipeline file as an int, it'll cause a golang error and won't be processed

env:
  myenv: 1

steps:
  - label: build image
    agents:
      queue: kubernetes
    plugins:
      - kubernetes:
          podSpec:
            containers:
              - image: alpine:latest
                command: [echo]
                env:
                  - name: DOCKER_HOST
                     value: tcp://localhost:2375
                args:
                - "Hello, world!"

Also, the env variables should be merged, so any global envs should be merged into the local step envs

agates4 avatar Sep 06 '23 15:09 agates4

hi @agates4 - would you be able to post the golang error than having global int envars causes?

moskyb avatar Sep 19 '23 05:09 moskyb

@moskyb the BUILDKITE_COMMAND environment variable for container_0 is modified with the golang error:

BUILDKITE_COMMAND: echo "failed parsing Kubernetes plugin: json: cannot unmarshal bool into Go struct field EnvVar.PodSpec.containers.env.value of type string" && exit 1

agates4 avatar Sep 28 '23 15:09 agates4

similar error on container-0 when the gitEnvFrom is misconfigured. an error should be thrown here instead.

- name: BUILDKITE_COMMAND
  value: 'echo "failed parsing Kubernetes plugin: json: cannot unmarshal array into Go struct field EnvFromSource.GitEnvFrom.secretRef of type v1.SecretEnvSource" && exit 1'

calvinbui avatar Feb 21 '24 00:02 calvinbui