Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/releng
diff options
context:
space:
mode:
authorEike Stepper2011-06-13 05:17:39 +0000
committerEike Stepper2011-06-13 05:17:39 +0000
commitecad417b8c7c2f4d1273f232d1b4568d201b766d (patch)
treeeef940a51c3271c3829109c38d36e2f869106267 /releng
parent5422ad16e867fd642c16a2f9ea742859a1f85631 (diff)
downloadcdo-ecad417b8c7c2f4d1273f232d1b4568d201b766d.tar.gz
cdo-ecad417b8c7c2f4d1273f232d1b4568d201b766d.tar.xz
cdo-ecad417b8c7c2f4d1273f232d1b4568d201b766d.zip
Diffstat (limited to 'releng')
-rw-r--r--releng/org.eclipse.emf.cdo.releng/promotion/bootstrap.ant10
-rw-r--r--releng/org.eclipse.emf.cdo.releng/promotion/java/org/eclipse/emf/cdo/releng/promoter/Promoter.java60
-rw-r--r--releng/org.eclipse.emf.cdo.releng/promotion/promote.sh20
3 files changed, 56 insertions, 34 deletions
diff --git a/releng/org.eclipse.emf.cdo.releng/promotion/bootstrap.ant b/releng/org.eclipse.emf.cdo.releng/promotion/bootstrap.ant
index b08894888b..7b65e38724 100644
--- a/releng/org.eclipse.emf.cdo.releng/promotion/bootstrap.ant
+++ b/releng/org.eclipse.emf.cdo.releng/promotion/bootstrap.ant
@@ -1,8 +1,14 @@
<?xml version="1.0"?>
-<project name="bootstrapPromoter" default="bootstrap">
+<project name="bootstrap" default="bootstrap">
<target name="bootstrap">
- <echo message="Checking ${jobName} builds: ${lastBuildNumber} --> ${nextBuildNumber}" />
+ <java classname="org.eclipse.emf.cdo.releng.promoter.Promoter" dir="${promotionWorkDir}" fork="true">
+ <classpath path="classes" />
+ <arg value="${hudsonJobsDir}" />
+ <arg value="${jobName}" />
+ <arg value="${lastBuildNumber}" />
+ <arg value="${nextBuildNumber}" />
+ </java>
</target>
</project>
diff --git a/releng/org.eclipse.emf.cdo.releng/promotion/java/org/eclipse/emf/cdo/releng/promoter/Promoter.java b/releng/org.eclipse.emf.cdo.releng/promotion/java/org/eclipse/emf/cdo/releng/promoter/Promoter.java
index cee70d6580..256a7a7e02 100644
--- a/releng/org.eclipse.emf.cdo.releng/promotion/java/org/eclipse/emf/cdo/releng/promoter/Promoter.java
+++ b/releng/org.eclipse.emf.cdo.releng/promotion/java/org/eclipse/emf/cdo/releng/promoter/Promoter.java
@@ -10,50 +10,64 @@
*/
package org.eclipse.emf.cdo.releng.promoter;
-import java.io.FileOutputStream;
+import java.io.File;
import java.io.IOException;
-import java.io.PrintStream;
/**
* @author Eike Stepper
*/
public class Promoter
{
+ private static String hudsonJobsDir;
+
+ private static String jobName;
+
public static void main(String[] args) throws IOException
{
- if (args.length != 3)
+ if (args.length != 4)
{
- System.err
- .println("Specify exactly three arguments, e.g. GenerateBuildQualifier R 2011-06-11_09-55-11 /path/to/build-qualifier.properties");
+ System.err.println("Specify exactly four arguments, "
+ + "e.g. Promoter /path/to/hudson/jobs hudson-job-name last-build-number next-build-number");
System.exit(2);
}
- String buildType = args[0];
- String buildTimestamp = args[1];
- String buildQualifier = generateBuildQualifier(buildType, buildTimestamp);
+ hudsonJobsDir = args[0];
+ jobName = args[1];
- String fileName = args[2];
- FileOutputStream out = null;
+ int lastBuildNumber = Integer.parseInt(args[2]);
+ int nextBuildNumber = Integer.parseInt(args[3]);
- try
+ File hudsonJob = new File(hudsonJobsDir, jobName);
+ File builds = new File(hudsonJob, "builds");
+ for (int buildNumber = lastBuildNumber; buildNumber < nextBuildNumber; buildNumber++)
{
- out = new FileOutputStream(fileName);
- PrintStream stream = new PrintStream(out);
- stream.println("build.qualifier=" + buildQualifier);
- stream.flush();
- }
- finally
- {
- if (out != null)
+ File build = new File(builds, String.valueOf(buildNumber));
+ if (build.exists())
{
- out.close();
+ promote(build);
}
}
+
+ // FileOutputStream out = null;
+ //
+ // try
+ // {
+ // out = new FileOutputStream(fileName);
+ // PrintStream stream = new PrintStream(out);
+ // stream.println("build.qualifier=" + buildQualifier);
+ // stream.flush();
+ // }
+ // finally
+ // {
+ // if (out != null)
+ // {
+ // out.close();
+ // }
+ // }
}
- private static String generateBuildQualifier(String buildType, String buildTimestamp)
+ private static void promote(File build)
{
- return buildType + buildTimestamp.substring(0, 4) + buildTimestamp.substring(5, 7)
- + buildTimestamp.substring(8, 10) + "-" + buildTimestamp.substring(11, 13) + buildTimestamp.substring(14, 16);
+ System.out.println("Promoting " + jobName + "#" + build.getName());
}
}
diff --git a/releng/org.eclipse.emf.cdo.releng/promotion/promote.sh b/releng/org.eclipse.emf.cdo.releng/promotion/promote.sh
index 744abedb8b..d399b8fdec 100644
--- a/releng/org.eclipse.emf.cdo.releng/promotion/promote.sh
+++ b/releng/org.eclipse.emf.cdo.releng/promotion/promote.sh
@@ -1,17 +1,18 @@
#!/usr/bin/env bash
set -e
-promotionDir=~/promotion
-jobsDir=$promotionDir/jobs
+promotionWorkDir=~/promotion
-ant=/shared/common/apache-ant-1.7.1/bin/ant
+HUDSON_JOBS_DIR=/shared/jobs
JAVA_HOME=/shared/common/jdk-1.6.0_10
+ANT=/shared/common/apache-ant-1.7.1/bin/ant
CriticalSection ()
{
- for jobName in `ls "$jobsDir"`
+ localJobsDir=$promotionWorkDir/jobs
+ for jobName in `ls "$localJobsDir"`
do
- jobDir=$jobsDir/$jobName
+ jobDir=$localJobsDir/$jobName
file=$jobDir/nextBuildNumber
if [ -f "$file" ]
@@ -21,12 +22,13 @@ CriticalSection ()
lastBuildNumber=1
fi
- nextBuildNumber=`cat "/shared/jobs/$jobName/nextBuildNumber"`
+ nextBuildNumber=`cat "$HUDSON_JOBS_DIR/$jobName/nextBuildNumber"`
if [ "$nextBuildNumber" != "$lastBuildNumber" ]
then
echo "Checking $jobName for builds that need promotion..."
- "$ant" -f "$promotionDir/bootstrap.ant" \
- "-DjobDir=$jobDir" \
+ "$ANT" -f "$promotionWorkDir/bootstrap.ant" \
+ "-DhudsonJobsDir=$HUDSON_JOBS_DIR" \
+ "-DpromotionWorkDir=$promotionWorkDir" \
"-DjobName=$jobName" \
"-DlastBuildNumber=$lastBuildNumber" \
"-DnextBuildNumber=$nextBuildNumber"
@@ -36,7 +38,7 @@ CriticalSection ()
done
}
-lockFile=$promotionDir/promote.lock
+lockFile=$promotionWorkDir/promote.lock
if ( set -o noclobber; echo "$$" > "$lockFile" ) 2> /dev/null;
then
trap 'rm -f "$lockFile"; exit $?' INT TERM EXIT

Back to the top