Skip to content

Commit

Permalink
Force the stack to be specified (#571)
Browse files Browse the repository at this point in the history
* Force the stack to be specified

* Fix up test

* Remove test for legacy non-stack deploy
  • Loading branch information
dboreham authored Oct 10, 2023
1 parent 1446e54 commit 420b1c2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
9 changes: 8 additions & 1 deletion app/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,16 @@
def command(ctx, include, exclude, env_file, cluster):
'''deploy a stack'''

# Although in theory for some subcommands (e.g. deploy create) the stack can be inferred,
# Click doesn't allow us to know that here, so we make providing the stack mandatory
stack = global_options2(ctx).stack
if not stack:
print("Error: --stack option is required")
sys.exit(1)

if ctx.parent.obj.debug:
print(f"ctx.parent.obj: {ctx.parent.obj}")
ctx.obj = create_deploy_context(global_options2(ctx), global_options2(ctx).stack, include, exclude, cluster, env_file)
ctx.obj = create_deploy_context(global_options2(ctx), stack, include, exclude, cluster, env_file)
# Subcommand is executed now, by the magic of click


Expand Down
2 changes: 1 addition & 1 deletion tests/deploy/run-deploy-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ if [ ! -f "$test_deployment_spec" ]; then
exit 1
fi
echo "deploy init test: passed"
$TEST_TARGET_SO deploy create --spec-file $test_deployment_spec --deployment-dir $test_deployment_dir
$TEST_TARGET_SO --stack test deploy create --spec-file $test_deployment_spec --deployment-dir $test_deployment_dir
# Check the deployment dir exists
if [ ! -d "$test_deployment_dir" ]; then
echo "deploy create test: deployment directory not present"
Expand Down
4 changes: 0 additions & 4 deletions tests/smoke-test/run-smoke-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,4 @@ $TEST_TARGET_SO --stack test deploy-system down
# Run same test but not using the stack definition
# Test building the a stack container
$TEST_TARGET_SO build-containers --include cerc/test-container
# Deploy the test container
$TEST_TARGET_SO deploy-system --include test up
# Clean up
$TEST_TARGET_SO deploy-system --include test down
echo "Test passed"

0 comments on commit 420b1c2

Please sign in to comment.