-
Notifications
You must be signed in to change notification settings - Fork 682
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Feature/update release scripts (#57) * Allow product release version(e.g. rc v0.1.2 or release v0.1.2.3) Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * Write `show_usage` in each scripts Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * Support experiment branch creation Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * Split parse_args.sh from pre_common_tasks.sh Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * Rename function Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * Update yq to v4 See https://mikefarah.gitbook.io/yq/v/v4.x/upgrading-from-v3 for more details. Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * fix directory name and add basename command Co-authored-by: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com>
- Loading branch information
1 parent
4d587c3
commit a753378
Showing
7 changed files
with
184 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCRIPT_DIR=$(cd $(dirname $0); pwd) | ||
source $SCRIPT_DIR/helper_functions.sh | ||
|
||
# Define functions | ||
function show_usage() { | ||
echo -e "Usage: create_experiment_branches.sh [--push|--delete] experiment_branch_name | ||
--push: | ||
Push branches or tags of autoware repositories. Please use this option when you can be sure. | ||
--delete: | ||
Delete branches or tags of autoware repositories. Please use this option when you mistook something. | ||
experiment_branch_name: | ||
The version to be used for experiment branches. | ||
The valid pattern is '^[0-9a-zA-Z][0-9a-zA-Z-]+$'. | ||
Note: Using --push and --delete at the same time may cause unexpected behaviors." | ||
} | ||
|
||
function create_experiment_branch() { | ||
repository="$1" | ||
if [ "$repository" = "" ]; then | ||
echo -e "Please input a repository name as the 1st argument" | ||
return 1 | ||
fi | ||
|
||
git_command="git --work-tree=$repository --git-dir=$repository/.git" | ||
|
||
experiment_branch=experiment/$autoware_version | ||
$git_command checkout --quiet -b $experiment_branch | ||
|
||
if [ "$push" ]; then | ||
$git_command push origin $experiment_branch | ||
fi | ||
|
||
if [ "$delete" ]; then | ||
$git_command checkout --detach --quiet HEAD | ||
$git_command branch -D --quiet $experiment_branch | ||
fi | ||
} | ||
|
||
# Parse arguments | ||
source $SCRIPT_DIR/parse_args.sh | ||
|
||
# Check version | ||
if ! is_valid_autoware_experiment_version $autoware_version; then | ||
echo -e "\e[31mPlease input a valid autoware experiment version as the 1st argument\e[m" | ||
show_usage | ||
exit 1 | ||
fi | ||
|
||
# Pre common tasks | ||
source $SCRIPT_DIR/pre_common_tasks.sh | ||
|
||
# Create experiment branches in autoware repositories | ||
echo -e "\e[36mCreate experiment branches in autoware repositories\e[m" | ||
for autoware_repository in $(get_autoware_repositories); do | ||
create_experiment_branch $autoware_repository | ||
done | ||
|
||
# Pre common tasks | ||
source $SCRIPT_DIR/post_common_tasks.sh | ||
|
||
# Create experiment branch in autoware.proj | ||
echo -e "\e[36mCreate experiment branch in autoware.proj\e[m" | ||
create_experiment_branch . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCRIPT_DIR=$(cd $(dirname $0); pwd) | ||
source $SCRIPT_DIR/helper_functions.sh | ||
|
||
# Define functions | ||
function parse_args(){ | ||
while [ "${1:-}" != "" ]; do | ||
case "$1" in | ||
"-h" | "--help") | ||
help=true | ||
;; | ||
"--push") | ||
push=true | ||
;; | ||
"--delete") | ||
delete=true | ||
;; | ||
*) | ||
autoware_version="$1" | ||
esac | ||
shift | ||
done | ||
} | ||
|
||
# Parse arguments | ||
parse_args $@ | ||
|
||
if [ "$help" ]; then | ||
show_usage | ||
exit 0 | ||
fi | ||
|
||
if [ "$push" ]; then | ||
read -p "You are going to push branches or tags. Do you really want to continue? [y/N] " answer | ||
|
||
case $answer in | ||
[yY]* ) | ||
;; | ||
* ) | ||
echo -e "\e[33mCanceled \e[0m" | ||
exit 1 | ||
;; | ||
esac | ||
fi | ||
|
||
if [ "$delete" ]; then | ||
read -p "You are going to delete branches or tags. Do you really want to continue? [y/N] " answer | ||
|
||
case $answer in | ||
[yY]* ) | ||
;; | ||
* ) | ||
echo -e "\e[33mCanceled \e[0m" | ||
exit 1 | ||
;; | ||
esac | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters