typesafehub / conductr-cli

CLI for Lightbend ConductR
Other
16 stars 21 forks source link

Conduct deploy: support bundle and optional configuration as input #465

Closed fsat closed 7 years ago

fsat commented 7 years ago

The resolver mechanisms used by conduct load is now also used for resolving bundle and optional configuration when supplied as input to conduct deploy command.

The conduct deploy command now uploads the resolved bundle and optional configuration to CD service which will then deploy it to ConductR. This is now the default behaviour of conduct deploy command.

Changes to --tag option

To target a specific bundles by tag using conduct deploy, specify the tag using the option --target-tag.

The --tag option is now used as part of the internal bndl command options, i.e. this will append a particular tag to a bundle to be uploaded to ConductR due to invocation of bndl command as part of conduct deploy.

Changes to webhook behaviour

The webhook behaviour is now triggered by specifying the --webhook option. --webhook bintray is the only option supported at the moment, and the conduct deploy command will simulate the Bintray webhook behaviour as before.

fsat commented 7 years ago

Manual test is done successfully.

Setup

Start the sandbox, and then deploy the CD bundle from https://github.com/typesafehub/conductr/pull/1798

+ sandbox run 2.0.5
+ conduct load /Users/felixsatyaputra/workspace/typesafe-fsat/conductr/continuous-delivery/target/bundle/continuous-delivery-0.1.0-36b65c498813891c6ba79c1fab14120d71fab56ff21e640115bb5fca06487762.zip /Users/felixsatyaputra/tmp/cd-test-config-8030a13232ae6328db2ecf1968ad019f2b9230f84436cb685559819194ba9a75.zip
+ conduct run conti

+ conduct info
ID               NAME                 VER  #REP  #STR  #RUN  ROLES
7dc78f8          eslite                v1     1     0     1  elasticsearch
36b65c4-8030a13  continuous-delivery   v3     1     0     1  continuous-delivery

Scenario: simple deployment

For simple deployment, a new bundle will be deployed into ConductR. A bundle is considered new if it's not yet loaded into ConductR.

In this scenario, the CLI output will be:

+ echo 'Deploying a new bundle'
Deploying a new bundle

+ conduct deploy -y visualizer
Retrieving bundle..
Loading bundle from cache typesafe/bundle/visualizer
Bintray credentials loaded from /Users/felixsatyaputra/.lightbend/commercial.credentials
Retrieving from cache /Users/felixsatyaputra/.conductr/cache/bundle/visualizer-v2-6cc7dbcf3b655b1942edf50a5574d62f5bbb12ef37db5b3990dc3fa80078b827.zip
[#################################################] 100%
Deployment batch id: 2b1c0ec2-ecd1-44bb-9e9c-606fabd0ac7d
Downloading bundle
Resolving compatible bundle
Deployment scheduled
Loading bundle..
Deploying new instance
Success

+ conduct info
ID               NAME                 VER  #REP  #STR  #RUN  ROLES
7dc78f8          eslite                v1     1     0     1  elasticsearch
36b65c4-8030a13  continuous-delivery   v3     1     0     1  continuous-delivery
6cc7dbc          visualizer            v2     1     0     1  web

Scenario: lock-step deployment

For lock-step deployment, a bundle will be deployed into ConductR to replace one or more existing running bundles.

+ echo 'Deploying a new bundle + config combination'
Deploying a new bundle + config combination

+ conduct deploy -y visualizer --env FOO=BAR
Retrieving bundle..
Loading bundle from cache typesafe/bundle/visualizer
Bintray credentials loaded from /Users/felixsatyaputra/.lightbend/commercial.credentials
Retrieving from cache /Users/felixsatyaputra/.conductr/cache/bundle/visualizer-v2-6cc7dbcf3b655b1942edf50a5574d62f5bbb12ef37db5b3990dc3fa80078b827.zip
[#################################################] 100%
Deployment batch id: d6e653f6-945e-4dde-98a0-259a0c51de7e
Targeting the following bundles
  6cc7dbc
Success

+ conduct info
ID               NAME                 VER  #REP  #STR  #RUN  ROLES
7dc78f8          eslite                v1     1     0     1  elasticsearch
36b65c4-8030a13  continuous-delivery   v3     1     0     1  continuous-delivery
6cc7dbc          visualizer            v2     1     0     0  web
6cc7dbc-4c7af08  visualizer            v2     1     0     1  web
fsat commented 7 years ago

The CD service should allow for an existing bundle not existing i.e. "conduct deploy" can be used as a short cut to "conduct load" and "conduct run"

fsat commented 7 years ago

Scenario: confirmation prompt

Felixs-MBP-2:conductr-cli felixsatyaputra$ conduct deploy visualizer
Retrieving bundle..
Loading bundle from cache typesafe/bundle/visualizer
Retrieving from cache /Users/felixsatyaputra/.conductr/cache/bundle/visualizer-v2-6cc7dbcf3b655b1942edf50a5574d62f5bbb12ef37db5b3990dc3fa80078b827.zip
Deploy visualizer-v2-6cc7dbcf3b655b1942edf50a5574d62f5bbb12ef37db5b3990dc3fa80078b827.zip? [Y/n]: n
Abort