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 from parameter file are encapsulated in quotes #1718

Closed
perbu opened this issue Oct 30, 2019 · 5 comments
Closed

Environment variables from parameter file are encapsulated in quotes #1718

perbu opened this issue Oct 30, 2019 · 5 comments
Assignees
Labels

Comments

@perbu
Copy link
Contributor

perbu commented Oct 30, 2019

Is this a BUG REPORT or FEATURE REQUEST?: BUG REPORT

What happened: Environment variables from parameter file are encapsulated in quotes.

What you expected to happen: I expected the environment variable to be set to the correct value without adding quotes to the string.

How to reproduce it (as minimally and precisely as possible):

Given the following workflow:

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: hello-world-
spec:
  entrypoint: dump-env
  templates:
  - name: dump-env
    container:
      image: alpine:latest
      command: [env]
      env:
        - name: 'ENDPOINT'
          value:  '{{workflow.parameters.ENDPOINT}}'

with the following parameter file:

ENDPOINT: https://storage.googleapis.com/

Invoked like this:

➜  Argo argo submit --parameter-file minimal.yaml minimal-workflow.yaml 
Name:                hello-world-gzxzp
Namespace:           default
ServiceAccount:      default
Status:              Pending
Created:             Wed Oct 30 12:45:46 +0100 (now)
Parameters:          
  ENDPOINT:          "https://storage.googleapis.com/"
➜  Argo 

You see ENDPOINT is set with quotes within the environment variable itself. What I expected was this to be set to the content of the string, without quotes.

I now have to cleanup the environment variables before I can use them.

Note that integer values are correctly set.

Anything else we need to know?:

Environment:

➜  Argo argo version
argo: v2.4.2
  BuildDate: 2019-10-21T18:39:52Z
  GitCommit: 675c66267f0c916de0f233d8101aa0646acb46d4
  GitTreeState: clean
  GitTag: v2.4.2
  GoVersion: go1.11.5
  Compiler: gc
  Platform: darwin/amd64
$ argo version
  • Kubernetes version :
➜  Argo kubectl version -o yaml
clientVersion:
  buildDate: "2019-09-18T14:47:22Z"
  compiler: gc
  gitCommit: 8fca2ec50a6133511b771a11559e24191b1aa2b4
  gitTreeState: clean
  gitVersion: v1.14.7
  goVersion: go1.12.9
  major: "1"
  minor: "14"
  platform: darwin/amd64
serverVersion:
  buildDate: "2019-09-18T14:39:02Z"
  compiler: gc
  gitCommit: 8fca2ec50a6133511b771a11559e24191b1aa2b4
  gitTreeState: clean
  gitVersion: v1.14.7
  goVersion: go1.12.9
  major: "1"
  minor: "14"
  platform: linux/amd64

PS: I'm otherwise super happy with Argo. It is a very useful tool for me and it sparks joy.

@perbu
Copy link
Contributor Author

perbu commented Oct 30, 2019

Note that if I set the variable directly in the workflow it is set correctly.

It seems there is a bit much quoting happening when parsing the parameter file.

@simster7 simster7 self-assigned this Nov 1, 2019
@simster7
Copy link
Member

simster7 commented Nov 2, 2019

Have you thought about contributing a fix? Looks like this one line needs a strconv.Unquote(...):

https://github.com/argoproj/argo/blob/12b983f4c00bda3f9bedd14a316b0beade6158ed/workflow/util/util.go#L222

I'm otherwise super happy with Argo. It is a very useful tool for me and it sparks joy.

Glad to hear!

@perbu
Copy link
Contributor Author

perbu commented Nov 4, 2019

Thanks for the welcoming attitude, Simon. I've made an attempt at a fix.

@sarabala1979 sarabala1979 added the good first issue Good for newcomers label Nov 4, 2019
@sarabala1979
Copy link
Member

Welcome @perbu to Argo community. I will review your PR.

@simster7
Copy link
Member

simster7 commented Nov 4, 2019

#1733 merged.

@simster7 simster7 closed this as completed Nov 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants