replace code yaml with code replacer plugin version 1.5.1

9/30/2019

i'm trying to replace the version in a yaml file using a com.google.code.maven-replacer-plugin plugin during a build process on Jenkins, here's what the yaml file looks like.

apiVersion: v1
kind: Pod
metadata:
  name: example-service
  labels:
    component: example-service
spec:
  containers:
    - name: example-service
      image:example-service:@@deploymentVersion@@
      ports:
        - containerPort: 9080

and here's the POM.xml file, please let me know what im missing because this doesn't work, note: im running this on jenkins

<plugin>
  <groupId>com.google.code.maven-replacer-plugin</groupId>
  <artifactId>replacer</artifactId>
  <version>1.5.1</version>
  <executions>
    <execution>
      <phase>generate-resources</phase>
      <goals>
        <goal>replace</goal>
      </goals>
    </execution>
  </executions>
  <configuration>
    <includes>
      <include>${project.basedir}/deployment.yml</include>
    </includes>
    <replacements>
      <replacement>
        <token>@@deploymentVersion@@</token>
        <value>${project.version}</value>
      </replacement>
    </replacements>
  </configuration>
-- muzi jack
devops
java
kubernetes
regexp-replace

0 Answers