<p>We are using helm charts to deploy our charts in Openshift.</p>
<p>This is our workflow:</p>
<ul>
<li>We create a new version of the helm and docker image at each sprint/ e.g 1.0.0 (saving them in a snapshot artifactory)</li>
<li>During the sprint we build several times the helm chart and the docker image and push them in our snapshot artifactory every time.</li>
<li>Once the helm chart and the docker image are published, we automatically deploy our chart in our test environment</li>
<li>once we are ready we create the production version of the charts and the docker image: we basically publish the helm chart and the docker image in a release artifactory with the same version. From now on the helm chart and the docker images are immutable</li>
<li>Now we deploy in PROD</li>
</ul>
<p>The issue is that usually the helm-chart does not change but the docker image v1.0.0 (snapshot) may change several times during the sprint therefore when we try to upgrade the helm chart in our test env, helm does not detect any change and then the application is not updated.</p>
<p>To solve this situation, currently, every time that we have to deploy in the test environment, we uninstall the application and re install the helm chart (with the image pull policy == always)</p>
<p>I was wondering if there is a way to modify our helm chart in order to force it to redeploy when we build a new version.
e.g we tried to add an annotation in the deployment.yaml : build-time: {{ now }} but this changes every time so the helm chart is always redeployed in the test environment (and usually is fine but not if we trigger a manual re-deploy of all our components).</p>
<p>Is it possible for example to provide a parameter during the <code>helm package</code> command?
Something like <code>helm package --set package-time=timestamp</code> and then we could save this value as annotation.</p>
<p>Any better solution?</p>

<p>In addition to you functional tag (eg v1.0.0), add a second tag to your image with something unique, for example the git-sha commit tag coming from git used at build time.</p>
<p>The functionnal tag is a &quot;floating&quot; tag, it will move from one image to the other but the &quot;git-sha&quot; tag will be unique</p>
<p>One way to get a short version of git-sha:</p>
<pre><code>git log -n 1 --pretty=format:'%h'
</code></pre>
<p>In your deployment, specify the &quot;git-sha&quot; tag for your image in your helm chart as a variable</p>
<p>The functional tag/version could be read from a single line file in your source, So when you are ready to push v2.0.0, just change the file and commit it</p>
