提交 8d995cd5 编写于 作者: K kohsuke

Merged revisions 30004 via svnmerge from

https://svn.dev.java.net/svn/hudson/branches/rc

........
  r30004 | kohsuke | 2010-04-12 22:17:28 -0700 (Mon, 12 Apr 2010) | 1 line
  
  reworking the release script
........


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@30028 71c3de6d-444a-0410-be80-ed276b4c234a
上级 b3eb862d
#!/usr/bin/env groovy
/*
Generate index from short/full class name to the javadoc page, in the form of .htaccess.
This serves http://hudson-ci.org/javadoc/byShortName/
Push it as scp .htaccess hudson-ci.org:~/www/hudson-ci.org/javadoc/byShortName
*/
index = new TreeMap();
base = new File("./target/site/apidocs");
base.eachFileRecurse { File f ->
if(f.path.contains("-")) return; // non class files produced by javadoc
if(!f.path.endsWith(".html")) return; // directories and others
tail = f.path.substring(base.path.length()+1);
shortClassName = f.name.substring(0,f.name.length()-5); // cut off ".html"
fullClassName = tail.substring(0,tail.length()-5).replace('/','.');
index[shortClassName] = tail;
index[fullClassName] = tail;
}
index.each { k,v ->
println "Redirect 302 /javadoc/byShortName/${k} http://hudson-ci.org/javadoc/index.html?${v}"
}
#!/bin/bash -xe
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
# publish Hudson javadoc and deploy that into the java.net CVS repository
#
# make sure we have up-to-date copy so that the commit won't fail later
pushd ../../../www/javadoc
svn revert -R .
svn update
popd
cp -R target/checkout/target/site/apidocs/* ../../../www/javadoc
cd ../../../www/javadoc
# remove timestamp as this creates unnecessary revisions for javadoc files
find . -name "*.html" | xargs perl -p -i.bak -e "s|-- Generated by javadoc .+--|-- --|"
find . -name "*.html" | xargs perl -p -i.bak -e "s|<META NAME=\"DATE\" CONTENT=\"....-..-..\">||"
find . -name "*.bak" | xargs rm
# add files that are new
svn add $(svn status | grep "^?" | cut -d " " -f2-) .
svn commit -m "commiting javadoc"
#!/bin/ruby
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
ver=ARGV.shift
require 'ftools'
class VersionNumber
def initialize(str)
@tokens = str.split(/\./)
end
def inc
@tokens[-1] = (@tokens[-1].to_i()+1).to_s()
end
def dec
@tokens[-1] = (@tokens[-1].to_i()-1).to_s()
end
def to_s
@tokens.join(".")
end
end
print "Releasing master POM for plugins"
prev=VersionNumber.new(ver)
prev.dec()
def updatePom(src,prev,ver)
open(src) do |i|
open(src+".tmp","w") do |o|
i.each do |line|
line = line.gsub("<version>#{prev}</version>","<version>#{ver}</version>")
o.puts line
end
end
end
File.move(src+".tmp",src)
end
Dir.chdir("../plugins") do
system "svn update"
# update master POM
updatePom("pom.xml",prev,ver)
# --- stop updating plugin POMs aggressively. Now that plugins/pom.xml is synced
# to central, we no longer have a real incentive to do this, and we can let
# plugin authors choose the version of their choice.
## update parent reference in module POM
#Dir.glob("*") do |name|
# next unless File.directory?(name)
# print "#{name}\n"
# next unless File.exists?(name+"/pom.xml")
# updatePom(name+"/pom.xml",prev,ver)
#end
## in case anyone gets out of sync, this will bring them back to the current version,
## except that this only works for children nominated in the <module> section.
#system "mvn -N versions:update-child-modules" or fail
system "svn commit -m 'bumping up POM version'" or fail
system "mvn -N deploy" or fail
end
#!/bin/bash -ex
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# build a debian package from a release build
ver=$1
cp target/checkout/war/target/hudson.war hudson.war
(cat << EOF
hudson ($ver) unstable; urgency=low
* See http://hudson.dev.java.net/changelog.html for more details.
-- Kohsuke Kawaguchi <kk@kohsuke.org> $(date -R)
EOF
cat debian/changelog ) > debian/changelog.tmp
mv debian/changelog.tmp debian/changelog
# build the debian package
sudo apt-get install -y devscripts || true
debuild -us -uc -B
scp ../hudson_${ver}_all.deb hudson-ci.org:~/public_html_hudson/debian/binary
# build package index
# see http://wiki.debian.org/SecureApt for more details
pushd ..
mkdir binary > /dev/null 2>&1 || true
mv hudson_${ver}_all.deb binary
sudo apt-get install apt-utils
apt-ftparchive packages binary | tee binary/Packages | gzip -9c > binary/Packages.gz
apt-ftparchive contents binary | gzip -9c > binary/Contents.gz
apt-ftparchive -c main/debian/release.conf release binary > binary/Release
# sign the release file
rm binary/Release.gpg || true
gpg --no-use-agent --passphrase-file ~/.gpg.passphrase -abs -o binary/Release.gpg binary/Release
scp binary/Packages.gz binary/Release binary/Release.gpg binary/Contents.gz hudson-ci.org:~/public_html_hudson/debian/binary
popd
#!/bin/bash -ex
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
# Kohsuke's automated release script. Sorry for my checking this in,
# but Maven doesn't let me run release goals unless I have this in CVS.
umask 022 # we'll transfer files created during builds to Apache, where go=rx for directories are expected
xmlstarlet --version > /dev/null
if [ $? != 0 ]; then
echo xmlstarlet is not installed
exit -1
fi
# make sure we have up to date workspace
svn update
# if left-over hudson.war for Debian build from the last time, delete it.
rm hudson.war || true
tag=hudson-$(show-pom-version pom.xml | sed -e "s/-SNAPSHOT//g" -e "s/\\./_/g")
export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=256m"
mvn -B -Dtag=$tag -DskipTests release:prepare || mvn -B -Dtag=$tag -DskipTests install release:prepare || true
#svn up -r head
#mvn -B -Dtag=$tag -Dresume release:prepare
mvn release:perform
id=$(show-pom-version target/checkout/pom.xml)
case $id in
*-SNAPSHOT)
echo Trying to release a SNAPSHOT
exit 1
;;
esac
javanettasks uploadFile hudson /releases/$id "`date +"%Y/%m/%d"` release" Stable target/checkout/war/target/hudson.war | tee target/war-upload.log
warUrl=$(cat target/war-upload.log | grep "^Posted" | sed -e "s/Posted //g")
javanettasks uploadFile hudson /releases/source-bundles/$id "`date +"%Y/%m/%d"` release" Stable target/checkout/target/hudson-$id-src.zip
javanettasks announce hudson "Hudson $id released" "$warUrl" << EOF
See <a href="https://hudson.dev.java.net/changelog.html">the changelog</a> for details.
Download is available from <a href="$warUrl">here</a>.
EOF
# this is for the JNLP start
cp target/checkout/war/target/hudson.war target/checkout/war/target/hudson.jar
javanettasks uploadFile hudson /releases/jnlp/hudson.jar "version $id" Stable target/checkout/war/target/hudson.jar | tee target/upload.log
# replace the jar file link accordingly
WWW=../../../www
pushd $WWW
svn revert -R .
svn update
popd
jarUrl=$(cat target/upload.log | grep "^Posted" | sed -e "s/Posted //g")
perl -p -i.bak -e "s|https://.+hudson\.jar|$jarUrl|" $WWW/hudson.jnlp
cp $WWW/hudson.jnlp $WWW/$id.jnlp
# update changelog.html
ruby update.changelog.rb $id < $WWW/changelog.html > $WWW/changelog.new
mv $WWW/changelog.new $WWW/changelog.html
# push changes to the maven repository
ruby push-m2-repo.rb $id
chmod u+x publish-javadoc.sh
./publish-javadoc.sh
# update index
pushd target/checkout
./javadocReverseIndex.groovy > ../../.htaccess
popd
scp .htaccess hudson-ci.org:~/www/hudson-ci.org/javadoc/byShortName
# create and publish debian package
chmod u+x release-debian.sh
./release-debian.sh $id
svn commit -m "updated changelog as a part of the release" debian/changelog
# publish IPS. The server needs to be restarted for it to see the new package.
cat war/target/hudson-war-$id.ipstgz | ssh wsinterop.sun.com "cd ips/repository; gtar xvzf -"
ssh wsinterop.sun.com "cd ips; ./start.sh"
pushd $WWW
svn update changelog.html
svn commit -m "Hudson $id released" changelog.html hudson.jnlp
popd
# sorcerer
pushd target/checkout
mvn -P sorcerer sorcerer:aggregate
rsync -avz target/site/sorcerer wsinterop.sun.com:~/public_html_hudson/
popd
# RedHat RPM
pushd rpm
./build.sh ../hudson.war
./rsync.sh
popd
# OpenSUSE RPM
pushd opensuse
./build.sh ../hudson.war
./rsync.sh
popd
echo success
#!/bin/ruby
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# Updates changelog.html
# Usage: update.changelog.rb <nextVer> < changelog.html > output.html
# version number manipulation class
class VersionNumber
def initialize(str)
@tokens = str.split(/\./)
end
def inc
@tokens[-1] = (@tokens[-1].to_i()+1).to_s()
end
def dec
@tokens[-1] = (@tokens[-1].to_i()-1).to_s()
end
def to_s
@tokens.join(".")
end
end
id=VersionNumber.new(ARGV.shift)
id.inc()
ARGF.each do |line|
if /=BEGIN=/ =~ line
puts line
puts "<h3><a name=v#{id}>What's new in #{id}</a> <!--=DATE=--></h3>"
puts "<!--=RC-CHANGES=-->"
puts "</div><!--=END=-->"
next
end
if /=END=/ =~ line
next
end
if /=DATE=/ =~ line
puts line.gsub("<!--=DATE=-->",Time.now.strftime("(%Y/%m/%d)"))
next
end
puts line
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册