You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gobblin.apache.org by ab...@apache.org on 2018/01/03 18:58:03 UTC
[5/5] incubator-gobblin git commit: [GOBBLIN-355] Add helper script
to publish archives on Nexus, and wire gradle tasks
[GOBBLIN-355] Add helper script to publish archives on Nexus, and wire gradle tasks
Project: http://git-wip-us.apache.org/repos/asf/incubator-gobblin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-gobblin/commit/693c7f60
Tree: http://git-wip-us.apache.org/repos/asf/incubator-gobblin/tree/693c7f60
Diff: http://git-wip-us.apache.org/repos/asf/incubator-gobblin/diff/693c7f60
Branch: refs/heads/0.12.0
Commit: 693c7f60277b4f2423c4ea7a9d4cc429c7c77e23
Parents: fbc4cba
Author: Abhishek Tiwari <ab...@gmail.com>
Authored: Thu Jan 4 00:27:42 2018 +0530
Committer: Abhishek Tiwari <ab...@gmail.com>
Committed: Thu Jan 4 00:27:42 2018 +0530
----------------------------------------------------------------------
build.gradle | 7 +++
maven-nexus/maven-install.sh | 58 ++++++++++++++++++
maven-nexus/maven-nexus.sh | 115 ++++++++++++++++++++++++++++++++++++
maven-nexus/upload-to-nexus.sh | 71 ++++++++++++++++++++++
4 files changed, 251 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-gobblin/blob/693c7f60/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 74a64e7..0eae590 100644
--- a/build.gradle
+++ b/build.gradle
@@ -22,6 +22,8 @@ buildscript {
apply from: 'gradle/scripts/defaultBuildProperties.gradle'
apply from: 'gradle/scripts/computeVersions.gradle'
+ apply from: file('gradle/scripts/buildscript.gradle'), to: buildscript
+
buildscript.repositories.addAll(project.repositories)
dependencies {
@@ -128,9 +130,11 @@ apply from: 'gradle/scripts/javadoc.gradle'
apply from: 'gradle/scripts/sourcesJar.gradle'
apply from: 'gradle/scripts/mavenPublishing.gradle'
+apply from: 'gradle/scripts/nexusPublishing.gradle'
apply from: 'gradle/scripts/javaVersionCheck.gradle'
apply from: 'gradle/scripts/rat.gradle'
+apply from: 'gradle/scripts/release.gradle'
task wrapper(type: Wrapper) { gradleVersion = '2.13' }
@@ -209,6 +213,9 @@ rat {
'**/grok/**',
'**/WebmasterPerformanceTuningMetrics',
'**/*.template',
+ '**/mainGeneratedRest/**',
+ '**/mainGeneratedDataTemplate/**',
+ '**/gen-java/**',
'**/package-list'
]
}
http://git-wip-us.apache.org/repos/asf/incubator-gobblin/blob/693c7f60/maven-nexus/maven-install.sh
----------------------------------------------------------------------
diff --git a/maven-nexus/maven-install.sh b/maven-nexus/maven-install.sh
new file mode 100755
index 0000000..d31064f
--- /dev/null
+++ b/maven-nexus/maven-install.sh
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+#
+# 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.
+#
+
+#group is overiden to support forked repositories
+
+function print_usage(){
+ echo "maven-install.sh --version VERSION [--group GROUP]"
+}
+
+for i in "$@"
+do
+ case "$1" in
+ --version)
+ VERSION="$2"
+ shift
+ ;;
+ --group)
+ GROUP="$2"
+ shift
+ ;;
+ --help)
+ print_usage
+ exit 0
+ ;;
+ *)
+ ;;
+ esac
+ shift
+done
+
+if [ -z "$VERSION" ]; then
+ print_usage
+ exit
+fi
+echo VERSION=$VERSION
+
+if [ -z "$GROUP" ]; then
+ GROUP="org.apache.gobblin"
+fi
+
+
+./gradlew install -Dorg.gradle.parallel=false -Pversion=$VERSION -Pgroup=$GROUP
http://git-wip-us.apache.org/repos/asf/incubator-gobblin/blob/693c7f60/maven-nexus/maven-nexus.sh
----------------------------------------------------------------------
diff --git a/maven-nexus/maven-nexus.sh b/maven-nexus/maven-nexus.sh
new file mode 100755
index 0000000..1e636c0
--- /dev/null
+++ b/maven-nexus/maven-nexus.sh
@@ -0,0 +1,115 @@
+#!/bin/bash
+
+#
+# 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.
+#
+
+script_dir=$(dirname $0)
+script_name=$(basename $0)
+GRADLE="$script_dir/../gradlew"
+
+function print_usage() {
+ echo -e "USAGE: $0 [-remote|-local] [-noclean] [gradle_args]"
+ echo
+ echo -e "Publishes signed maven artifacts locally ($HOME/.m2/repository) or remotely (Nexus)."
+ echo -e "\t-local Publish to local repository"
+ echo -e "\t-noclean Don't run gradlew clean (useful if re-running)"
+ echo -e "\t-remote Publish to Nexus repository"
+ echo -e "\t-packages a comma-separated list of gradle paths to publish (e.g. :gobblin-api,:gobblin-core)"
+ echo
+ echo -e "NOTES:"
+ echo -e "\t1. You need the Gobblin PGP key to sign the artifacts. If you don't have it,"
+ echo -e "\t talk to another committer to get it. You also need to add the following to"
+ echo -e "\t your $HOME/.gradle/gradle.properties file:"
+ echo
+ echo -e "signing.keyId=<PGP key hex id>"
+ echo -e "signing.password=<PGP key password>"
+ echo -e "signing.secretKeyRingFile=$HOME/.gnupg/secring.gpg"
+ echo
+ echo -e "\t2. To upload remotely, you'll need a Nexus account. Visit "
+ echo -e "\t https://repository.apache.org/ to set it up. After"
+ echo -e "\t that add to your $HOME/.gradle/gradle.properties file:"
+ echo
+ echo -e "nexusUsername=<Nexus username>"
+ echo -e "nexusPassword=<Nexus password>"
+ echo
+ echo -e "\t3. Uploading remotely will upload only to the Nexus staging directory. "
+ echo -e "\t4. Don't forget to create a gobblin_<version> tag before publishing remotely!"
+ echo -e "\t5. Sometimes build with fail with an error"
+ echo -e "\t '... Failed to interpolate field: private java.lang.String ...'"
+ echo -e "\t Just re-run with -noclean"
+}
+
+if [ "$#" -eq 0 ] ; then
+ print_usage
+ exit
+fi
+
+install_target=
+gradle_args=
+noclean=
+declare -a packages
+
+# Parse command line
+while [ "$#" -gt 0 ] ; do
+ A="$1"
+ case "$A" in
+ -local)
+ install_target=install
+ ;;
+ -noclean)
+ noclean="1"
+ ;;
+ -remote)
+ install_target=uploadArchives
+ ;;
+ -h|--help|-help)
+ print_usage
+ exit
+ ;;
+ -packages)
+ shift
+ packages=( ${1//,/ } )
+ ;;
+ *)
+ gradle_args="$gradle_args $A"
+ ;;
+ esac
+ shift
+done
+
+if [ -z "${install_target}" ] ; then
+ echo "${script_name}: missing install target"
+ exit 1
+fi
+
+declare -a package_targets
+for P in "${packages[@]}" ; do
+ ptarget="$P:${install_target}"
+ if [ "${ptarget:0:1}" != ":" ] ; then
+ ptarget=":$ptarget"
+ fi
+ package_targets+=( "$ptarget" )
+done
+
+if [ "${#packages[@]}" -gt 0 ] ; then
+ install_target="${package_targets[@]}"
+fi
+
+if [ -z "$noclean" ] ; then
+ $GRADLE clean
+fi
+$GRADLE -PpublishToNexus -Porg.gradle.parallel=false -Porg.gradle.daemon=false -xtest $gradle_args $install_target 2>&1 | tee /tmp/${script_name}.out
http://git-wip-us.apache.org/repos/asf/incubator-gobblin/blob/693c7f60/maven-nexus/upload-to-nexus.sh
----------------------------------------------------------------------
diff --git a/maven-nexus/upload-to-nexus.sh b/maven-nexus/upload-to-nexus.sh
new file mode 100755
index 0000000..4847f22
--- /dev/null
+++ b/maven-nexus/upload-to-nexus.sh
@@ -0,0 +1,71 @@
+#!/bin/bash
+
+#
+# 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.
+#
+
+PROG=$(basename $0)
+
+function usage() {
+ echo -e "USAGE: $PROG"
+}
+
+# main()
+
+if [ "$#" -eq 0 ] ; then
+ usage
+ exit
+fi
+
+while [ "$#" -gt 0 ] ; do
+ A="$1"
+ case "$A" in
+ -h|--help)
+ usage
+ exit
+ ;;
+ *)
+ echo "$PROG: unknown option: $A"
+ exit 1
+ ;;
+ esac
+ shift
+done
+
+echo "CLEANING"
+./gradlew clean
+
+upload_all=0
+
+for P in :gobblin-admin :gobblin-api :gobblin-azkaban :gobblin-compaction :gobblin-config-management:gobblin-config-core :gobblin-config-management:gobblin-config-client :gobblin-core :gobblin-data-management :gobblin-distribution :gobblin-example :gobblin-metastore :gobblin-metrics :gobblin-oozie :gobblin-rest-service:gobblin-rest-api :gobblin-rest-service:gobblin-rest-client :gobblin-rest-service:gobblin-rest-server :gobblin-runtime :gobblin-salesforce :gobblin-scheduler :gobblin-test :gobblin-test-harness :gobblin-utility :gobblin-yarn ; do
+ echo "----------------------------"
+ if [ "$upload_all" -eq 0 ] ; then
+ read -p "UPLOAD $P [y(es)|n(o)|a(ll)]" ans
+ ans=$(echo "$ans" | tr '[:upper:]' '[:lower:]')
+ if [ "$ans" == "a" -o "$ans" == "all" ] ; then
+ upload_all=1
+ ans="y"
+ fi
+ else
+ ans="y"
+ fi
+ if [ "$ans" == "y" -o "$ans" == "yes" ] ; then
+ ./maven-nexus/maven-nexus.sh -remote -noclean -packages $P
+ else
+ echo "Skipping $P"
+ fi
+ done
+