From 0bf8862ba176db18e2c9a7291c486a91e88604cb Mon Sep 17 00:00:00 2001 From: jtbaird Date: Tue, 28 Apr 2020 11:28:17 -0400 Subject: [PATCH 1/3] adding system_release.sh script --- docker/system_release.sh | 61 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100755 docker/system_release.sh diff --git a/docker/system_release.sh b/docker/system_release.sh new file mode 100755 index 00000000..3cd6ec2f --- /dev/null +++ b/docker/system_release.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +# Copyright (C) 2018-2020 LEIDOS. +# +# Licensed 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. + +# This script takes a system release name and version number as arguments, and +# updates version dependencies in Dockerfile and /docker/checkout.sh accordingly. + +if [[ $# -eq 0 ]]; then + echo "Enter the system release name:" + read RELEASE_NAME + echo "Enter the system release version number:" + read RELEASE_VERSION +else + while [[ $# -gt 0 ]]; do + arg="$1" + case $arg in + -u|--unprompted) + RELEASE_NAME=$2 + RELEASE_VERSION=$3 + shift + shift + shift + ;; + esac +done +fi + +SYSTEM_RELEASE=carma-system-$RELEASE_VERSION +RELEASE_BRANCH=release/$RELEASE_NAME + +if git ls-remote -q | grep $RELEASE_BRANCH; then + echo "Checking out $RELEASE_BRANCH branch." + git checkout $RELEASE_BRANCH + + echo "Updating checkout.sh to point to system release version." + sed -i "s|CARMA[a-zA-Z]*_[0-9]*\.[0-9]*\.[0-9]*|$SYSTEM_RELEASE|g; s|carma-[a-zA-Z]*-[0-9]*\.[0-9]*\.[0-9]*|$SYSTEM_RELEASE|g" docker/checkout.sh + + echo "Updating Dockerfile to point to system release version." + sed -i "s|:CARMASystem_[0-9]*\.[0-9]*\.[0-9]*|:$SYSTEM_RELEASE|g; s|:carma-system-[0-9]*\.[0-9]*\.[0-9]*|:$SYSTEM_RELEASE|g; s|:[0-9]*\.[0-9]*\.[0-9]*|:$SYSTEM_RELEASE|g" Dockerfile + + git add . + + git commit -m "Updated dependencies for $SYSTEM_RELEASE" + + git tag -a $SYSTEM_RELEASE -m "$SYSTEM_RELEASE version tag." +else + echo "$RELEASE_BRANCH does not exist. Exiting script." + exit 0 +fi From 0dede42c40da8b47877b264c520a574e93edd03f Mon Sep 17 00:00:00 2001 From: jtbaird Date: Tue, 28 Apr 2020 13:16:24 -0400 Subject: [PATCH 2/3] Added to comments --- docker/system_release.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docker/system_release.sh b/docker/system_release.sh index 3cd6ec2f..2b3bf9c7 100755 --- a/docker/system_release.sh +++ b/docker/system_release.sh @@ -17,6 +17,9 @@ # This script takes a system release name and version number as arguments, and # updates version dependencies in Dockerfile and /docker/checkout.sh accordingly. +# The -u | --unprompted option can be used to skip the interactive prompts, and +# provide arguments directly from the commandline. + if [[ $# -eq 0 ]]; then echo "Enter the system release name:" read RELEASE_NAME @@ -55,6 +58,8 @@ if git ls-remote -q | grep $RELEASE_BRANCH; then git commit -m "Updated dependencies for $SYSTEM_RELEASE" git tag -a $SYSTEM_RELEASE -m "$SYSTEM_RELEASE version tag." + + echo "Dockerfile and checkout.sh updated, committed, and tagged." else echo "$RELEASE_BRANCH does not exist. Exiting script." exit 0 From 45d04c4a7271cd790615a5975aa6b3e0362a1f8a Mon Sep 17 00:00:00 2001 From: jtbaird Date: Thu, 30 Apr 2020 09:01:43 -0400 Subject: [PATCH 3/3] specified git add input --- docker/system_release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/system_release.sh b/docker/system_release.sh index 2b3bf9c7..83d72b0e 100755 --- a/docker/system_release.sh +++ b/docker/system_release.sh @@ -53,7 +53,7 @@ if git ls-remote -q | grep $RELEASE_BRANCH; then echo "Updating Dockerfile to point to system release version." sed -i "s|:CARMASystem_[0-9]*\.[0-9]*\.[0-9]*|:$SYSTEM_RELEASE|g; s|:carma-system-[0-9]*\.[0-9]*\.[0-9]*|:$SYSTEM_RELEASE|g; s|:[0-9]*\.[0-9]*\.[0-9]*|:$SYSTEM_RELEASE|g" Dockerfile - git add . + git add docker/checkout.sh Dockerfile git commit -m "Updated dependencies for $SYSTEM_RELEASE"