This commit is contained in:
Rick Falkvinge
2014-09-12 22:24:42 +02:00
4 changed files with 185 additions and 50 deletions
+53
View File
@@ -0,0 +1,53 @@
#!/bin/bash
#Update all files, including this one. Runpos will remain same in possible new version
echo "Checking for updates to packaging process..."
svn update
# Check parameters
if [ "$1" == "release" ]; then
DROPFOLDER=release
echo "Packaging FINISHED RELEASE for super-stable deployments."
elif [ "$1" == "sprint" ]; then
DROPFOLDER=sprint
echo "Packaging END-OF-SPRINT for normal deployments."
elif [ "$1" == "" ]; then
DROPFOLDER=internal
echo "Packaging internal test build."
else
echo "Syntax: repackage-build [sprint|release]"
echo "(No parameter will trigger a build of the internal branch.)"
exit 1;
fi
BUILDID=$(cat ../lastbuild/swarmops/$DROPFOLDER/BuildIdentity.txt | tr -d ' \r')
COMMITID=$(cat ../lastbuild/swarmops/$DROPFOLDER/CommitIdentity.txt | tr -d ' \r')
BUILDID=$(echo $BUILDID | cut -c 1-8)$(echo $COMMITID | cut -c 1-7)
echo ""
echo "Packaging Swarmops, branch '$DROPFOLDER', build $BUILDID."
echo "----------------------------------------------------------------------"
echo ""
./repackage-one frontend $1
./repackage-one backend $1
./repackage-one common $1
echo "Notifying developers that new build has packaged for test/deployment..."
if [ "$DROPFOLDER" == "internal" ]; then
echo "The packages (swarmops-frontend-internal, swarmops-backend-internal) are available from repositories now, and can be tested at http://dev.swarmops.com/ as usual." > deploymsg.txt
echo ""
echo "Last Commit: $(cat ../lastbuild/swarmops/internal/CommitMessage.txt)"
else
echo "NOTE: this is a $DROPFOLDER package bundle. It will deploy automatically to live systems via apt-get upgrade. Yay, we made another sprint!" > deploymsg.txt
fi
# TODO: Add build messages to deploy message, at least for internal build
mail -a "From: Swarmops Builder <builds@swarmops.com>" -s "Swarmops $BUILDID ($DROPFOLDER) packaged." "swarmops.developers@groups.facebook.com" < deploymsg.txt
rm deploymsg.txt
@@ -1,22 +1,36 @@
#!/bin/bash
#Update all files, including this one. Runpos will remain same in possible new version
echo "Checking for updates to packaging..."
svn update
DEPLOYDIR=usr/share/swarmops
# Check parameters
if [ "$2" == "release" ]; then
CONTROLSUFFIX=-release
DROPFOLDER=release
echo "Packaging FINISHED RELEASE for super-stable deployments."
elif [ "$2" == "sprint" ]; then
CONTROLSUFFIX=-sprint
DROPFOLDER=sprint
echo "Packaging END-OF-SPRINT for normal deployments."
else
CONTROLSUFFIX=-internal
DROPFOLDER=internal
if [ "$1" == "extscripts" ]; then
echo "Error: Cannot package external scripts for internal build. Use 'stable'."
exit 1;
fi
fi
if [ "$1" == "frontend" ]; then
echo "Packaging frontend...";
SOURCEDIR=/home/packager/lastbuild/frontend
SOURCEDIR=/home/packager/lastbuild/swarmops/$DROPFOLDER/frontend
TARGETDIR=frontend
PACKAGE=frontend
INCLUDEDB=no
COPYFILES=yes
elif [ "$1" == "backend" ]; then
echo "Packaging backend..."
SOURCEDIR=/home/packager/lastbuild/backend
SOURCEDIR=/home/packager/lastbuild/swarmops/$DROPFOLDER/backend
TARGETDIR=backend
PACKAGE=backend
INCLUDEDB=no
@@ -40,25 +54,20 @@ else
exit 1;
fi
if [ "$2" == "release" ]; then
CONTROLSUFFIX=-release
echo "Packaging FINISHED RELEASE for super-stable deployments."
elif [ "$2" == "sprint" ]; then
CONTROLSUFFIX=-sprint
echo "Packaging END-OF-SPRINT for normal deployments."
else
CONTROLSUFFIX=-internal
if [ "$1" == "extscripts" ]; then
echo "Error: Cannot package external scripts for internal build. Use 'stable'."
exit 1;
fi
fi
PACKAGENAME=$PACKAGE$CONTROLSUFFIX
BUILDIDSOURCE="BuildIdentity.txt"
cp ../lastbuild/frontend/BuildIdentity.txt ./BuildIdentity.txt
cp ../lastbuild/frontend/BuildIdentity.txt ../lastbuild/backend/.
cp ../lastbuild/swarmops/$DROPFOLDER/BuildIdentity.txt ./BuildIdentity.txt
cp ../lastbuild/swarmops/$DROPFOLDER/CommitIdentity.txt ./CommitIdentity.txt
BUILDID=$(cat BuildIdentity.txt | tr -d ' \r')
COMMITID=$(cat CommitIdentity.txt | tr -d ' \r')
BUILDID=$(echo $BUILDID | cut -c 1-8)$(echo $COMMITID | cut -c 1-7)
echo ""
echo "Building package $PACKAGENAME $BUILDID."
echo "----------------------------------------------------------------------"
echo ""
# Delete flag that indicates a new drop is available
#rm /home/packaging/lastbuild/BuildDropped.txt
@@ -123,12 +132,13 @@ else
fi
fi
echo "Converting possible CRLF line endings in scripts to LF-only..."
dos2unix DEBIAN/*
dos2unix etc/init.d/*
echo "Converting CRLF line endings in scripts to LF-only..."
dos2unix -q DEBIAN/*
dos2unix -q etc/init.d/*
echo "Setting build number ($(cat ../$BUILDIDSOURCE | tr -d ' \r'))..."
sed -i "s/--BuildNumber--/$(cat ../$BUILDIDSOURCE | tr -d ' \r')/" DEBIAN/control
echo "Setting build number $BUILDID..."
sed -i "s/--BuildNumber--/$BUILDID/" DEBIAN/control
echo $BUILDID > $DEPLOYDIR/$TARGETDIR/BuildIdentity.txt
# Calculating new checksums
echo "Creating MD5 checksum file..."
@@ -155,18 +165,6 @@ echo "Cleaning up..."
rm swarmops-$PACKAGENAME-latest.deb
rm -rf debian
rm BuildIdentity.txt
rm CommitIdentity.txt
echo "Notifying developers that new build has deployed for test..."
echo "Package swarmops-$PACKAGENAME build $(cat $BUILDIDSOURCE | tr -d ' \r') has been deployed from continuous integration." > deploymsg.txt
echo "" >> deploymsg.txt
echo "The package is available from repositories now, and can be tested at http://dev.swarmops.com/ as usual." >> deploymsg.txt
if [ ! "$2" == "" ]; then
echo "" >> deploymsg.txt
echo "Note that this is a $2 package." >> deploymsg.txt
fi
mail -a "From: Swarmops Builder <builds@swarmops.com>" -s "Swarmops-$PACKAGENAME $(cat $BUILDIDSOURCE | tr -d ' \r') deployed" "swarmops.developers@groups.facebook.com" < deploymsg.txt
rm deploymsg.txt
rm $BUILDIDSOURCE
+18
View File
@@ -0,0 +1,18 @@
#!/bin/bash
# This script is intended to be run as a cron job. It looks for the file
# /home/packager/lastbuild/swarmops/internal/BuildDropped.txt
# and if that file exists, it launches an internal build.
if [ ! -e /home/packager/lastbuild/swarmops/internal/BuildDropped.txt ]; then
exit 0;
fi
# When we get here, a build was dropped, so remove the flag and launch an internal build
rm /home/packager/lastbuild/swarmops/internal/BuildDropped.txt
cd /home/packager/swarmops
./repackage-build
exit 0;
Regular → Executable
+74 -8
View File
@@ -5,41 +5,95 @@
<artifactDirectory>C:\Lab\Swarmops\artifact</artifactDirectory>
<webURL>http://build.swarmops.com/server/auxiliary/project/Swarmops/ViewLatestBuildReport.aspx</webURL>
<sourcecontrol type="svn">
<trunkUrl>svn://repo.swarmops.com/Swarmops/trunk</trunkUrl>
<sourcecontrol type="git">
<repository>git://github.com/Swarmops/Swarmops</repository>
<branch>master</branch>
<cleanUntrackedFiles>true</cleanUntrackedFiles>
<autoGetSource>true</autoGetSource>
<fetchSubmodules>true</fetchSubmodules>
<executable>git</executable>
<tagOnSuccess>false</tagOnSuccess>
<commitBuildModifications>false</commitBuildModifications>
<commitUntrackedFiles>false</commitUntrackedFiles>
<tagCommitMessage>Build {0}</tagCommitMessage>
<tagNameFormat>Build-{0}</tagNameFormat>
<committerName>Swarmops Build</committerName>
<committerEMail>builds@swarmops.com</committerEMail>
<workingDirectory>c:\Lab\Swarmops\build</workingDirectory>
<timeout>180000</timeout>
</sourcecontrol>
<!--<sourcecontrol type="svn">
<trunkUrl>https://github.com/Swarmops/Swarmops/trunk</trunkUrl>
<workingDirectory>C:\Lab\Swarmops\build</workingDirectory>
<cleanCopy>true</cleanCopy>
<timeout>1800000</timeout>
</sourcecontrol>
</sourcecontrol>-->
<triggers>
<intervalTrigger name="continuous" seconds="30" />
<intervalTrigger name="continuous" seconds="60" />
</triggers>
<labeller type="assemblyVersionLabeller">
<major>5</major>
<minor>0</minor>
<revision>0</revision>
<incrementOnFailure>false</incrementOnFailure>
</labeller>
<tasks>
<!-- Clear various temp directories, or MSBuild will vomit -->
<!--<exec>
<executable>cmd.exe</executable>
<buildArgs>/c del /s /q %LocalAppData%\Temp\"Temporary ASP.Net Files"</buildArgs>
</exec>
<exec>
<executable>cmd.exe</executable>
<buildArgs>/c del /s /q C:\Windows\Microsoft.NET\Framework\v4.0.30319\"Temporary ASP.NET Files"</buildArgs>
</exec>-->
<!-- Build backend -->
<msbuild>
<executable>C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</executable>
<executable>C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe</executable>
<workingDirectory>C:\Lab\Swarmops\build</workingDirectory>
<projectFile>Swarmops.sln</projectFile>
<projectFile>Backend\Backend.csproj</projectFile>
<buildArgs>/p:Configuration=Release</buildArgs>
<targets>Build</targets>
<timeout>1200</timeout>
<logger>C:\Program Files (x86)\CruiseControl.NET\server\Rodemeyer.MsBuildToCCnet.dll</logger>
</msbuild>
<!-- Build frontend -->
<msbuild>
<executable>C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe</executable>
<workingDirectory>C:\Lab\Swarmops\build</workingDirectory>
<projectFile>Interface\Interface.csproj</projectFile>
<buildArgs>/p:Configuration=Release</buildArgs>
<targets>Build</targets>
<timeout>1200</timeout>
<logger>C:\Program Files (x86)\CruiseControl.NET\server\Rodemeyer.MsBuildToCCnet.dll</logger>
</msbuild>
<exec>
<executable>C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\aspnet_compiler.exe</executable>
<baseDirectory>C:\Lab\Swarmops\build</baseDirectory>
<buildArgs>-u -v / -p Site5 Site5-Deployment/</buildArgs>
</exec>
<exec>
<executable>C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\aspnet_merge.exe</executable>
<baseDirectory>C:\Lab\Swarmops\build</baseDirectory>
<buildArgs>Site5-Deployment -o Swarmops.Site.dll</buildArgs>
</exec>
<!-- deploy: only on success of all steps above -->
<!-- Deploy: only on success of all steps above -->
<exec>
<executable>cmd.exe</executable>
@@ -48,7 +102,7 @@
<exec>
<executable>cmd.exe</executable>
<buildArgs>/c echo %CCNetLabel% > C:\Lab\Swarmops\build\Backend\bin\Release\BuildIdentity.txt</buildArgs>
<buildArgs>/c git rev-parse HEAD > C:\Lab\Swarmops\build\Site5-Deployment\CommitIdentity.txt</buildArgs>
</exec>
<buildpublisher>
@@ -89,6 +143,13 @@
<buildArgs>/c echo %CCNetLabel% > \\swarmops-dev\builddrop\BuildDropped.txt</buildArgs>
</exec>
<!-- once build is deployed, delete the whole build dir to force a new git clone -->
<!--<exec>
<executable>cmd.exe</executable>
<buildArgs>/c del /s /q C:\Lab\Swarmops\build</buildArgs>
</exec>-->
<!-- Analysis: QA that is not build-breaking: FxCop etc. -->
<!--
<exec>
@@ -115,6 +176,10 @@
<mailhost>192.168.80.204</mailhost>
<users>
<user name="Rick Falkvinge" group="buildmaster" address="swarmops-builds@falkvinge.net" />
<user name="Leif Ershag" group="devs" address="leif@ershag.se" />
<user name="Tom Jeffries" group="devs" address="tom@safe-xchange.com" />
<user name="Christiaan de Die" group="devs" address="christiaan@droiddev.nl" />
<user name="Facebook dev group" group="devs" address="swarmops.developers@groups.facebook.com" />
<!-- <user name="Jörgen Lindell" group="buildmaster" address="jorgen.lindell@gmail.com" /> -->
</users>
<groups>
@@ -122,6 +187,7 @@
<notifications>
<notificationType>Failed</notificationType>
<notificationType>Fixed</notificationType>
<notificationType>Success</notificationType>
</notifications>
</group>
<group name="buildmaster">