You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by cs...@apache.org on 2018/03/26 20:17:50 UTC

[incubator-openwhisk-release] branch master updated: Implement the versioning for openwhisk release (#71)

This is an automated email from the ASF dual-hosted git repository.

csantanapr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-release.git


The following commit(s) were added to refs/heads/master by this push:
     new 1aa84e5  Implement the versioning for openwhisk release (#71)
1aa84e5 is described below

commit 1aa84e515979a4da63472ee6a846fa4d77b378f9
Author: Vincent <sh...@us.ibm.com>
AuthorDate: Mon Mar 26 16:17:48 2018 -0400

    Implement the versioning for openwhisk release (#71)
---
 docs/package_artifacts.md               |  4 ++--
 docs/pick_up_source_code.md             | 14 +++++++-------
 docs/publish_apache_directory.md        |  2 +-
 docs/push_stage_url.md                  |  4 ++--
 tools/checkout_svn.sh                   |  2 +-
 tools/clean_remote_release_artifacts.sh | 24 +++++-------------------
 tools/clean_remote_stage_artifacts.sh   | 24 +++++-------------------
 tools/config.json                       |  8 ++++----
 tools/load_config.sh                    | 19 +++++++++++++------
 tools/move_stage_to_release.sh          | 30 ++++++------------------------
 tools/package_source_code.sh            |  2 ++
 tools/travis/package_source_code.sh     |  4 +++-
 tools/upload_artifacts.sh               |  2 +-
 13 files changed, 52 insertions(+), 87 deletions(-)

diff --git a/docs/package_artifacts.md b/docs/package_artifacts.md
index 96a44f8..7b27548 100644
--- a/docs/package_artifacts.md
+++ b/docs/package_artifacts.md
@@ -42,5 +42,5 @@ After downloading the source code, we can run the following script under _tools_
 $ ./package_source_code.sh <WORK_DIR>
 ```
 The <WORK_DIR> should be the same one used to download the source code. This script will create a source code package file
-of source code suffixed with tar.gz for each project, under <WORK_DIR>/openwhisk_sources/openwhisk/openwhisk-\<major\>-\<minor\>.
-The keys major and minor are defined in _config.json_.
+of source code suffixed with tar.gz for each project, under <WORK_DIR>/openwhisk_sources/openwhisk/openwhisk-\<version\>.
+The key version is defined in _config.json_.
diff --git a/docs/pick_up_source_code.md b/docs/pick_up_source_code.md
index 39b342d..6de20b3 100644
--- a/docs/pick_up_source_code.md
+++ b/docs/pick_up_source_code.md
@@ -30,9 +30,9 @@ Template of [_config.json_](../tools/config.json):
 {
   "stage_url": "https://dist.apache.org/repos/dist/dev/incubator/openwhisk",
   "release_url": "https://dist.apache.org/repos/dist/release/incubator/openwhisk",
-  "version": {
-    "major": "incubator",
-    "minor": "rc1"
+  "versioning": {
+    "version": "incubator",
+    "pre_release_version": "rc1"
   },
   "RepoList": [
     "incubator-openwhisk",
@@ -58,7 +58,7 @@ Template of [_config.json_](../tools/config.json):
 ```
   - **stage_url**: the field to specify the staging url, where to upload the artifacts.
   - **release_url**: the field to specify the Apache release directory url, where to finally release the artifacts.
-  - **version**: the key to define the release name, with both a major and a minor name.
+  - **versioning**: the key to define the release name, with both a version and a pre-release version name.
   - **RepoList**: the key to define the list of OpenWhisk projects to be released. Based on this key, we need to add other
   keys below with each of them matching each project name. For example, we define three projects in _RepoList_, so we
   have three other keys below to match each project.
@@ -86,6 +86,6 @@ $ ./checkout_svn.sh <WORK_DIR> <SVN_USERNAME> <SVN_PASSWORD>
 The <WORK_DIR> should be the same one used to download the source code. If you have already configured your local
 svn command with a pair of username and password, there is no need to provide the values for the arguments <SVN_USERNAME>
 and <SVN_PASSWORD>. With this command, a remote folder named openwhisk-$version will be created in the subversion
-repository if necessary, and checked out to the local folder <WORK_DIR>/openwhisk_release/openwhisk/openwhisk-$version.
-The value of $version is $major-$minor, as defined in config.json. This command can also be used to sync-up your local
-folder with the remote subversion folder.
\ No newline at end of file
+repository if necessary, and checked out to the local folder <WORK_DIR>/openwhisk_release/openwhisk/openwhisk-$full_version.
+The value of $full_version is $version-$pre_release_version, as defined in config.json. This command can also be used to
+sync-up your local folder with the remote subversion folder.
\ No newline at end of file
diff --git a/docs/publish_apache_directory.md b/docs/publish_apache_directory.md
index 5e81e5d..fec0e34 100644
--- a/docs/publish_apache_directory.md
+++ b/docs/publish_apache_directory.md
@@ -29,4 +29,4 @@ $ ./move_stage_to_release.sh
 ## Tag the release in git
 
 All the hash values are available in the configuration file config.json for each OpenWhisk project. We need to tag them
-with the name of the release, e.g: \<major\>-\<minor\>.
+with the name of the release, e.g: \<version\>-\<pre_release_version\>.
diff --git a/docs/push_stage_url.md b/docs/push_stage_url.md
index 06ef756..c8b76e8 100644
--- a/docs/push_stage_url.md
+++ b/docs/push_stage_url.md
@@ -26,5 +26,5 @@ $ ./upload_artifacts.sh <WORK_DIR>
 ```
 
 The <WORK_DIR> should be the same one used to download the source code. This script will create a remote directory named
-openwhisk-\<major\>-\<minor\> under the staging directory, and push all the files available locally under openwhisk-\<major\>-\<minor\>
-upstream. It will overwrite the old files or directories, if the directory openwhisk-\<major\>-\<minor\> is available as a svn folder.
+openwhisk-\<version\>-\<pre_release_version\> under the staging directory, and push all the files available locally under openwhisk-\<version\>-\<pre_release_version\>
+upstream. It will overwrite the old files or directories, if the directory openwhisk-\<version\>-\<pre_release_version\> is available as a svn folder.
diff --git a/tools/checkout_svn.sh b/tools/checkout_svn.sh
index e08003e..1cd4287 100755
--- a/tools/checkout_svn.sh
+++ b/tools/checkout_svn.sh
@@ -27,7 +27,7 @@ source "$SCRIPTDIR/load_config.sh" $1 $2 $3
 
 if [[ `wget -S --spider $CURRENT_VERSION_URL  2>&1 | grep 'HTTP/1.1 404 Not Found'` ]]; then
     # Create an empty folder named ${REMOTE_PATH} in the remote staging folder
-    svn mkdir -m "Create the directory for ${version} in staging." $CURRENT_VERSION_URL $CREDENTIALS
+    svn mkdir -m "Create the directory for ${full_version} in staging." $CURRENT_VERSION_URL $CREDENTIALS
 fi
 
 # Create a subversion directory for openwhisk to stage all the packages
diff --git a/tools/clean_remote_release_artifacts.sh b/tools/clean_remote_release_artifacts.sh
index 599fb00..ccda065 100755
--- a/tools/clean_remote_release_artifacts.sh
+++ b/tools/clean_remote_release_artifacts.sh
@@ -21,26 +21,12 @@ set -e
 echo "Clean the remote artifacts in release directory"
 
 SCRIPTDIR="$(cd $(dirname "$0")/ && pwd)"
-source "$SCRIPTDIR/util.sh"
+WORK_DIR=${1:-"$HOME"}
+SVN_USERNAME=$2
+SVN_PASSWORD=$3
 
-CONFIG=$(read_file $SCRIPTDIR/config.json)
-version_key="version"
-version_major=$(json_by_key "$CONFIG" ${version_key}.major)
-version_minor=$(json_by_key "$CONFIG" ${version_key}.minor)
-
-version=$version_major-$version_minor
-REMOTE_PATH="openwhisk-$version"
-RELEASE_URL=$(json_by_key "$CONFIG" "release_url")
-CURRENT_VERSION_URL="$RELEASE_URL/${REMOTE_PATH}/"
-CREDENTIALS=""
-
-SVN_USERNAME=$1
-SVN_PASSWORD=$2
-
-if [ ! -z "$SVN_USERNAME" ] && [ ! -z "$SVN_PASSWORD" ];then
-    CREDENTIALS="--username $SVN_USERNAME --password $SVN_PASSWORD --non-interactive"
-fi
+source "$SCRIPTDIR/load_config.sh" "$WORK_DIR" "$SVN_USERNAME" "$SVN_PASSWORD"
 
 if [[ `wget -S --spider $CURRENT_VERSION_URL  2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then
-    svn delete $CURRENT_VERSION_URL -m "Removing Apache OpenWhisk release ${version}." $CREDENTIALS
+    svn delete $CURRENT_VERSION_URL -m "Removing Apache OpenWhisk release ${full_version}." $CREDENTIALS
 fi
diff --git a/tools/clean_remote_stage_artifacts.sh b/tools/clean_remote_stage_artifacts.sh
index 608f1d5..d830c6e 100755
--- a/tools/clean_remote_stage_artifacts.sh
+++ b/tools/clean_remote_stage_artifacts.sh
@@ -21,26 +21,12 @@ set -e
 echo "Clean the remote artifacts in staging directory"
 
 SCRIPTDIR="$(cd $(dirname "$0")/ && pwd)"
-source "$SCRIPTDIR/util.sh"
+WORK_DIR=${1:-"$HOME"}
+SVN_USERNAME=$2
+SVN_PASSWORD=$3
 
-CONFIG=$(read_file $SCRIPTDIR/config.json)
-version_key="version"
-version_major=$(json_by_key "$CONFIG" ${version_key}.major)
-version_minor=$(json_by_key "$CONFIG" ${version_key}.minor)
-
-version=$version_major-$version_minor
-REMOTE_PATH="openwhisk-$version"
-STAGE_URL=$(json_by_key "$CONFIG" "stage_url")
-CURRENT_VERSION_URL="$STAGE_URL/${REMOTE_PATH}/"
-CREDENTIALS=""
-
-SVN_USERNAME=$1
-SVN_PASSWORD=$2
-
-if [ ! -z "$SVN_USERNAME" ] && [ ! -z "$SVN_PASSWORD" ];then
-    CREDENTIALS="--username $SVN_USERNAME --password $SVN_PASSWORD --non-interactive"
-fi
+source "$SCRIPTDIR/load_config.sh" "$WORK_DIR" "$SVN_USERNAME" "$SVN_PASSWORD"
 
 if [[ `wget -S --spider $CURRENT_VERSION_URL  2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then
-    svn delete $CURRENT_VERSION_URL -m "Removing Apache OpenWhisk release ${version} from staging." $CREDENTIALS
+    svn delete $CURRENT_VERSION_URL -m "Removing Apache OpenWhisk release ${full_version} from staging." $CREDENTIALS
 fi
diff --git a/tools/config.json b/tools/config.json
index cac2d34..0d6743b 100644
--- a/tools/config.json
+++ b/tools/config.json
@@ -1,10 +1,10 @@
 {
-  "publish_stage": "false",
+  "publish_stage": "true",
   "stage_url": "https://dist.apache.org/repos/dist/dev/incubator/openwhisk",
   "release_url": "https://dist.apache.org/repos/dist/release/incubator/openwhisk",
-  "version": {
-    "major": "incubator",
-    "minor": "rc1"
+  "versioning": {
+    "version": "incubator",
+    "pre_release_version": "rc1"
   },
   "RepoList": [
     "openwhisk",
diff --git a/tools/load_config.sh b/tools/load_config.sh
index 6e19354..7cb36eb 100755
--- a/tools/load_config.sh
+++ b/tools/load_config.sh
@@ -39,12 +39,19 @@ PUBLISH_STAGE=$(json_by_key "$CONFIG" "publish_stage")
 repos=$(echo $(json_by_key "$CONFIG" "RepoList") | sed 's/[][]//g')
 STAGE_URL=$(json_by_key "$CONFIG" "stage_url")
 
-version_key="version"
-version_major=$(json_by_key "$CONFIG" ${version_key}.major)
-version_minor=$(json_by_key "$CONFIG" ${version_key}.minor)
+version_key="versioning"
+version=$(json_by_key "$CONFIG" ${version_key}.version)
+pre_release_version=$(json_by_key "$CONFIG" ${version_key}.pre_release_version)
+full_version=$version
+
+if [ ! -z "$pre_release_version" ]; then
+    pre_release_version_no_space="$(echo -e "${pre_release_version}" | tr -d '[[:space:]]')"
+    if [ ! -z "$pre_release_version_no_space" ]; then
+        full_version=$full_version-$pre_release_version_no_space
+    fi
+fi
 
-version=$version_major-$version_minor
-REMOTE_PATH="openwhisk-$version"
+REMOTE_PATH="openwhisk-$full_version"
 
 CURRENT_VERSION_URL="$STAGE_URL/${REMOTE_PATH}/"
-CURRENT_VERSION_DIR="$OPENWHISK_SVN/openwhisk-$version"
+CURRENT_VERSION_DIR="$OPENWHISK_SVN/$REMOTE_PATH"
diff --git a/tools/move_stage_to_release.sh b/tools/move_stage_to_release.sh
index 12a0f83..c0b5ba3 100755
--- a/tools/move_stage_to_release.sh
+++ b/tools/move_stage_to_release.sh
@@ -21,34 +21,16 @@ set -e
 echo "Move the remote artifacts from staging to release directory."
 
 SCRIPTDIR="$(cd $(dirname "$0")/ && pwd)"
-source "$SCRIPTDIR/util.sh"
+WORK_DIR=${1:-"$HOME"}
+SVN_USERNAME=$2
+SVN_PASSWORD=$3
 
-CONFIG=$(read_file $SCRIPTDIR/config.json)
-version_key="version"
-version_major=$(json_by_key "$CONFIG" ${version_key}.major)
-version_minor=$(json_by_key "$CONFIG" ${version_key}.minor)
-
-version=$version_major-$version_minor
-REMOTE_PATH="openwhisk-$version"
-STAGE_URL=$(json_by_key "$CONFIG" "stage_url")
-RELEASE_URL=$(json_by_key "$CONFIG" "release_url")
-
-CURRENT_VERSION_URL="$STAGE_URL/${REMOTE_PATH}/"
-RELEASE_VERSION_URL="$RELEASE_URL/${REMOTE_PATH}/"
-
-CREDENTIALS=""
-
-SVN_USERNAME=$1
-SVN_PASSWORD=$2
-
-if [ ! -z "$SVN_USERNAME" ] && [ ! -z "$SVN_PASSWORD" ];then
-    CREDENTIALS="--username $SVN_USERNAME --password $SVN_PASSWORD --non-interactive"
-fi
+source "$SCRIPTDIR/load_config.sh" "$WORK_DIR" "$SVN_USERNAME" "$SVN_PASSWORD"
 
 if [[ `wget -S --spider $RELEASE_VERSION_URL  2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then
-    svn delete $RELEASE_VERSION_URL -m "Removing Apache OpenWhisk release ${version}." $CREDENTIALS
+    svn delete $RELEASE_VERSION_URL -m "Removing Apache OpenWhisk release ${full_version}." $CREDENTIALS
 fi
 
 if [[ `wget -S --spider $CURRENT_VERSION_URL  2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then
-    svn copy $CURRENT_VERSION_URL $RELEASE_URL -m "Releasing Apache OpenWhisk release ${version}." $CREDENTIALS
+    svn copy $CURRENT_VERSION_URL $RELEASE_URL -m "Releasing Apache OpenWhisk release ${full_version}." $CREDENTIALS
 fi
diff --git a/tools/package_source_code.sh b/tools/package_source_code.sh
index d04307a..6e8effd 100755
--- a/tools/package_source_code.sh
+++ b/tools/package_source_code.sh
@@ -23,6 +23,8 @@ echo "Package the artifacts."
 SCRIPTDIR="$(cd $(dirname "$0")/ && pwd)"
 source "$SCRIPTDIR/load_config.sh" $1 $2 $3
 
+mkdir -p $CURRENT_VERSION_DIR
+
 # Clean up all the source code by excluding unnecessary files and folders
 # Remove all the hidden files and folder
 # Remove bin and build folders
diff --git a/tools/travis/package_source_code.sh b/tools/travis/package_source_code.sh
index 79bd7ec..513bd10 100755
--- a/tools/travis/package_source_code.sh
+++ b/tools/travis/package_source_code.sh
@@ -31,7 +31,9 @@ source "$PARENTDIR/load_config.sh" "$WORK_DIR" "$SVN_USERNAME" "$SVN_PASSWORD" "
 
 "$PARENTDIR/install_dependencies.sh"
 "$PARENTDIR/download_source_code.sh" "$WORK_DIR"
-"$PARENTDIR/checkout_svn.sh" "$WORK_DIR" "$SVN_USERNAME" "$SVN_PASSWORD"
+if [ "$TRAVIS_EVENT_TYPE" == "push" ] && [ "$PUBLISH_STAGE" == "true" ] ; then
+    "$PARENTDIR/checkout_svn.sh" "$WORK_DIR" "$SVN_USERNAME" "$SVN_PASSWORD"
+fi
 
 
 "$PARENTDIR/package_source_code.sh" "$WORK_DIR" "$SVN_USERNAME" "$SVN_PASSWORD"
diff --git a/tools/upload_artifacts.sh b/tools/upload_artifacts.sh
index 2f0e66a..3f9228b 100755
--- a/tools/upload_artifacts.sh
+++ b/tools/upload_artifacts.sh
@@ -28,7 +28,7 @@ source "$SCRIPTDIR/load_config.sh" $1 $2 $3
 cd $OPENWHISK_SVN/$REMOTE_PATH
 
 svn add --force * $CREDENTIALS
-svn commit -m "Staging Apache OpenWhisk release ${version}." $CREDENTIALS
+svn commit -m "Staging Apache OpenWhisk release ${full_version}." $CREDENTIALS
 
 # Disconnect $REMOTE_PATH with the remote staging server.
 rm -rf .svn

-- 
To stop receiving notification emails like this one, please contact
csantanapr@apache.org.