aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdocker_build.sh22
-rwxr-xr-xdocker_merge.sh17
-rwxr-xr-xdocker_verify.sh17
-rw-r--r--pom.xml27
4 files changed, 67 insertions, 16 deletions
diff --git a/docker_build.sh b/docker_build.sh
index b21a6955..51a6bb1d 100755
--- a/docker_build.sh
+++ b/docker_build.sh
@@ -2,12 +2,13 @@
#
echo '============== STARTING SCRIPT TO BUILD DOCKER IMAGES ================='
-
DOCKER_REPOSITORY=nexus3.openecomp.org:10003
-DOCKER_VERSION=latest
+MVN_VERSION=$(cat target/version)
+TIMESTAMP=$(date -u +%Y%m%dT%H%M%S)
-export DOCKER_REPOSITORY
-export DOCKER_VERSION
+echo $DOCKER_REPOSITORY
+echo $MVN_VERSION
+echo $TIMESTAMP
cp policy-pe/* target/policy-pe/
cp policy-drools/* target/policy-drools/
@@ -16,11 +17,20 @@ for image in policy-os policy-nexus policy-db policy-base policy-drools policy-p
echo "Building $image"
mkdir -p target/$image
cp $image/* target/$image
- docker build --quiet --tag openecomp/policy/$image:${DOCKER_VERSION} --tag ${DOCKER_REPOSITORY}/openecomp/policy/$image:${DOCKER_VERSION} target/$image
+
+ TAGS="--tag openecomp/policy/${image}:latest"
+ TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/openecomp/policy/${image}:latest"
+ TAGS="${TAGS} --tag openecomp/policy/${image}:${MVN_VERSION}-${TIMESTAMP}"
+ TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/openecomp/policy/${image}:${MVN_VERSION}-${TIMESTAMP}"
+
+ echo $TAGS
+
+ docker build --quiet $TAGS target/$image
docker images
done
for image in policy-nexus policy-db policy-drools policy-pe; do
echo "Pushing $image"
- docker push ${DOCKER_REPOSITORY}/openecomp/policy/$image:${DOCKER_VERSION}
+ docker push ${DOCKER_REPOSITORY}/openecomp/policy/$image:latest
+ docker push ${DOCKER_REPOSITORY}/openecomp/policy/$image:${MVN_VERSION}-${TIMESTAMP}
done
diff --git a/docker_merge.sh b/docker_merge.sh
index 65019782..a115ce39 100755
--- a/docker_merge.sh
+++ b/docker_merge.sh
@@ -3,10 +3,12 @@
echo '============== STARTING SCRIPT TO BUILD DOCKER IMAGES ================='
DOCKER_REPOSITORY=nexus3.openecomp.org:10003
-DOCKER_VERSION=latest
+MVN_VERSION=$(cat target/version)
+TIMESTAMP=$(date -u +%Y%m%dT%H%M%S)
-export DOCKER_REPOSITORY
-export DOCKER_VERSION
+echo $DOCKER_REPOSITORY
+echo $MVN_VERSION
+echo $TIMESTAMP
cp policy-pe/* target/policy-pe/
cp policy-drools/* target/policy-drools/
@@ -15,6 +17,11 @@ for image in policy-os policy-nexus policy-db policy-base policy-drools policy-p
echo "Building $image"
mkdir -p target/$image
cp $image/* target/$image
- docker build --quiet --tag openecomp/policy/$image:${DOCKER_VERSION} --tag ${DOCKER_REPOSITORY}/openecomp/policy/$image:${DOCKER_VERSION} target/$image
- docker images
+
+ TAGS="--tag openecomp/policy/${image}:latest"
+ TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/openecomp/policy/${image}:latest"
+ TAGS="${TAGS} --tag openecomp/policy/${image}:${MVN_VERSION}-${TIMESTAMP}"
+ TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/openecomp/policy/${image}:${MVN_VERSION}-${TIMESTAMP}"
+
+ echo $TAGS
done
diff --git a/docker_verify.sh b/docker_verify.sh
index 65019782..a115ce39 100755
--- a/docker_verify.sh
+++ b/docker_verify.sh
@@ -3,10 +3,12 @@
echo '============== STARTING SCRIPT TO BUILD DOCKER IMAGES ================='
DOCKER_REPOSITORY=nexus3.openecomp.org:10003
-DOCKER_VERSION=latest
+MVN_VERSION=$(cat target/version)
+TIMESTAMP=$(date -u +%Y%m%dT%H%M%S)
-export DOCKER_REPOSITORY
-export DOCKER_VERSION
+echo $DOCKER_REPOSITORY
+echo $MVN_VERSION
+echo $TIMESTAMP
cp policy-pe/* target/policy-pe/
cp policy-drools/* target/policy-drools/
@@ -15,6 +17,11 @@ for image in policy-os policy-nexus policy-db policy-base policy-drools policy-p
echo "Building $image"
mkdir -p target/$image
cp $image/* target/$image
- docker build --quiet --tag openecomp/policy/$image:${DOCKER_VERSION} --tag ${DOCKER_REPOSITORY}/openecomp/policy/$image:${DOCKER_VERSION} target/$image
- docker images
+
+ TAGS="--tag openecomp/policy/${image}:latest"
+ TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/openecomp/policy/${image}:latest"
+ TAGS="${TAGS} --tag openecomp/policy/${image}:${MVN_VERSION}-${TIMESTAMP}"
+ TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/openecomp/policy/${image}:${MVN_VERSION}-${TIMESTAMP}"
+
+ echo $TAGS
done
diff --git a/pom.xml b/pom.xml
index f93ef38e..bed0f7a7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -46,6 +46,11 @@
<name>OpenECOMP Staging Repository</name>
<url>${nexusproxy}/content/repositories/staging/</url>
</repository>
+ <repository>
+ <id>ecomp-snapshot</id>
+ <name>OpenECOMP Snapshot Repository</name>
+ <url>${nexusproxy}/content/repositories/snapshots/</url>
+ </repository>
</repositories>
<distributionManagement>
@@ -132,6 +137,28 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.6.0</version>
+ <executions>
+ <execution>
+ <id>get-target-version</id>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <executable>echo</executable>
+ <workingDirectory>${project.build.directory}</workingDirectory>
+ <arguments>
+ <argument>${project.version}</argument>
+ </arguments>
+ <outputFile>${project.build.directory}/version</outputFile>
+ </configuration>
+ </plugin>
</plugins>
</build>