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

Add --local-img flag to the shell script to use dev tag for local testing #275

Merged
merged 1 commit into from
Nov 23, 2022

Conversation

Divlik
Copy link
Contributor

@Divlik Divlik commented Nov 22, 2022

Add args to start command for flame shell script to replace the tag name inside helmchart values file

@Divlik Divlik marked this pull request as draft November 22, 2022 21:42
@Divlik Divlik marked this pull request as ready for review November 22, 2022 23:00
Copy link
Contributor

@myungjin myungjin left a comment

Choose a reason for hiding this comment

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

thanks for the PR. left two comments.

exposedb=true
fi
tag=""
for arg in "$@"; do
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be buggy because of line 218 (https://github.com/cisco-open/flame/pull/275/files#diff-c26314cc215f8cfbcb4f96f0ae8834a637f638dde7611c57148d786f9a3bfa48R218) which compares against a positional parameter.

I'd recommend the following command syntax:
./flame.sh <start [--exposedb] [--localimg] | stop>

I'd recommend to use "--localimg" to make the purpose of the argument is clearer. "--local" doesn't convey that we are using a local image.

The following example might be useful:

exposedb=false
tag=""
verb=${@:$OPTIND:1}
shift;

for arg in "$@"; do
    case "$arg" in
	"--exposedb") exposedb=true;;
	"--localimg") tag="dev";;
	*) echo "unknown option: $arg"; exit 1;;
    esac
done

echo $verb $exposedb $tag

Here you can use verb to replace $1 in lines 223 and 233.

The usage syntax in line 243 should be updated (https://github.com/cisco-open/flame/pull/275/files#diff-c26314cc215f8cfbcb4f96f0ae8834a637f638dde7611c57148d786f9a3bfa48R243).

fiab/flame.sh Outdated
@@ -47,7 +47,11 @@ function pre_start_stop_check {

function start {
# install the flame helm chart
helm install --create-namespace --namespace $RELEASE_NAME $RELEASE_NAME helm-chart/control/
if [ "$2" == "" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of using "$1" and "$2" in the start function, it may be better to assign variables for them.

exposedb=$1
tag=$2

@Divlik Divlik force-pushed the helm-local branch 2 times, most recently from 4e863a6 to be4d564 Compare November 23, 2022 12:18
Copy link
Contributor

@myungjin myungjin left a comment

Choose a reason for hiding this comment

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

Minor comments left. Please address them. Otherwise, lgtm.

fiab/flame.sh Outdated
esac
done

echo $verb $exposedb $tag
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this line. It's not necessary.

fiab/flame.sh Outdated
exposedb=$1
tag=$2
if [ "$tag" == "" ]; then
helm install --create-namespace --namespace $RELEASE_NAME $RELEASE_NAME helm-chart/control/
Copy link
Contributor

Choose a reason for hiding this comment

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

Use four spaces for indentation.

@Divlik Divlik force-pushed the helm-local branch 2 times, most recently from c763c17 to 15124f2 Compare November 23, 2022 17:15
@Divlik Divlik changed the title Add --local flag to the shell script to use dev tag for local testing Add --local-img flag to the shell script to use dev tag for local testing Nov 23, 2022
…ting

Add args to start command for flame shell script to replace the tag name inside helmchart values file
Copy link
Contributor

@myungjin myungjin left a comment

Choose a reason for hiding this comment

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

lgtm

@myungjin myungjin merged commit eb0dbc4 into cisco-open:main Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants