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

[GitHub] csantanapr closed pull request #71: Implement the versioning for openwhisk release

csantanapr closed pull request #71: Implement the versioning for openwhisk release
URL: https://github.com/apache/incubator-openwhisk-release/pull/71
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services