Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding system_release.sh script #38

Merged
merged 2 commits into from
Apr 28, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions docker/system_release.sh
Original file line number Diff line number Diff line change
@@ -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.
jtbaird marked this conversation as resolved.
Show resolved Hide resolved

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this work on repos that do not have carma- in the name?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There will be some modifications to the script depending on repos. For example some won't have to update checkout.sh and/or Dockerfile at all.


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