xlab-si / xopera-opera

xOpera orchestrator compliant with TOSCA YAML v1.3 in the making
https://xlab-si.github.io/xopera-docs/
Apache License 2.0
35 stars 14 forks source link

Add new opera deploy cli command options #71

Closed anzoman closed 4 years ago

anzoman commented 4 years ago

The discussion in #46 showed that it would be necessary to add some optional arguments to opera deploy command. In this commit we did just that in order to address the new features which are:

# deploy (start from the beginning, fail when already deployed)
opera deploy -i inputs.yaml service.yaml

# resume (start from the point of failure)
opera deploy --resume -i inputs.yaml service.yaml

# force (start over)
opera deploy --force -i inputs.yaml service.yaml

a) Wise men once said that TOSCA orchestrator should treat each deployment separately and distinguish it from all other deployments that have been/would be created before/after. And because opera treats deployments based on file system storage location (i.e. hidden .opera folder) we went on and implemented a different deployment behaviour. So if user tries to deploy again on already deployed instance model an error is raised telling that deployment has already been done.

b) On the other hand users would often like to continue where they left or where their deployment process has been interrupted (for example because of some error in Ansible playbook) and this would then skip all the instances that have been deployed. To realize that we added --resume or -r option where user can continue his orchestration.

c) And lastly DevOps engineers would sometimes prefer to re-run the whole deployment from the starting point without skipping the tasks that were successfully deployed. For that cases --force or -f optional CLI argument was introduced which erases the previous instance model and create a new, fresh one. And to have no worries we ensured that --resume and --force options are mutually exclusive.


The remaining commit messages in this PR are based on #55 which is ready to be merged. This also means that the changes work when using opera init command before deploying so that user can do opera deploy {--force|--resume}.


Resolves #46

anzoman commented 4 years ago

cc @cankarm and @dradx just to let you know that things are moving forward here. If you have any new suggestions considering this PR (and our discussion in #46) you can also express them here.

cankarm commented 4 years ago

I don't have further comments, LGTM.

@dradX?

anzoman commented 4 years ago

The latest CLI options we have are:

# deploy (start from the beginning, warning when already deployed)
opera deploy -i inputs.yaml service.yaml

# resume (start from the point of failure)
opera deploy --resume/-r -i inputs.yaml service.yaml

# clean-state (clean instances folder and start over the deployment)
opera deploy --clean-state/-c -i inputs.yaml service.yaml

# force option skips prompts and warnings
opera deploy -r/-c --force/-f -i inputs.yaml service.yaml

@sstanovnik, can you take a look? :)

sstanovnik commented 4 years ago

The new commands are much clearer as to what they do, yes. A couple of questions:

I could read the code thoroughly to answer the last two, but I think it's better that this gets discussed as an explicit decision :)

anzoman commented 4 years ago

@sstanovnik to answer you questions:

sstanovnik commented 4 years ago

Great, this now looks very much usable. If there are any changes for uses we haven't thought of, let's just decide on that later. :thumbs-up: