Add releng scripts for publishing from JIPP.
Change-Id: I543c8c67c7353ac1470615499dc03ed1d9410ed3
Signed-off-by: Dennis Wagelaar <dwagelaar@gmail.com>
diff --git a/releng/org.eclipse.m2m.atl.update/downloads.sh b/releng/org.eclipse.m2m.atl.update/downloads.sh
new file mode 100644
index 0000000..3adb92f
--- /dev/null
+++ b/releng/org.eclipse.m2m.atl.update/downloads.sh
@@ -0,0 +1,69 @@
+#!/bin/bash -xv
+#*******************************************************************************
+# Copyright (c) 2018, 2019 Willink Transformations and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v2.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v20.html
+#
+# Contributors:
+# E.D.Willink - initial API and implementation
+# Dennis Wagelaar
+#*******************************************************************************
+#
+# Promote the PUBLISH__URL to the downloads 'page'.
+#
+# -u PUBLISH__URL The zip to be published e.g. https://ci.eclipse.org/ocl/job/ocl-master/38/artifact/releng/org.eclipse.ocl.releng.build-site/target/org.eclipse.ocl-6.5.0.v20171021-1702.zip
+# -v PUBLISH__VERSION Unqualified version e.g. 6.5.0
+# -t PUBLISH__BUILD_T Build type N/I/S/R, blank suppresses promotion
+# -q PUBLISH__QUALIFIER Version qualifier e.g. v20171020-1234
+# -a PUBLISH__ALIAS Non blank to use alias as part of final name
+# -j PUBLISH__JAVADOC The optional Javadoc zip to be published e.g. https://ci.eclipse.org/ocl/job/ocl-master/38/artifact/releng/org.eclipse.ocl.releng.build-site/target/OCL-javadoc.zip
+# -p PUBLISH__PDFDOC The optional PDF doc to be published e.g. https://ci.eclipse.org/ocl/job/ocl-master/38/artifact/releng/org.eclipse.ocl.releng.build-site/target/ocl.pdf
+#
+dropsFolder="/home/data/httpd/download.eclipse.org/mmt/atl/downloads/drops/"
+group="modeling.mmt.atl"
+zipPrefix="m2m-atl-Update-"
+
+while getopts u:v:t:q:a:j:p: option
+do
+case "${option}"
+in
+u) PUBLISH__URL=${OPTARG};;
+v) PUBLISH__VERSION=${OPTARG};;
+t) PUBLISH__BUILD_T=${OPTARG};;
+q) PUBLISH__QUALIFIER=${OPTARG};;
+a) PUBLISH__ALIAS=${OPTARG};;
+j) PUBLISH__JAVADOC=${OPTARG};;
+p) PUBLISH__PDFDOC=${OPTARG};;
+esac
+done
+
+if [ -n "${PUBLISH__BUILD_T}" ]
+then
+
+ tQualifier="${PUBLISH__BUILD_T}${PUBLISH__QUALIFIER:1:8}${PUBLISH__QUALIFIER:10:4}"
+ versionFolder="${dropsFolder}${PUBLISH__VERSION}/${tQualifier}"
+ if [ ! -d "${versionFolder}" ]
+ then
+ mkdir -p ${versionFolder}
+ fi
+
+ fileStem="${tQualifier}"
+ if [ -n "${PUBLISH__ALIAS}" ]
+ then
+ fileStem=${PUBLISH__ALIAS}
+ fi
+ zipFile="${zipPrefix}${fileStem}.zip"
+
+ pushd ${versionFolder}
+ curl -s -k ${PUBLISH__URL} > ${zipFile}
+ md5sum -b ${zipFile} > ${zipFile}.md5
+ sha512sum -b ${zipFile} > ${zipFile}.sha1
+ # make sure permissions are for the intended group
+ chgrp -R ${group} ${zipFile} ${zipFile}.md5 ${zipFile}.sha1
+ chmod -R g+w ${zipFile} ${zipFile}.md5 ${zipFile}.sha1
+ popd
+
+fi
+
diff --git a/releng/org.eclipse.m2m.atl.update/pom.xml b/releng/org.eclipse.m2m.atl.update/pom.xml
index e3c98d9..b4f7625 100644
--- a/releng/org.eclipse.m2m.atl.update/pom.xml
+++ b/releng/org.eclipse.m2m.atl.update/pom.xml
@@ -26,6 +26,24 @@
<version>4.2.0-SNAPSHOT</version>
<build>
+ <resources>
+ <resource>
+ <directory>.</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>publisher.properties</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>.</directory>
+ <filtering>false</filtering>
+ <includes>
+ <include>downloads.sh</include>
+ <include>index.html</include>
+ <include>updates.sh</include>
+ </includes>
+ </resource>
+ </resources>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
@@ -33,61 +51,25 @@
<version>${tycho-version}</version>
<configuration>
<createArtifactRepository>true</createArtifactRepository>
- <finalName>${project.artifactId}</finalName>
+ <finalName>${project.groupId}-${unqualifiedVersion}.${buildId}</finalName>
<compress>true</compress>
+ <repositoryName>ATL ${unqualifiedVersion}.${buildId}</repositoryName>
</configuration>
</plugin>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
- <id>copy-resources</id>
- <phase>validate</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <configuration>
- <outputDirectory>${basedir}/target/repository</outputDirectory>
- <resources>
- <resource>
- <directory>.</directory>
- <includes>
- <include>index.html</include>
- <include>web/*</include>
- </includes>
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>prepare_promotion</id>
<phase>verify</phase>
<goals>
- <goal>run</goal>
+ <goal>resources</goal>
</goals>
- <configuration>
- <tasks>
- <!-- create a properties file for promotion process -->
- <mkdir dir="${project.build.directory}/promotion" />
- <echo
- file="${project.build.directory}/promotion/promote.properties"
- message="#ATL promotion process.${line.separator}build.alias=${BUILD_ALIAS}${line.separator}build.qualifier=${env.BUILD_TYPE}${buildQualifier}${line.separator}version=${unqualifiedVersion}" />
- <!-- copy necessary scripts to archive location -->
- <copy file="p2.xsl"
- todir="${project.build.directory}/promotion" />
- <copy file="promoter.xml"
- todir="${project.build.directory}/promotion" />
- <copy file="addDownloadStats.xsl"
- todir="${project.build.directory}/promotion" />
- </tasks>
- </configuration>
</execution>
</executions>
+ <configuration>
+ <outputDirectory>${project.build.directory}</outputDirectory>
+ </configuration>
</plugin>
</plugins>
</build>
diff --git a/releng/org.eclipse.m2m.atl.update/publisher.properties b/releng/org.eclipse.m2m.atl.update/publisher.properties
new file mode 100644
index 0000000..34ddd97
--- /dev/null
+++ b/releng/org.eclipse.m2m.atl.update/publisher.properties
@@ -0,0 +1,16 @@
+# ATL publisher properties for use by the promoter job:
+#
+# rm -f downloads.sh updates.sh
+# curl -s -k ${PUBLISH__DOWNLOADS_SH} > downloads.sh
+# curl -s -k ${PUBLISH__UPDATES_SH} > updates.sh
+# chmod +x downloads.sh updates.sh
+# bash -ex downloads.sh
+# bash -ex updates.sh
+#
+PUBLISH__ALIAS=${BUILD_ALIAS}
+PUBLISH__BUILD_T=${buildType}
+PUBLISH__DOWNLOADS_SH=${env.JOB_URL}${env.BUILD_NUMBER}/artifact/releng/org.eclipse.m2m.atl.update/target/downloads.sh
+PUBLISH__QUALIFIER=${buildId}
+PUBLISH__UPDATES_SH=${env.JOB_URL}${env.BUILD_NUMBER}/artifact/releng/org.eclipse.m2m.atl.update/target/updates.sh
+PUBLISH__URL=${env.JOB_URL}${env.BUILD_NUMBER}/artifact/releng/org.eclipse.m2m.atl.update/target/${project.groupId}-${unqualifiedVersion}.${buildId}.zip
+PUBLISH__VERSION=${unqualifiedVersion}
diff --git a/releng/org.eclipse.m2m.atl.update/updates.sh b/releng/org.eclipse.m2m.atl.update/updates.sh
new file mode 100644
index 0000000..6c3d71f
--- /dev/null
+++ b/releng/org.eclipse.m2m.atl.update/updates.sh
@@ -0,0 +1,144 @@
+#!/bin/bash -xv
+#*******************************************************************************
+# Copyright (c) 2018, 2019 Willink Transformations and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v2.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v20.html
+#
+# Contributors:
+# E.D.Willink - initial API and implementation
+# Dennis Wagelaar
+#*******************************************************************************
+#
+# Promote the PUBLISH__URL to an updates repository.
+#
+# -u PUBLISH__URL The zip to be published e.g. https://ci.eclipse.org/ocl/job/ocl-master/38/artifact/releng/org.eclipse.ocl.releng.build-site/target/org.eclipse.ocl-6.5.0.v20171021-1702.zip
+# -v PUBLISH__VERSION Unqualified version e.g. 6.5.0
+# -t PUBLISH__BUILD_T Build type N/I/S/R, blank suppresses promotion
+# -q PUBLISH__QUALIFIER Version qualifier e.g. v20171020-1234
+#
+updatesFolder="/home/data/httpd/download.eclipse.org/mmt/atl/updates/"
+group="modeling.mmt.atl"
+localZip="atl.zip"
+projectRepoName="ATL"
+manageComposite="/shared/common/apache-ant-latest/bin/ant -f /shared/modeling/tools/promotion/manage-composite.xml"
+externalUpdatesFolder="https://download.eclipse.org/mmt/atl/updates/"
+
+while getopts u:v:t:q: option
+do
+case "${option}"
+in
+u) PUBLISH__URL=${OPTARG};;
+v) PUBLISH__VERSION=${OPTARG};;
+t) PUBLISH__BUILD_T=${OPTARG};;
+q) PUBLISH__QUALIFIER=${OPTARG};;
+esac
+done
+
+if [ -n "${PUBLISH__BUILD_T}" ]
+then
+
+ tQualifier="${PUBLISH__BUILD_T}${PUBLISH__QUALIFIER:1:8}${PUBLISH__QUALIFIER:10:4}"
+ if [ "${PUBLISH__BUILD_T}" = "N" ]
+ then
+ buildFolder="${updatesFolder}nightly"
+ buildRepoName="Nightly"
+ latestRelativeReference="../${PUBLISH__VERSION}"
+ elif [ "${PUBLISH__BUILD_T}" = "I" ]
+ then
+ buildFolder="${updatesFolder}interim"
+ buildRepoName="Interim"
+ latestRelativeReference="../${PUBLISH__VERSION}"
+ elif [ "${PUBLISH__BUILD_T}" = "S" ]
+ then
+ buildFolder="${updatesFolder}milestones"
+ buildRepoName="Milestones"
+ latestRelativeReference="../${PUBLISH__VERSION}/${tQualifier}"
+ elif [ "${PUBLISH__BUILD_T}" = "R" ]
+ then
+ buildFolder="${updatesFolder}releases"
+ buildRepoName="Releases"
+ latestRelativeReference="../${PUBLISH__VERSION}"
+ else
+ buildFolder="${updatesFolder}other"
+ latestRelativeReference="../${PUBLISH__VERSION}"
+ buildRepoName="Other"
+ fi
+
+ if [ ! -d "${buildFolder}" ]
+ then
+ mkdir -p ${buildFolder}
+ fi
+
+ pushd ${buildFolder}
+ if [ ! -d "${PUBLISH__VERSION}" ]
+ then
+ mkdir ${PUBLISH__VERSION}
+ versionCompositeName="${projectRepoName} ${buildRepoName} Repository"
+ ${manageComposite} add -Dchild.repository=${PUBLISH__VERSION} -Dcomposite.name="${versionCompositeName}"
+ fi
+
+ if [ "${PUBLISH__BUILD_T}" = "N" ]
+ then
+ curl -s -k ${PUBLISH__URL} > ${localZip}
+ unzip -ou ${localZip} -d new${PUBLISH__VERSION}
+ chgrp -R ${group} new${PUBLISH__VERSION}
+ chmod -R g+w new${PUBLISH__VERSION}
+ mv ${PUBLISH__VERSION} old${PUBLISH__VERSION}
+ mv new${PUBLISH__VERSION} ${PUBLISH__VERSION}
+ rm -rf old${PUBLISH__VERSION} ${localZip}
+ elif [ "${PUBLISH__BUILD_T}" = "I" ]
+ then
+ curl -s -k ${PUBLISH__URL} > ${localZip}
+ unzip -ou ${localZip} -d new${PUBLISH__VERSION}
+ chgrp -R ${group} new${PUBLISH__VERSION}
+ chmod -R g+w new${PUBLISH__VERSION}
+ mv ${PUBLISH__VERSION} old${PUBLISH__VERSION}
+ mv new${PUBLISH__VERSION} ${PUBLISH__VERSION}
+ rm -rf old${PUBLISH__VERSION} ${localZip}
+ elif [ "${PUBLISH__BUILD_T}" = "S" ]
+ then
+ pushd ${buildFolder}/${PUBLISH__VERSION}
+
+ versionFolder="${buildFolder}/${tQualifier}"
+ if [ ! -d "${tQualifier}" ]
+ then
+ mkdir ${tQualifier}
+ fi
+
+ curl -s -k ${PUBLISH__URL} > ${localZip}
+ unzip ${localZip} -d ${tQualifier}
+ rm ${localZip}
+
+ chgrp -R ${group} ${tQualifier}
+ chmod -R g+w ${tQualifier}
+ ${manageComposite} add -Dchild.repository=${tQualifier} -Dcomposite.name="${projectRepoName} ${PUBLISH__VERSION} ${buildRepoName} Repository"
+ popd
+ elif [ "${PUBLISH__BUILD_T}" = "R" ]
+ then
+ curl -s -k ${PUBLISH__URL} > ${localZip}
+ unzip -ou ${localZip} -d new${PUBLISH__VERSION}
+ chgrp -R ${group} new${PUBLISH__VERSION}
+ chmod -R g+w new${PUBLISH__VERSION}
+ mv ${PUBLISH__VERSION} old${PUBLISH__VERSION}
+ mv new${PUBLISH__VERSION} ${PUBLISH__VERSION}
+ rm -rf old${PUBLISH__VERSION} ${localZip}
+
+ fi
+
+ mkdir ${buildFolder}/newlatest
+ pushd ${buildFolder}/newlatest
+ ${manageComposite} add -Dchild.repository=${latestRelativeReference} -Dcomposite.name="${projectRepoName} Latest ${PUBLISH__VERSION} ${buildRepoName} Repository"
+ popd
+ if [ -d "latest" ]
+ then
+ mv latest oldlatest
+ fi
+ mv newlatest latest
+ rm -rf oldlatest
+
+ popd
+
+fi
+