<p>Currently, I choose what image to push to registry and i use a &quot; complex &quot; method to set the image tag to manifest before push the files to Git repos.</p>
<p>This is my code</p>
<pre><code>stage(&quot;Push to Repo &quot;){            
                steps {
                    script {
                    def filename = 'Path/to/file/deploy.yaml'
                    def data = readYaml file: filename
                    data.spec[0].template.spec.containers[0].image = &quot;XXXXXXXXXXXXXXXXXXXXX:${PROJECT_VERSION}&quot;
                    sh &quot;rm $filename&quot;
                    writeYaml file: filename, data: data
                    sh &quot;sed -ie 's/- apiVersion/  apiVersion/g' Path/to/file/deploy.yaml &quot;
                    sh &quot;sed -i '/^          - c.*/a ---' Path/to/file/deploy.yaml &quot;
                    sh ''' cd Path/to/file/
                        git add .
                        git commit -m &quot;[0000] [update] update manifest to version: ${PROJECT_VERSION}  &quot;
                        git push -u origin HEAD:branche_name '''
                }}}
</code></pre>
<p>I'am looking for a another way to parse the image tag directly to manifest.</p>
<p>Is there a Jenkins plugin to do that ?</p>

Quentin Merlin
<p>I use YQ tool to do this, it's an image used to edit yaml files.<br />
Example (just <code>docker run</code>):</p>
<pre><code>docker run --rm --user=&quot;root&quot; 
-e TAG=dev-123456
-v &quot;${PWD}&quot;:/workspace 
-w /workspace mikefarah/yq
eval '.spec.spec.containers.image.tag = strenv(TAG)' 
-i values.yaml
</code></pre>
<p>This replaces tag dev-123456 for the current tag in deployment.<br />
I write on multiple lines to make it easier to see, you can write on one line if you want.<br />
Link for details:<br />
<a href="https://hub.docker.com/r/mikefarah/yq" rel="nofollow noreferrer">https://hub.docker.com/r/mikefarah/yq</a></p>
