fix jenkins staing jobs with policy agent image

add a build execution before pushing execution

Issue-ID: NONRTRIC-79
Signed-off-by: YongchaoWu <yongchao.wu@est.tech>
Change-Id: I23c7fad8b9f1f76cd6d820779c06dcfb3eb49139
diff --git a/policy-agent/pom.xml b/policy-agent/pom.xml
index 18158c3..bb6cdb7 100644
--- a/policy-agent/pom.xml
+++ b/policy-agent/pom.xml
@@ -237,6 +237,29 @@
                 <inherited>false</inherited>
                 <executions>
                     <execution>
+                        <id>generate-policy-agent-image</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>build</goal>
+                        </goals>
+                        <configuration>
+                            <pullRegistry>${env.CONTAINER_PULL_REGISTRY}</pullRegistry>
+                            <images>
+                                <image>
+                                    <name>o-ran-sc/policy-agent:${project.version}</name>
+                                    <build>
+                                        <cleanup>try</cleanup>
+                                        <contextDir>${basedir}</contextDir>
+                                        <dockerFile>Dockerfile</dockerFile>
+                                        <tags>
+                                            <tag>${project.version}</tag>
+                                        </tags>
+                                    </build>
+                                </image>
+                            </images>
+                        </configuration>
+                    </execution>
+                    <execution>
                         <id>push-policy-agent-image</id>
                         <goals>
                             <goal>build</goal>