This is an automated email from the ASF dual-hosted git repository.

nvazquez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/main by this push:
     new c146449  Create profiles to download systemvm-templates (#5602)
c146449 is described below

commit c146449ab8642181cc9f8bb618449cfcd1089763
Author: Daniel Augusto Veronezi Salvador 
<[email protected]>
AuthorDate: Thu Mar 17 00:55:27 2022 -0300

    Create profiles to download systemvm-templates (#5602)
    
    * Create profiles to download systemvm-templates
    
    * Rename profiles
    
    * Add support to pass necessary flags to the packaging jobs
    
    * Escape flags
    
    Co-authored-by: GutoVeronezi <[email protected]>
    Co-authored-by: Pearl Dsilva <[email protected]>
---
 engine/schema/pom.xml        | 124 ++++++++++++++++++++++++++++++++++++++++++-
 packaging/centos7/cloud.spec |   5 ++
 packaging/centos8/cloud.spec |   5 ++
 packaging/package.sh         |  19 ++++++-
 packaging/suse15/cloud.spec  |   5 ++
 5 files changed, 155 insertions(+), 3 deletions(-)

diff --git a/engine/schema/pom.xml b/engine/schema/pom.xml
index 6ccb8d5..7dabcc2 100644
--- a/engine/schema/pom.xml
+++ b/engine/schema/pom.xml
@@ -156,10 +156,10 @@
     </build>
     <profiles>
         <profile>
-            <id>template-create</id>
+            <id>download-kvm-systemvm-template</id>
             <activation>
                 <property>
-                    <name>noredist</name>
+                    <name>systemvm-kvm</name>
                 </property>
             </activation>
             <build>
@@ -186,6 +186,30 @@
                                     <md5>${kvm.checksum}</md5>
                                 </configuration>
                             </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
+            <id>download-vmware-systemvm-template</id>
+            <activation>
+                <property>
+                    <name>systemvm-vmware</name>
+                </property>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-resources-plugin</artifactId>
+                        <version>${cs.resources-plugin.version}</version>
+                    </plugin>
+                    <plugin>
+                        <groupId>com.googlecode.maven-download-plugin</groupId>
+                        <artifactId>download-maven-plugin</artifactId>
+                        <version>1.6.3</version>
+                        <executions>
                             <execution>
                                 <id>download-vmware-template</id>
                                 <goals>
@@ -198,6 +222,30 @@
                                     <md5>${vmware.checksum}</md5>
                                 </configuration>
                             </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
+            <id>download-xenserver-systemvm-template</id>
+            <activation>
+                <property>
+                    <name>systemvm-xen</name>
+                </property>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-resources-plugin</artifactId>
+                        <version>${cs.resources-plugin.version}</version>
+                    </plugin>
+                    <plugin>
+                        <groupId>com.googlecode.maven-download-plugin</groupId>
+                        <artifactId>download-maven-plugin</artifactId>
+                        <version>1.6.3</version>
+                        <executions>
                             <execution>
                                 <id>download-xenserver-template</id>
                                 <goals>
@@ -215,5 +263,77 @@
                 </plugins>
             </build>
         </profile>
+        <profile>
+            <id>download-ovm-systemvm-template</id>
+            <activation>
+                <property>
+                    <name>systemvm-ovm</name>
+                </property>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-resources-plugin</artifactId>
+                        <version>${cs.resources-plugin.version}</version>
+                    </plugin>
+                    <plugin>
+                        <groupId>com.googlecode.maven-download-plugin</groupId>
+                        <artifactId>download-maven-plugin</artifactId>
+                        <version>1.6.3</version>
+                        <executions>
+                            <execution>
+                                <id>download-ovm-template</id>
+                                <goals>
+                                    <goal>wget</goal>
+                                </goals>
+                                <configuration>
+                                    <checkSignature>true</checkSignature>
+                                    
<url>https://download.cloudstack.org/systemvm/${cs.version}/systemvmtemplate-${cs.version}.${patch.version}-ovm.raw.bz2</url>
+                                    
<outputDirectory>${basedir}/dist/systemvm-templates/</outputDirectory>
+                                    <md5>${ovm.checksum}</md5>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
+            <id>download-hyperv-systemvm-template</id>
+            <activation>
+                <property>
+                    <name>systemvm-hyperv</name>
+                </property>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-resources-plugin</artifactId>
+                        <version>${cs.resources-plugin.version}</version>
+                    </plugin>
+                    <plugin>
+                        <groupId>com.googlecode.maven-download-plugin</groupId>
+                        <artifactId>download-maven-plugin</artifactId>
+                        <version>1.6.3</version>
+                        <executions>
+                            <execution>
+                                <id>download-hyperv-template</id>
+                                <goals>
+                                    <goal>wget</goal>
+                                </goals>
+                                <configuration>
+                                    <checkSignature>true</checkSignature>
+                                    
<url>https://download.cloudstack.org/systemvm/${cs.version}/systemvmtemplate-${cs.version}.${patch.version}-hyperv.vhd.zip</url>
+                                    
<outputDirectory>${basedir}/dist/systemvm-templates/</outputDirectory>
+                                    <md5>${hyperv.checksum}</md5>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
     </profiles>
 </project>
diff --git a/packaging/centos7/cloud.spec b/packaging/centos7/cloud.spec
index 604e853..d8ecf66 100644
--- a/packaging/centos7/cloud.spec
+++ b/packaging/centos7/cloud.spec
@@ -207,6 +207,11 @@ if [ "%{_sim}" == "SIMULATOR" -o "%{_sim}" == "simulator" 
] ; then
    FLAGS="$FLAGS -Dsimulator"
 fi
 
+if [ \"%{_temp}\" != "" ]; then
+    echo "Adding flags to package requested templates"
+    FLAGS="$FLAGS `rpm --eval %{?_temp}`"
+fi
+
 mvn -Psystemvm,developer $FLAGS clean package
 cd ui && npm install && npm run build && cd ..
 
diff --git a/packaging/centos8/cloud.spec b/packaging/centos8/cloud.spec
index cec88a2..e86a987 100644
--- a/packaging/centos8/cloud.spec
+++ b/packaging/centos8/cloud.spec
@@ -200,6 +200,11 @@ if [ "%{_sim}" == "SIMULATOR" -o "%{_sim}" == "simulator" 
] ; then
    FLAGS="$FLAGS -Dsimulator"
 fi
 
+if [ \"%{_temp}\" != "" ]; then
+    echo "Adding flags to package requested templates"
+    FLAGS="$FLAGS `rpm --eval %{?_temp}`"
+fi
+
 mvn -Psystemvm,developer $FLAGS clean package
 cd ui && npm install && npm run build && cd ..
 
diff --git a/packaging/package.sh b/packaging/package.sh
index 380908b..bf95f84 100755
--- a/packaging/package.sh
+++ b/packaging/package.sh
@@ -36,6 +36,7 @@ Optional arguments:
    -s, --simulator string                  Build package for Simulator 
("default"|"DEFAULT"|"simulator"|"SIMULATOR") (default "default")
    -b, --brand string                      Set branding to be used in package 
name (it will override any branding string in POM version)
    -T, --use-timestamp                     Use epoch timestamp instead of 
SNAPSHOT in the package name (if not provided, use "SNAPSHOT")
+   -t --templates                          Passes necessary flag to package 
the required templates. Comma separated string - kvm,xen,vmware,ovm,hyperv
 
 Other arguments:
    -h, --help                              Display this help message and exit
@@ -44,6 +45,7 @@ Examples:
    package.sh --distribution centos7
    package.sh --distribution centos7 --pack oss
    package.sh --distribution centos7 --pack noredist
+   package.sh --distribution centos7 --pack noredist -t "kvm,xen"
    package.sh --distribution centos7 --release 42
    package.sh --distribution centos7 --pack noredist --release 42
 
@@ -143,6 +145,16 @@ function packaging() {
         fi
     fi
 
+    DEFTEMP="-D_temp ''"
+    if [ "$TEMPLATES" != "" ]; then
+      if [[ ",$TEMPLATES," = *",all,"* ]]; then
+        DEFTEMP="-D_temp '-Dsystemvm-kvm -Dsystemvm-xen -Dsystemvm-vmware'"
+      else
+        TEMP=-Dsystemvm-"${TEMPLATES//,/" -Dsystemvm-"}"
+        DEFTEMP="-D_temp ${TEMP}"
+      fi
+    fi
+
     DEFFULLVER="-D_fullver $VERSION"
     DEFVER="-D_ver $REALVER"
 
@@ -161,7 +173,7 @@ function packaging() {
     echo ". executing rpmbuild"
     cp "$PWD/$DISTRO/cloud.spec" "$RPMDIR/SPECS"
 
-    (cd "$RPMDIR"; rpmbuild --define "_topdir ${RPMDIR}" "${DEFVER}" 
"${DEFFULLVER}" "${DEFREL}" ${DEFPRE+"$DEFPRE"} ${DEFOSSNOSS+"$DEFOSSNOSS"} 
${DEFSIM+"$DEFSIM"} -bb SPECS/cloud.spec)
+    (cd "$RPMDIR"; rpmbuild --define "_topdir ${RPMDIR}" "${DEFVER}" 
"${DEFFULLVER}" "${DEFREL}" ${DEFPRE+"$DEFPRE"} ${DEFOSSNOSS+"$DEFOSSNOSS"} 
${DEFSIM+"$DEFSIM"} ${DEFTEMP+"$DEFTEMP"} -bb SPECS/cloud.spec)
     if [ $? -ne 0 ]; then
         if [ "$USE_TIMESTAMP" == "true" ]; then
             (cd $PWD/../; git reset --hard)
@@ -246,6 +258,11 @@ while [ -n "$1" ]; do
             shift 1
             ;;
 
+        -t | --templates)
+            TEMPLATES=$2
+            shift 1
+            ;;
+
         -*)
             unrecognized_flags="${unrecognized_flags}$1 "
             shift 1
diff --git a/packaging/suse15/cloud.spec b/packaging/suse15/cloud.spec
index 66010c5..d6be798 100644
--- a/packaging/suse15/cloud.spec
+++ b/packaging/suse15/cloud.spec
@@ -202,6 +202,11 @@ if [ "%{_sim}" == "SIMULATOR" -o "%{_sim}" == "simulator" 
] ; then
    FLAGS="$FLAGS -Dsimulator"
 fi
 
+if [ \"%{_temp}\" != "" ]; then
+    echo "Adding flags to package requested templates"
+    FLAGS="$FLAGS `rpm --eval %{?_temp}`"
+fi
+
 mvn -Psystemvm,developer $FLAGS clean package
 cd ui && npm install && npm run build && cd ..
 

Reply via email to