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 <daniel@scclouds.com.br>
Co-authored-by: Pearl Dsilva <pearl1594@gmail.com>
This commit is contained in:
Daniel Augusto Veronezi Salvador 2022-03-17 00:55:27 -03:00 committed by GitHub
parent 6f3c18f3a7
commit c146449ab8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 155 additions and 3 deletions

View File

@ -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>

View File

@ -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 ..

View File

@ -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 ..

View File

@ -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

View File

@ -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 ..