typesafehub / conductr-cli

CLI for Lightbend ConductR
Other
16 stars 21 forks source link

Refactor bndl so that component configurations are modified more consistently between different input types #494

Closed longshorej closed 7 years ago

longshorej commented 7 years ago

This PR modifies bndl so that it behaves more consistently between component types. Notably, there's two changes here:

--component-description removed in favor of --description that now works with all component types, not just OCI, consistent with other flags like --endpoint and --volume.

The arguments are processed centrally in bndl_create.py whereas prior to this, for OCI/Docker inputs, they were processed in two places. This makes OCI inputs less special and more consistent with the other formats.

Fixes #491

longshorej commented 7 years ago

Manual Tests

Omitting description should result in description = ""

$ docker save dockercloud/hello-world | bndl --no-shazar | tar x
-> 0

$ cat hello-world/bundle.conf 
annotations {
  com {
    lightbend {
      conductr {
        oci-image-tags {
          hello-world = "latest"
        }
      }
    }
  }
}
components {
  hello-world {
    file-system-type = "oci-image"
    start-command = []
    endpoints {
      hello-world-tcp-80 {
        bind-protocol = "tcp"
        bind-port = 80
        service-name = "hello-world-tcp-80"
      }
    }
    description = ""
  }
  bundle-status {
    description = "Status check for the bundle component"
    file-system-type = "universal"
    start-command = [
      "check"
      "--any-address"
      "$HELLO_WORLD_TCP_80_HOST?retry-delay=10&retry-count=6"
    ]
    endpoints {}
  }
}
compatibilityVersion = "0"
diskSpace = 1073741824
memory = 402653184
name = "hello-world"
nrOfCpus = 0.1
roles = [
  "web"
]
system = "hello-world"
systemVersion = "0"
tags = [
  "0.0.1"
]
version = "1"-> 0

Specifying description should result in a populated description

$ docker save dockercloud/hello-world | bndl --description 'testing!' --no-shazar | tar x
-> 0
$ cat hello-world/bundle.conf 
annotations {
  com {
    lightbend {
      conductr {
        oci-image-tags {
          hello-world = "latest"
        }
      }
    }
  }
}
components {
  hello-world {
    file-system-type = "oci-image"
    start-command = []
    endpoints {
      hello-world-tcp-80 {
        bind-protocol = "tcp"
        bind-port = 80
        service-name = "hello-world-tcp-80"
      }
    }
    description = "testing!"
  }
  bundle-status {
    description = "Status check for the bundle component"
    file-system-type = "universal"
    start-command = [
      "check"
      "--any-address"
      "$HELLO_WORLD_TCP_80_HOST?retry-delay=10&retry-count=6"
    ]
    endpoints {}
  }
}
compatibilityVersion = "0"
diskSpace = 1073741824
memory = 402653184
name = "hello-world"
nrOfCpus = 0.1
roles = [
  "web"
]
system = "hello-world"
systemVersion = "0"
tags = [
  "0.0.1"
]
version = "1"-> 0

Chirper still works

$ conduct info
Licensed To: cc64df31-ec6b-4e08-bb6b-3216721a56b@lightbend
Max ConductR agents: 3
ConductR Version(s): 0.1.0, 2.1.*
Grants: akka-sbr, cinnamon, conductr

ID       NAME                           TAG  #REP  #STR  #RUN  ROLES
cc3f7b2  friend-impl           1.0-SNAPSHOT     1     0     1  web
a09e7e0  load-test-impl        1.0-SNAPSHOT     1     0     1  web
ec3a715  activity-stream-impl  1.0-SNAPSHOT     1     0     1  web
2b43b4d  chirp-impl            1.0-SNAPSHOT     1     0     1  web
a32763e  cassandra                              1     0     1  cassandra
09aef82  front-end             1.0-SNAPSHOT     1     0     1  web
-> 0
longshorej commented 7 years ago

Clean up some bndl arguments