title: Jenkins replace image tag in yaml file that stored in another repository
body: <p>I've two different repo for app and manifests.In manifest repo I've <code>values.yaml</code> files for each microservices. I am looking for a way to update <code>image.tag</code> value with ${BUILD_NUMBER} and then commit/merge this changes to manifest repository from the app pipeline as below.</p>
  <p>What is the best way of doing this ?</p>
  <pre><code>image:
    repository: example.com/app/backend
    tag: &quot;450&quot;
    pullPolicy: Always
  </code></pre>
  <p>Here is the stage in jenkinsfile for app repo.</p>
  <pre><code>stage('Deploy to DEV') {
      when{
          beforeAgent true
          expression{return env.GIT_BRANCH == &quot;origin/development&quot;}
      }
      steps {
          script {
              sh &quot;&quot;&quot;
                  git clone https://github.com/mycompany/backend.git
                  cd apps/project1/app-dev/backend-dev
                  
                  def text = readFile file: &quot;values.yaml&quot;
                  text = text.replaceAll(&quot;%tag%&quot;, &quot;${${BUILD_NUMBER}}&quot;) 
  
                  git add . -m &quot;Update app image tag to ${BUILD_NUMBER}&quot;
                  git push origin master
              &quot;&quot;&quot;
          }
      }
  </code></pre>