| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| |
| <project name="release" basedir=".."> |
| |
| <description> |
| This an Ant build file to automate the release process of |
| Apache Slider (incubating). |
| |
| It wraps the core maven build and package commands with the |
| operations needed to actually publish the artifacts, generate |
| email announcements, etc. |
| |
| Requirements |
| -all the various build tools are installed and on the path |
| -you have git installed |
| |
| properties to set in build.xml or on the CLI |
| |
| slider.release.version=0.91.0 |
| slider.develop.version=0.92-SNAPSHOT |
| release.jira=SLIDER-1014 |
| |
| # needed for announcements |
| release.jira.page |
| staging.repository |
| |
| #optional |
| mvn.extra.args |
| slider.conf.dir: value of SLIDER_CONF_DIR for integration tests |
| upload.user: username for asf uploads. Default: current username |
| upload.disabled: set property to disable uploads to asf infra |
| |
| </description> |
| |
| <target name="init"> |
| <property file="build.properties"/> |
| <!-- Create the time stamp --> |
| <tstamp/> |
| |
| <macrodef name="require"> |
| <attribute name="property" /> |
| <attribute name="text" default="" /> |
| <sequential> |
| <fail unless="@{property}"> |
| @{text} |
| Unset property: @{property} |
| </fail> |
| </sequential> |
| </macrodef> |
| |
| <require property="slider.release.version" /> |
| <require property="slider.develop.version" /> |
| <require property="release.jira" /> |
| <property name="release.rc.suffix" value="" /> |
| |
| <property name="mvn.skiptests" value="-DskipTests" /> |
| <property name="mvn.profile" value=" -Papache-release" /> |
| <property name="mvn.extra.args" value="" /> |
| |
| <property name="release.name" value="slider-${slider.release.version}" /> |
| <property name="rc.name" value="${slider.release.version}${release.rc.suffix}" /> |
| <property name="asf.user" value="${user.name}" /> |
| <property name="upload.keyfile" location="${user.home}/.ssh/id_dsa" /> |
| <property name="expanded.tar" location="slider-assembly/target/${release.name}-all/" /> |
| <property name="source.archive.name" value="apache-${release.name}-source-release" /> |
| <property name="target.source.tar.gz" |
| location="target/${source.archive.name}.tar.gz" /> |
| <property name="target.source.zip" |
| location="target/${source.archive.name}.zip" /> |
| |
| <property name="target.svn.publish.dir" location="target/publish" /> |
| |
| <property name="application.dir" location="${expanded.tar}/${release.name}/" /> |
| |
| |
| <!-- nexus --> |
| <property name="nexus.staging.repository" value="(unset nexus.staging.repository)" /> |
| <property name="nexus.base.url" value="https://repository.apache.org/content/repositories/" /> |
| <property name="nexus.staging.url" value="${nexus.base.url}${nexus.staging.repository}/" /> |
| |
| <!-- SVN properties--> |
| <property name="incubator.svn.url" |
| value="https://dist.apache.org/repos/dist/release/incubator" /> |
| <property name="svn.release.dir" value="${svn.publish.dir}/${rc.name}" /> |
| <property name="svn.release.url" value="${incubator.svn.url}/slider/${rc.name}" /> |
| <property name="svn.release.source.tar.gz" |
| value="${svn.release.url}/${source.archive.name}.tar.gz" /> |
| <property name="svn.release.source.zip" |
| value="${svn.release.url}/${source.archive.name}.zip" /> |
| <property name="svn.commit.message" |
| location="[${release.jira}] Publish ${rc.name} " /> |
| <property name="pgp.url" |
| value="http://pgp.mit.edu:11371/pks/lookup?op=vindex&search=${asf.user}@apache.org"/> |
| <property name="git.base.url" |
| value="https://git-wip-us.apache.org/repos/asf?p=incubator-slider.git" /> |
| |
| <property name="get.dir" location="target/get" /> |
| <delete dir="${get.dir}" /> |
| <mkdir dir="${get.dir}" /> |
| <property name="slider.vote.file" location="target/vote.txt" /> |
| |
| <echo> |
| Releasing Apache Slider (incubating) |
| ==================================== |
| |
| slider.release.version: ${slider.release.version} |
| slider.develop.version: ${slider.develop.version} |
| release.jira: ${release.jira} |
| slider.conf.dir: ${slider.conf.dir} |
| |
| svn publishing |
| -------------- |
| svn.publish.dir: ${slider.publish.dir} |
| svn.commit.message: ${svn.commit.message} |
| svn |
| |
| ------ |
| asf.user: ${asf.user} -for commits and PGP |
| </echo> |
| |
| |
| <macrodef name="must-be-zero"> |
| <attribute name="value" /> |
| <attribute name="text" default="" /> |
| <sequential> |
| <fail> |
| <condition> |
| <not> |
| <equals arg1="0" arg2="@{value}" /> |
| </not> |
| </condition> |
| @{text} |
| "@{value}" != 0 |
| </fail> |
| </sequential> |
| </macrodef> |
| |
| <macrodef name="must-exist"> |
| <attribute name="file" /> |
| <attribute name="text" default=""/> |
| <sequential> |
| <fail> |
| <condition> |
| <not><available file="@{file}"/></not> |
| </condition> |
| @{text} |
| File not found: @{file} |
| </fail> |
| </sequential> |
| </macrodef> |
| <macrodef name="must-exist-with-checksums"> |
| <attribute name="file" /> |
| <attribute name="text" default=""/> |
| <sequential> |
| <fail> |
| <condition> |
| <or> |
| <not><available file="@{file}"/></not> |
| <not><available file="@{file}.sha1"/></not> |
| <not><available file="@{file}.md5"/></not> |
| <not><available file="@{file}.asc"/></not> |
| </or> |
| </condition> |
| @{text} |
| File or checksums not found: @{file} |
| </fail> |
| </sequential> |
| </macrodef> |
| |
| |
| <!-- template exec with the failonerror flag set--> |
| <presetdef name="ex"> |
| <exec failonerror="true"> |
| </exec> |
| </presetdef> |
| |
| <!-- maven command. the value of ${mvn.extra.args} is appended--> |
| <macrodef name="mvn"> |
| <attribute name="command"/> |
| <attribute name="tests" default="${mvn.skiptests}" /> |
| <attribute name="profile" default="${mvn.profile}" /> |
| <sequential> |
| <echo>maven : @{command}</echo> |
| <ex executable="mvn" > |
| <arg line="@{command} @{tests} @{profile} ${mvn.extra.args}"/> |
| </ex> |
| </sequential> |
| </macrodef> |
| |
| <!-- |
| run maven and don't fail even if it does. Instead the property "property" |
| is set to the return code |
| --> |
| <macrodef name="mvn-nofail"> |
| <attribute name="command" /> |
| <attribute name="property"/> |
| <attribute name="tests" default="${mvn.skiptests}"/> |
| <attribute name="profile" default="${mvn.profile}"/> |
| <sequential> |
| <echo>maven : @{command}</echo> |
| <exec executable="mvn" failonerror="false" resultproperty="@{property}"> |
| <arg line="@{command} @{tests} @{profile} ${mvn.extra.args}" /> |
| </exec> |
| </sequential> |
| </macrodef> |
| |
| <!-- set the poms to a new version --> |
| <macrodef name="mvn-setversion"> |
| <attribute name="version" /> |
| <sequential> |
| <mvn command="versions:set -DnewVersion=@{version}" /> |
| <delete dir="." includes="**/pom.xml.versionsBackup" /> |
| </sequential> |
| </macrodef> |
| |
| |
| <!-- Run a git command--> |
| <macrodef name="git"> |
| <attribute name="command"/> |
| <sequential> |
| <echo>git @{command}</echo> |
| <ex executable="git" > |
| <arg line="@{command}"/> |
| </ex> |
| </sequential> |
| </macrodef> |
| |
| <presetdef name="svn"> |
| <ex executable="svn" /> |
| </presetdef> |
| |
| <macrodef name="gpg2"> |
| <attribute name="command"/> |
| <sequential> |
| <echo>gpg2 @{command}</echo> |
| <ex executable="gpg2" > |
| <arg line="@{command}"/> |
| </ex> |
| </sequential> |
| </macrodef> |
| |
| <!-- lifted straight from Ant's manual --> |
| <macrodef name="get-and-checksum"> |
| <attribute name="url" /> |
| <attribute name="dest" /> |
| <sequential> |
| <local name="destdir" /> |
| <dirname property="destdir" file="@{dest}" /> |
| <get dest="${destdir}"> |
| <url url="@{url}" /> |
| <url url="@{url}.sha1" /> |
| <firstmatchmapper> |
| <globmapper from="@{url}.sha1" to="@{dest}.sha1" /> |
| <globmapper from="@{url}" to="@{dest}" /> |
| </firstmatchmapper> |
| </get> |
| <local name="checksum.matches" /> |
| <local name="checksum.matches.fail" /> |
| <checksum file="@{dest}" algorithm="sha" fileext=".sha1" |
| verifyproperty="checksum.matches" /> |
| <condition property="checksum.matches.fail"> |
| <equals arg1="${checksum.matches}" arg2="false" /> |
| </condition> |
| <fail if="checksum.matches.fail">Checksum error</fail> |
| </sequential> |
| </macrodef> |
| |
| </target> |
| |
| <target name="clean" depends="init"> |
| <mvn command="clean -Pall-modules" /> |
| </target> |
| |
| <target name="install" depends="init, rat"> |
| <mvn command="install" /> |
| </target> |
| |
| <target name="test" depends="init"> |
| <mvn command="test" /> |
| </target> |
| |
| <target name="integration-test" depends="init"> |
| <require property="slider.conf.dir" /> |
| <must-exist file="${slider.conf.dir}" /> |
| <mvn command="integration-test -Dslider.conf.dir=${slider.conf.dir} " /> |
| </target> |
| |
| <target name="rat" depends="init, clean" |
| description="Execute the RAT scan, print the results and fail if there is a problem"> |
| <mvn-nofail command="apache-rat:check -Prat" property="rat.result"/> |
| <loadfile property="rat.txt" srcfile="target/rat.txt" /> |
| <echo> return code =${rat.result}</echo> |
| <must-be-zero value="${rat.result}" text="${rat.txt}"/> |
| </target> |
| |
| <target name="deploy" depends="init"> |
| <mvn command="deploy"/> |
| </target> |
| |
| <target name="package" depends="init"> |
| <mvn command="site:site package"/> |
| </target> |
| |
| <target name="mvnstage" depends="init"> |
| <mvn command="site:stage"/> |
| </target> |
| |
| <target name="set-to-release-version" depends="init" |
| description="Set the POM version to slider.release.version "> |
| <mvn-setversion version="${slider.release.version}" /> |
| </target> |
| |
| <target name="set-to-develop-version" depends="init" |
| description="Set the POM version to slider.develop.version "> |
| <mvn-setversion version="${slider.develop.version}" /> |
| </target> |
| |
| <target name="validate-packaging" depends="init"> |
| <must-exist file="${expanded.tar}"/> |
| <must-exist file="${application.dir}"/> |
| <must-exist file="${application.dir}/lib/slider-agent.tar.gz"/> |
| <must-exist file="${target.source.tar.gz}"/> |
| <must-exist file="${target.source.zip}"/> |
| </target> |
| |
| <target name="checksums" depends="validate-packaging"> |
| <checksum algorithm="md5" forceoverwrite="true" > |
| <fileset file="${target.source.tar.gz}" /> |
| <fileset file="${target.source.zip}" /> |
| </checksum> |
| <checksum algorithm="sha1" forceoverwrite="true"> |
| <fileset file="${target.source.tar.gz}" /> |
| <fileset file="${target.source.zip}" /> |
| </checksum> |
| </target> |
| |
| <!-- tarball operations; no actual build/package of binaries--> |
| <target name="tarball-no-package" depends="validate-packaging, checksums" /> |
| |
| <!-- tarball with packaging. This doesn't stage--> |
| <target name="tarball" depends="clean, rat, package, tarball-no-package" /> |
| |
| <target name="clean-target-dir" depends="init"> |
| <delete> |
| <fileset dir="target" |
| includes="rat.txt,.plxarc,archive-tmp,maven-shared-archive-resources"/> |
| </delete> |
| </target> |
| |
| <target name="copy-tasklibs" depends="init" |
| description="copy int to the ant lib any needed jars -from the maven repo"> |
| <property name="jsch.version" value="0.1.51" /> |
| <property name="antlib.dir" location="${user.home}/.ant/lib" /> |
| <property name="mvnrepo.dir" location="${user.home}/.m2/repository" /> |
| <copy |
| file="${mvnrepo.dir}/com/jcraft/jsch/${jsch.version}/jsch-${jsch.version}.jar" |
| todir="${antlib.dir}" |
| /> |
| </target> |
| |
| <target name="prepare-rc" depends="validate-packaging, checksums" > |
| |
| <delete dir="${target.svn.publish.dir}" /> |
| <mkdir dir="${target.svn.publish.dir}/" /> |
| <copy todir="${target.svn.publish.dir}" > |
| <fileset dir="target" includes="${source.archive.name}.*/" /> |
| </copy> |
| <ex command="ls"><arg line="-al ${target.svn.publish.dir}"/></ex> |
| </target> |
| |
| <target name="git-version" depends="init"> |
| <ex executable="git" outputproperty="git.version"> |
| <arg line="show-ref HEAD --head --hash" /> |
| </ex> |
| <echo>git.version=${git.version}</echo> |
| <property name="git.release.url" |
| value="${git.base.url};a=commit;h=${git.version}" /> |
| </target> |
| |
| <!-- make sure the repo is unmodified. |
| There's a secret flag to disable this *purely for development of this release build*--> |
| <target name="git-check-unmodified" |
| description="make sure there are no modified files" |
| depends="init" |
| unless="git-check-unmodified"> |
| <git command="diff-index --quiet HEAD --" /> |
| </target> |
| |
| <target name="svn-setup" depends="init"> |
| <require property="svn.publish.dir" /> |
| </target> |
| |
| <target name="copy-to-svn" depends="svn-setup, checksums, prepare-rc" |
| description="copy the artifacts to the svn-managed directory"> |
| <delete dir="${svn.release.dir}" /> |
| <mkdir dir="${svn.release.dir}" /> |
| <copy todir="${svn.release.dir}" > |
| <fileset dir="${target.svn.publish.dir}" includes="**/*" /> |
| </copy> |
| <ex command="ls"> |
| <arg line="-al ${svn.release.dir}" /> |
| </ex> |
| <must-exist-with-checksums file="${svn.release.dir}/${source.archive.name}.tar.gz" /> |
| <must-exist-with-checksums file="${svn.release.dir}/${source.archive.name}.zip" /> |
| </target> |
| |
| <target name="commit-svn" depends="svn-setup" |
| description="commit the SVN repo. This publishes the source artifacts"> |
| <must-exist file="${svn.release.dir}/${source.archive.name}.tar.gz" /> |
| |
| <svn> |
| <arg value="commit"/> |
| <arg value="-m"/> |
| <arg value="${svn.commit.message}"/> |
| <arg location="${svn.release.dir}" /> |
| </svn> |
| </target> |
| |
| <target name="publish-via-svn" depends="copy-to-svn, commit-svn" /> |
| |
| <target name="release-no-commit" |
| depends="git-check-unmodified, rat, deploy, tarball-no-package, copy-to-svn"> |
| <echo>Artifacts staged on Nexus repository</echo> |
| </target> |
| |
| <target name="release" |
| depends="release-no-commit, publish-via-svn, print-nexus-instructions"> |
| <echo>Source artifacts committed on subversion</echo> |
| </target> |
| |
| <target name="check-base-urls" depends="init" |
| description="check the base URLs which can be validated independent of release values"> |
| <property name="get.dir" location="target/get" /> |
| <delete dir="${get.dir}" /> |
| <mkdir dir="${get.dir}" /> |
| <get dest="${get.dir}" verbose="true"> |
| <url url="${git.base.url}" /> |
| <url url="${incubator.svn.url}/" /> |
| <url url="${incubator.svn.url}/slider/" /> |
| <url url="${pgp.url}" /> |
| <url url="${nexus.base.url}" /> |
| </get> |
| </target> |
| |
| <target name="check-release-urls" depends="check-base-urls,git-version" |
| description="check the final release URLs and artifacts"> |
| <get dest="${get.dir}" verbose="true"> |
| <url url="${git.release.url}" /> |
| <url url="${nexus.staging.url}" /> |
| <url url="${svn.release.url}" /> |
| <url url="${svn.release.source.tar.gz}" /> |
| <url url="${svn.release.source.tar.gz}.asc" /> |
| <url url="${svn.release.source.tar.gz}.md5" /> |
| <url url="${svn.release.source.tar.gz}.sha1" /> |
| <url url="${svn.release.source.zip}" /> |
| <url url="${svn.release.source.zip}.asc" /> |
| <url url="${svn.release.source.zip}.md5" /> |
| <url url="${svn.release.source.zip}.sha1" /> |
| </get> |
| |
| </target> |
| |
| <target name="print-nexus-instructions" depends="init" > |
| <echo > |
| The artifacts are now on the Apache Repository staging server. |
| ============================================================== |
| |
| 1. Log in to https://repository.apache.org/index.html |
| with your ASF username and LDAP password |
| 2. Go to "Staging Repositories" |
| https://repository.apache.org/index.html#stagingRepositories) |
| 3. Search for the `orgapacheslider` repository with the highest number |
| 4. Select it |
| 5. Browse the content, verify the version number is what you want. |
| 6. Hit the "close" button (top of list). |
| This will fail if it doesn't meet the ASF criteria |
| 7. Wait for the close process to complete. |
| 8. Get the name of the closed staging repository (e.g. orgapacheslider-1010) |
| set the property nexus.staging.repository to his value |
| 9. Execute: |
| ant -f bin/release.xml generate-vote-text |
| </echo> |
| </target> |
| |
| <target name="echo-vote-text" depends="init, git-version"> |
| <require property="release.jira.page"/> |
| <!-- --> |
| <echo file="${slider.vote.file}"> |
| [VOTE] Apache Slider (incubating) release ${rc.name} |
| |
| Hello, |
| |
| This is a call for a vote on the Apache Slider (incubating) release ${rc.name} |
| |
| |
| Issues fixed: |
| ${release.jira.page} |
| |
| Source artifacts: |
| ${svn.release.url} |
| |
| Staged artifacts: |
| ${nexus.staging.url} |
| |
| Git source: |
| ${git.release.url} |
| SHA1: ${git.version} |
| |
| PGP key: |
| http://pgp.mit.edu:11371/pks/lookup?op=vindex&search=${asf.user}@apache.org |
| |
| |
| [ ] +1 Release Apache Slider (incubating) ${rc.name} |
| [ ] 0 |
| [ ] -1 Do not release Apache Slider (incubating) ${rc.name} |
| |
| Voting lasts 72h, |
| |
| </echo> |
| <loadfile property="slider.vote.text" srcfile="${slider.vote.file}" /> |
| <echo> |
| Voting text is in ${slider.vote.file} |
| |
| ${slider.vote.text} |
| </echo> |
| </target> |
| |
| <target name="generate-vote-text" depends="check-release-urls, echo-vote-text" |
| description="generate the vote text -after validating its links" |
| /> |
| </project> |