You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by wi...@apache.org on 2020/08/21 09:44:41 UTC

[incubator-streampipes-installer] branch dev updated: [STREAMPIPES-196] add license header to files and adapt scripts to handle it

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

wiener pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes-installer.git


The following commit(s) were added to refs/heads/dev by this push:
     new 5bac8b9  [STREAMPIPES-196] add license header to files and adapt scripts to handle it
5bac8b9 is described below

commit 5bac8b9628b169ae163a7d208a0ea6d634feacbf
Author: Patrick Wiener <wi...@fzi.de>
AuthorDate: Fri Aug 21 11:44:27 2020 +0200

    [STREAMPIPES-196] add license header to files and adapt scripts to handle it
---
 cli/VERSION         | 15 ++++++++++++++
 cli/bin/commands/up |  6 +++---
 cli/bin/common      |  2 +-
 upgrade_versions.sh | 56 ++++++++++++++++++++++++++++++++++++++++++++---------
 4 files changed, 66 insertions(+), 13 deletions(-)

diff --git a/cli/VERSION b/cli/VERSION
index adc6698..f809cbf 100644
--- a/cli/VERSION
+++ b/cli/VERSION
@@ -1 +1,16 @@
+# 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.
+
 0.67.0-SNAPSHOT
diff --git a/cli/bin/commands/up b/cli/bin/commands/up
index 772cba2..ec61a0b 100755
--- a/cli/bin/commands/up
+++ b/cli/bin/commands/up
@@ -52,13 +52,13 @@ done
 configure(){
 
   if [ ! -f "$STREAMPIPES_WORKDIR/.environment" ]; then
-    fatal "Environment missing. See 'streampipes template'"
+    fatal "Environment missing. See 'streampipes env --help'"
   fi
 
   startup_notice
   get_curr_environment
 
-  info "Version: $(cat $STREAMPIPES_WORKDIR/VERSION)"
+  info "Version: $(cat $STREAMPIPES_WORKDIR/VERSION | grep -v '#' | awk NF)"
   info "Environment: '$curr_environment'"
   if [ "$no_ports" = true ]; then
     info "Mode: Production mode, all ports closed"
@@ -68,7 +68,7 @@ configure(){
 
   if [ ! -f "$STREAMPIPES_WORKDIR/.env" ]; then
     info "Configure $STREAMPIPES_WORKDIR/.env"
-    sed "s/##VERSION##/$(cat $STREAMPIPES_WORKDIR/VERSION)/g" \
+    sed "s/##VERSION##/$(cat $STREAMPIPES_WORKDIR/VERSION | grep -v '#' | awk NF)/g" \
         $STREAMPIPES_WORKDIR/bin/templates/env.template > $STREAMPIPES_WORKDIR/.env
   fi
 }
diff --git a/cli/bin/common b/cli/bin/common
index 5086a52..4d194f0 100644
--- a/cli/bin/common
+++ b/cli/bin/common
@@ -111,7 +111,7 @@ concatenate_compose_files() {
   no_ports=$1
   search_str="[environment:"
   docker_compose_files="docker-compose --env-file $STREAMPIPES_WORKDIR/.env"
-  
+
   while IFS='' read -r line; do
     [[ -n "$line" && "$line" != *"$search_str"* && "$line" != [[:blank:]#]* ]] &&
       if [ "$no_ports" = true ]; then
diff --git a/upgrade_versions.sh b/upgrade_versions.sh
index 26c9063..affcfa4 100755
--- a/upgrade_versions.sh
+++ b/upgrade_versions.sh
@@ -14,7 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-VERSION=$1
+NEW_VERSION=$1
 
 if [ "$#" -gt 1 ]; then
     fatal "Illegal number of arguments"
@@ -26,24 +26,62 @@ set_version(){
   case "$(uname -s)" in
       Darwin)
         # for MacOS
-        echo "$VERSION" > ./cli/VERSION
-        sed -i '' 's/SP_VERSION=.*/SP_VERSION='$VERSION'/g' ./compose/.env
-        sed -i '' 's/  version: .*/  version: "'$VERSION'"/g' ./k8s/values.yaml
+        cat << EOF > ./cli/VERSION
+# 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.
+
+$NEW_VERSION
+EOF
+        sed -i '' 's/SP_VERSION=.*/SP_VERSION='$NEW_VERSION'/g' ./compose/.env
+        sed -i '' 's/  version: .*/  version: "'$NEW_VERSION'"/g' ./k8s/values.yaml
+        sed -i '' 's/appVersion: .*/appVersion: "'$NEW_VERSION'"/g' ./k8s/Chart.yaml
+        sed -i '' 's/version: .*/version: '$NEW_VERSION'/g' ./k8s/Chart.yaml
 
         for opt in "${options[@]}"
         do
-          sed -i '' 's/\*\*Current version:\*\* .*/\*\*Current version:\*\* '$VERSION'/g' ./$opt/README.md
+          sed -i '' 's/\*\*Current version:\*\* .*/\*\*Current version:\*\* '$NEW_VERSION'/g' ./$opt/README.md
         done
         ;;
       *)
         # for Linux and Windows
-        echo "$VERSION" > ./cli/VERSION
-        sed -i 's/SP_VERSION=.*/SP_VERSION='$VERSION'/g' ./compose/.env
-        sed -i 's/  version: .*/  version: "'$VERSION'"/g' ./k8s/values.yaml
+        cat <<EOF>> ./cli/VERSION
+# 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.
+
+$NEW_VERSION
+EOF
+        sed -i 's/SP_VERSION=.*/SP_VERSION='$NEW_VERSION'/g' ./compose/.env
+        sed -i 's/  version: .*/  version: "'$NEW_VERSION'"/g' ./k8s/values.yaml
+        sed -i '' 's/appVersion: .*/appVersion: "'$NEW_VERSION'"/g' ./k8s/Chart.yaml
+        sed -i '' 's/version: .*/version: '$NEW_VERSION'/g' ./k8s/Chart.yaml
 
         for opt in "${options[@]}"
         do
-          sed -i 's/**Current version:** .*/**Current version:** '$VERSION'/g' ./$opt/README.md
+          sed -i 's/**Current version:** .*/**Current version:** '$NEW_VERSION'/g' ./$opt/README.md
         done
         ;;
   esac