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

cannot use environment variables in helm templates #486

Closed
jstrachan opened this issue Apr 27, 2018 · 5 comments · Fixed by #707
Closed

cannot use environment variables in helm templates #486

jstrachan opened this issue Apr 27, 2018 · 5 comments · Fixed by #707

Comments

@jstrachan
Copy link
Contributor

this came up here:
#361 (comment)

I think we need a way to pass in template expressions to helm chart values, like we do for envTemplates so that we can pass in, say, the local docker registry ip/port or private registry via environment variables like we can do for building the docker image name.

@afrittoli
Copy link
Contributor

Yeah, that would be handy.
The same could be used also to pull in secrets from environment variables securely set by the CI engine.

@jstrachan
Copy link
Contributor Author

jstrachan commented Apr 27, 2018

here's a little PR that implements this.

e.g. I could use the following skaffold.yaml with the private local docker registry inside a dev pod in Jenkins X:

apiVersion: skaffold/v1alpha2
kind: Config
build:
  tagPolicy:
    envTemplate:
      template: "{{.JENKINS_X_DOCKER_REGISTRY_SERVICE_HOST}}:{{.JENKINS_X_DOCKER_REGISTRY_SERVICE_PORT}}/jenkinsx/demo100:{{.VERSION}}"
  artifacts:
  - workspace: .
    docker: {}
  local: {}
deploy:
  helm:
    releases:
    - name: demo100
      chartPath: charts/demo100
      namespace: jx
      setValueTemplates:
        image.repository: "{{.JENKINS_X_DOCKER_REGISTRY_SERVICE_HOST}}:{{.JENKINS_X_DOCKER_REGISTRY_SERVICE_PORT}}/jenkinsx/demo100"
        image.tag: "{{.VERSION}}"

@jstrachan
Copy link
Contributor Author

let me know if you're happy with this general approach and if so I can try add a test for it

@afrittoli
Copy link
Contributor

The PR looks good to me - from a functionality pov.

@dlorenc
Copy link
Contributor

dlorenc commented May 18, 2018

Let's track this in #543

@dlorenc dlorenc closed this as completed May 18, 2018
jstrachan added a commit to jstrachan/skaffold that referenced this issue Jun 19, 2018
fixes GoogleContainerTools#486

refactored this PR to reuse existing code for env templates
jstrachan added a commit to jstrachan/skaffold that referenced this issue Jun 19, 2018
fixes GoogleContainerTools#486

refactored this PR to reuse existing code for env templates
jstrachan added a commit to jstrachan/skaffold that referenced this issue Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants