ACS-550 Build upstream tagged docker images in build.sh

This commit is contained in:
Cezar.Leahu
2020-09-09 22:11:56 +03:00
parent 53c39f98a0
commit 05a2c588d6
2 changed files with 17 additions and 50 deletions

View File

@@ -156,7 +156,7 @@
<executions> <executions>
<execution> <execution>
<id>build-image</id> <id>build-image</id>
<phase>install</phase> <phase>package</phase>
<goals> <goals>
<goal>build</goal> <goal>build</goal>
</goals> </goals>
@@ -214,54 +214,5 @@
</plugins> </plugins>
</build> </build>
</profile> </profile>
<profile>
<id>releaseImage</id>
<!-- publishes "image:release_version" on Quay & DockerHub -->
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<configuration combine.self="override">
<images>
<!-- Quay image -->
<image>
<name>${image.name}:${project.version}</name>
<registry>${image.registry}</registry>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
</build>
</image>
<!-- DockerHub image -->
<image>
<name>${image.name}:${project.version}</name>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
</build>
</image>
</images>
</configuration>
<executions>
<execution>
<id>build-push-image</id>
<phase>deploy</phase>
<goals>
<goal>build</goal>
<!-- Image push is DISABLED, so Continuous Releases don't pollute the repository -->
<!--<goal>push</goal>-->
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles> </profiles>
</project> </project>

View File

@@ -94,6 +94,22 @@ function pullUpstreamTag() {
cloneRepo "${UPSTREAM_REPO}" "${TAG}" cloneRepo "${UPSTREAM_REPO}" "${TAG}"
} }
function pullUpstreamTagAndBuildDockerImage() {
local UPSTREAM_REPO="${1}"
local TAG="${2}"
local EXTRA_BUILD_ARGUMENTS="${3}"
cloneRepo "${UPSTREAM_REPO}" "${TAG}"
pushd "$(dirname "${BASH_SOURCE[0]}")/../../../"
cd "$(basename "${UPSTREAM_REPO%.git}")"
mvn -B -V clean package -DskipTests -Dmaven.javadoc.skip=true "-Dimage.tag=${TAG}" ${EXTRA_BUILD_ARGUMENTS}
popd
}
function pullAndBuildSameBranchOnUpstream() { function pullAndBuildSameBranchOnUpstream() {
local UPSTREAM_REPO="${1}" local UPSTREAM_REPO="${1}"
local EXTRA_BUILD_ARGUMENTS="${2}" local EXTRA_BUILD_ARGUMENTS="${2}"