<p>I have a task, to get jenkins variables to apply to Helm chart value.</p>
<p>As I googled I recognized that I have to use secret part in k8s. We can not put variable's value into <code>value.yaml</code> file.</p>
<p>But for secret we have to put value into yaml file.</p>
<p>So how to get variable which we define in Jenkins job and put it to value of helm chart .</p>
<p>I think we have a solution for this but I didnot find out.</p>
<p>Appriciated your help .</p>

Thanh Nguyen Van
<p>You can first use is to <code>--set</code></p>
<pre><code>export USERNAME=hello_user
</code></pre>
<p>this way you can overwrite the <strong>values.yaml</strong></p>
<pre><code>helm install --set username=$USERNAME [chart name] [chart path]
</code></pre>
<p><strong>Option : 2</strong></p>
<p>Inject file to Jenkin job</p>
<pre><code>apiVersion: v1
kind: Secret
metadata:
  name: {{ .Release.Name }}-auth
stringData::
{{ .Files.Get &quot;&lt;chart_base_directory&gt;/secrets&quot; | indent 2 }}
</code></pre>
<p>You can also checkout this : <a href="https://stackoverflow.com/questions/49928819/how-to-pull-environment-variables-with-helm-charts">How to pull environment variables with Helm charts</a></p>
