Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPauline DEVILLE2019-08-27 08:37:02 +0000
committerPauline DEVILLE2019-08-28 13:34:55 +0000
commit0b208dd4eb4ec49ebeb0d2e2fc75637c6b074ef7 (patch)
tree2f1ca0e19f8cbb5d316a3a0d7dc662197f832f4c
parent11b40f14d1f7f8615c8a76dbc9585a9f8c1a7ead (diff)
downloadorg.eclipse.papyrus-0b208dd4eb4ec49ebeb0d2e2fc75637c6b074ef7.tar.gz
org.eclipse.papyrus-0b208dd4eb4ec49ebeb0d2e2fc75637c6b074ef7.tar.xz
org.eclipse.papyrus-0b208dd4eb4ec49ebeb0d2e2fc75637c6b074ef7.zip
Bug 549266 - [Releng] maintenance patch
- Update promote scripts - revert change on https://git.eclipse.org/r/#/c/146067/5/releng/main/site/pom.xml Change-Id: I71d49900fb4457e0bea56076c1f7f705c2191ca2 Signed-off-by: Quentin Le Menez <quentin.lemenez@cea.fr> Signed-off-by: Pauline DEVILLE <pauline.deville@cea.fr>
-rw-r--r--releng/main/site/pom.xml2
-rw-r--r--releng/toolkit/server/manualPromote-master.sh3
-rwxr-xr-xreleng/toolkit/server/nightly.sh250
3 files changed, 209 insertions, 46 deletions
diff --git a/releng/main/site/pom.xml b/releng/main/site/pom.xml
index 65b63a44a1f..85e9ab6897b 100644
--- a/releng/main/site/pom.xml
+++ b/releng/main/site/pom.xml
@@ -50,7 +50,7 @@
<!-- p2 update site transitive dependencies repositories -->
<associateSites>
<!-- Oxygen orbit bundles for batik 1.6.0 -->
- <site>http://download.eclipse.org/tools/orbit/downloads/drops/S20190709113129/repository/</site>
+ <site>http://download.eclipse.org/tools/orbit/downloads/drops/R20180206163158/repository/</site>
</associateSites>
</configuration>
</execution>
diff --git a/releng/toolkit/server/manualPromote-master.sh b/releng/toolkit/server/manualPromote-master.sh
index f8456744f3e..42db6bdfd05 100644
--- a/releng/toolkit/server/manualPromote-master.sh
+++ b/releng/toolkit/server/manualPromote-master.sh
@@ -67,8 +67,7 @@ while [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; do
done
echo "updateSite (e.g. \"nightly/juno\", \"milestones/0.9/M5\", \"releases/indigo/0.8.1\") : "
-while [[ ! "$updateSite" =~ ^(tmpTest|releases/(oxygen|photon)/[0-9]+\.[0-9]+\.[0-9]+|milestones/[0-9]+\.[0-9]+/(I[1-7]|M[1-7]|RC[1-9]|SR[1-9]_RC[1-
-9])[a-z]?|nightly/(oxygen|photon))$ ]]; do
+while [[ ! "$updateSite" =~ ^(tmpTest|releases/(oxygen|photon)/[0-9]+\.[0-9]+\.[0-9]+|milestones/[0-9]+\.[0-9]+/(I[1-7]|M[1-7]|RC[1-9]|SR[1-9]_RC[1-9])[a-z]?|nightly/(oxygen|photon))$ ]]; do
echo -n "? "
read updateSite
done
diff --git a/releng/toolkit/server/nightly.sh b/releng/toolkit/server/nightly.sh
index 0c7a1409fb0..af6e97e4d5e 100755
--- a/releng/toolkit/server/nightly.sh
+++ b/releng/toolkit/server/nightly.sh
@@ -1,60 +1,224 @@
-# This script is made to promote nightly builds of Papyrus
+#!/bin/sh
+
+###############################################################################
+# Copyright (c) 2012-2019 CEA LIST and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+#
+# Contributors:
+# Nicolas Bros (Mia-Software) - Initial API and implementation
+# Quentin Le menez (CEA LIST) - Support for the new Papyrus architecture
+#
+###############################################################################
+
+DROPS_DIR=/home/data/httpd/download.eclipse.org/modeling/mdt/papyrus/downloads/drops
+ARCHIVE_DIR=/home/data/httpd/archive.eclipse.org/modeling/mdt/papyrus/downloads/drops
+ARCHIVE_INDEX=/home/data/httpd/archive.eclipse.org/modeling/mdt/papyrus/downloads/index.html
+UPDATE_SITES_DIR=/home/data/httpd/download.eclipse.org/modeling/mdt/papyrus/updates
+ZIP_PREFIX="Papyrus-Update-"
+PROMOTE_FUNCTIONS_SH=/opt/public/modeling/mdt/papyrus/promoteFunctions.sh
+ADD_TO_COMPOSITE_SH=/opt/public/modeling/mdt/papyrus/addToComposite.sh
+
+# constants required by promoteFunctions.sh
+#export ADD_DOWNLOAD_STATS=/opt/public/modeling/mdt/papyrus/addDownloadStats.sh
+
+# enable the job defined parameters
+env
+
+# include promote functions
+source "$PROMOTE_FUNCTIONS_SH"
+
+# get the nightly identifier
+# org.eclipse.papyrus.sdk.feature_4.2.0.201810030243.jar yields 4.2.0_201810030243N && 4.2.0
+
+nightlyID () {
+ sdkJar="$(find ${HOME}/.jenkins/jobs/$1/lastSuccessful/archive/repository/features/ -name "org.eclipse.papyrus.sdk.feature_*.jar" | awk -F "sdk.feature_" '{ print $2}' | awk -F ".jar" '{ print $1}')"
+ version="$(echo $sdkJar | awk '{match($1,"[0-9]+.[0-9]+.[0-9]",a)}END{print a[0]}')"
+ timestamp="$(echo $sdkJar | awk 'match($0,/[0-9]+$/) {print substr($0,RSTART,RLENGTH)}')"
+ echo $version"_"$timestamp"N"
+}
+
+versionID () {
+ sdkJar="$(find ${HOME}/.jenkins/jobs/$1/lastSuccessful/archive/repository/features/ -name "org.eclipse.papyrus.sdk.feature_*.jar" | awk -F "sdk.feature_" '{ print $2}' | awk -F ".jar" '{ print $1}')"
+ version="$(echo $sdkJar | awk '{match($1,"[0-9]+.[0-9]+.[0-9]",a)}END{print a[0]}')"
+ echo "$version"
+}
+
+getLastSuccessfulBuildNumbers () {
+ jobName="Papyrus-$1-Toolsmiths"
+ # We need to go from the bottom of the chain to get a full chain
+ echo "$(curl https://ci.eclipse.org/papyrus/job/$jobName/lastBuild/api/xml?depth=1 | awk -F "<upstreamBuild>" '{print $2}' | awk -F "</upstreamBuild>" '{print $1}'):$(curl https://ci.eclipse.org/papyrus/job/$jobName/lastBuild/api/xml?depth=1 | awk -F "<id>" '{print $2}' | awk -F "</id>" '{print $1}')"
+}
-########### Job parameters ###########
-#The specific localization
-remoteRoot="/home/data/httpd/download.eclipse.org"
-papyrusRoot="modeling/mdt/papyrus"
-nightlyRoot="updates/nightly"
-jobName=$1
-#jobName="Papyrus-Oxygen"
-eclipseTarget=$2
-#eclipseTarget="oxygen"
+# ============================== USER PARAMETERS ==============================
-#The localization of the local build target
-targetResults="archive/repository"
-echo "targetResults: $targetResults"
+echo "-------------------- initialize parameters --------------------"
+#echo "branchName: $branchName"
+#echo "mainBuildNumber: $mainBuildNumber"
+#echo "toolsmithsBuildNumber: $toolsmithsBuildNumber"
+#echo "testsBuildNumber: $testsBuildNumber"
+#echo "version: $version"
+#echo "updateSite: $updateSite"
+
+branchName=$branchName
+mainBuildNumber=$mainBuildNumber
+toolsmithsBuildNumber=$toolsmithsBuildNumber
+if [[ "$mainBuildNumber" =~ "0" || "$toolsmithsBuildNumber" =~ "0" ]] ; then
+ IFS=":"
+ read mainBuildNumber toolsmithsBuildNumber <<< "$(getLastSuccessfulBuildNumbers $branchName)"
+fi
+
+testsBuildNumber=$testsBuildNumber
+version=$version
+if [[ "$version" =~ "0" ]] ; then
+ read version <<< "$(versionID "Papyrus-$branchName")"
+fi
+updateSite=$updateSite
-########### Compute local build results using buildNumber ###########
-cd ~/.hudson/jobs/$jobName/lastSuccessful
-jobDir=$(pwd -P)
+echo "-------------------- check parameters --------------------"
-echo "last successful build: $jobDir"
+if [[ ! "$branchName" =~ ^(Oxygen|Master)$ ]]; then
+ echo "branchName (e.g. \"Oxygen\", \"Master\")"
+ echo "Canceled."; exit 1
+fi
-localResults=${jobDir}/${targetResults}
-echo "localResults: ${localResults}"
+if [[ ! "$mainBuildNumber" =~ ^[0-9]+$ || "$mainBuildNumber" < 1 ]]; then
+ echo "mainBuildNumber (the number of the \"Papyrus-Master\" Hudson build from which to publish the main Papyrus plug-ins)"
+ echo "Canceled."; exit 1
+fi
+if [[ ! "$toolsmithsBuildNumber" =~ ^[0-9]+$ || "$toolsmithsBuildNumber" < 1 ]]; then
+ echo "toolsmithsBuildNumber (the number of the \"Papyrus-Master-Toolsmiths\" Hudson build from which to publish the toolsmiths Papyrus plug-ins, or 0 to not publish)"
+ echo "Canceled."; exit 1
+fi
-########### Promote Nightly ###########
-destination=$remoteRoot/$papyrusRoot/$nightlyRoot/$eclipseTarget
-echo "Destination: $destination"
+if [[ ! "$testsBuildNumber" =~ ^[0-9]+$ || "$testsBuildNumber" < 0 ]]; then
+ echo "testsBuildNumber (the number of the \"Papyrus-Master-Tests\" Hudson build from which to publish the test results, or 0 to not publish)"
+ echo "Canceled."; exit 1
+fi
-#Clean the destination folder if exists, make it if does not
-if [ -d $destination ];
- then
- echo "Cleaning the $destination folder"
- rm -rf ${destination}/*
- else
- mkdir -p $destination
+updateSiteDir=""
+if [[ ! "$updateSite" =~ ^(nightly/(oxygen|photon|master)|milestones/[0-9]+\.[0-9]+/(I[1-7]|M[1-7]|RC[1-9]|SR[1-9]_RC[1-9])[a-z]?)$ ]]; then
+ echo "nightly (e.g. \"nightly/master\"), milestone (e.g. \"milestones/0.9/M5\" or \"milestones/0.9/M5a\")"
+ echo "Canceled."; exit 1
+elif [[ "$updateSite" =~ ^(nightly/(oxygen|photon|master))$ ]]; then
+ updateSiteDir="$UPDATE_SITES_DIR/$updateSite/$(nightlyID "Papyrus-$branchName")"
+else [[ "$updateSite" =~ ^(milestones/[0-9]+\.[0-9]+/(I[1-7]|M[1-7]|RC[1-9]|SR[1-9]_RC[1-9])[a-z]?)$ ]]
+ updateSiteDir="$UPDATE_SITES_DIR/$updateSite"
fi
-#Go to the artifact directory
-cd $localResults
-echo "Promoting the Nightly to $destination"
+#echo "branchName: $branchName"
+#echo "mainBuildNumber: $mainBuildNumber"
+#echo "toolsmithsBuildNumber: $toolsmithsBuildNumber"
+#echo "testsBuildNumber: $testsBuildNumber"
+#echo "version: $version"
+#echo "updateSite: $updateSite"
+#echo "nightlyID: $(nightlyID "Papyrus-$branchName")"
+#echo "updateSiteDir: $updateSiteDir"
-#Copy the contents onto the temp folder and change the permissions
-cp -a * $destination
+deleteUpdateSite="no"
+if [ -e "$updateSiteDir" ]; then
+ echo "The update site already exists: $updateSiteDir"
+ echo "Canceled."; exit 1
+fi
-########### Set Access Rights ###########
+# from now on, display executed commands
+set -x
+
+dirBefore=$(pwd)
+echo "[$DATE] creating working dir"
+workingDir=$(mktemp -d)
+cd "$workingDir"
+
+# ============================== PUBLISH MAIN ==============================
+nfsURL="" ## Not supported for HIPP builds. Leave the variable since the promote functions are still shared with the Shared Hudson Instance builds
+hudsonURL="https://hudson.eclipse.org/papyrus/job/Papyrus-Master/$mainBuildNumber/artifact/"
+zipName="Papyrus-Main.zip"
+updateZipPrefix="Papyrus-Update"
+getZip "$zipName" "$nfsURL" "$hudsonURL"
+
+mkdir -p "$updateSiteDir"
+
+buildsDir="$DROPS_DIR/$version"
+echo "publishing build (version='$version') to the builds directory '$buildsDir'..."
+unzip -o "$zipName" -d "$buildsDir"
+
+foldersInZip=$(unzip -t "$zipName" | egrep "testing: *[^/]*/ +OK" | sed 's%^ *testing: *\([^/]*\)/ *OK$%\1%')
+[ $(echo "$foldersInZip" | wc -l) == 1 ] || { echo "one directory expected in zip"; exit 1; }
+folderName="$foldersInZip"
+
+updateSiteZipName=$(basename $(ls -1 "$buildsDir/$folderName/${updateZipPrefix}"*.zip))
+unzip -o "$buildsDir/$folderName/${updateSiteZipName}" -d "$updateSiteDir/main"
+
+# create the composite update site
+cat > "$updateSiteDir/compositeArtifacts.xml" <<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<repository name="Papyrus" type="org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository" version="1.0.0">
+ <properties size="1">
+ <property name="p2.timestamp" value="$(date +%s000)"/>
+ </properties>
+ <children size="2">
+ <child location="main"/>
+ <child location="toolsmiths"/>
+ </children>
+</repository>
+EOF
+
+cat > "$updateSiteDir/compositeContent.xml" <<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<repository name="Papyrus" type="org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository" version="1.0.0">
+ <properties size="1">
+ <property name="p2.timestamp" value="$(date +%s000)"/>
+ </properties>
+ <children size="2">
+ <child location="main"/>
+ <child location="toolsmiths"/>
+ </children>
+</repository>
+EOF
+
+#$ADD_DOWNLOAD_STATS "$updateSiteDir/main" "main"
+
+# ============================== PUBLISH TOOLSMITHS ==============================
+if [[ "$toolsmithsBuildNumber" != "0" ]]; then
+ nfsURL="" ## Not supported for HIPP builds. Leave the variable since the promote functions are still shared with the Shared Hudson Instance builds
+ hudsonURL="https://hudson.eclipse.org/papyrus/job/Papyrus-Master-Toolsmiths/$toolsmithsBuildNumber/artifact/"
+ zipName="Papyrus-Toolsmiths.zip"
+ updateZipPrefix="Papyrus-Toolsmiths"
+ getZip "$zipName" "$nfsURL" "$hudsonURL"
+
+ echo "publishing toolsmiths (version='$version') to the builds directory '$buildsDir'..."
+ unzip -o "$zipName" -d "$buildsDir/$folderName"
+
+ foldersInZip=$(unzip -t "$zipName" | egrep "testing: *[^/]*/ +OK" | sed 's%^ *testing: *\([^/]*\)/ *OK$%\1%')
+ [ $(echo "$foldersInZip" | wc -l) == 1 ] || { echo "one directory expected in zip"; exit 1; }
+ folderNameToolsmith="$foldersInZip"
+
+ updateSiteZipName=$(basename $(ls -1 "$buildsDir/$folderName/$folderNameToolsmith/${updateZipPrefix}"*.zip))
+ unzip -o "$buildsDir/$folderName/$folderNameToolsmith/$updateSiteZipName" -d "$updateSiteDir/toolsmiths"
+
+ #$ADD_DOWNLOAD_STATS "$updateSiteDir/toolsmiths" "toolsmiths"
+fi
+
+# ============================== PUBLISH TESTS ==============================
+if [[ "$testsBuildNumber" != "0" ]]; then
+ nfsURL="" ## Not supported for HIPP builds. Leave the variable since the promote functions are still shared with the Shared Hudson Instance builds
+ hudsonURL="https://hudson.eclipse.org/papyrus/job/Papyrus-Master-Tests/$testsBuildNumber/artifact/"
+ zipName="Papyrus-TestResults.zip"
+ getZip "$zipName" "$nfsURL" "$hudsonURL"
+ # unzips under a "testresults" folder under the main build's folder
+ unzip -o "$zipName" -d "$buildsDir/$folderName"
+fi
-# This function sets the acess rights to allow all members of the group to edit the published files
-function setAccessRights() {
- chmod -R 775 "$1"
- chgrp -hR modeling.mdt.papyrus "$1"
-}
-echo "Set access right -R: $destination"
-setAccessRights $destination
+setAccessRights "$buildsDir/$folderName"
+setAccessRights "$updateSiteDir"
-echo "publishing done." \ No newline at end of file
+echo "publishing done."

Back to the top