|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: "v0.1.16 Dispatch Release" |
| 4 | +year: 2018 |
| 5 | +--- |
| 6 | + |
| 7 | +# v0.1.16 Dispatch Release |
| 8 | + |
| 9 | +[Download v0.1.16](https://github.com/vmware/dispatch/releases/tag/v0.1.16) |
| 10 | + |
| 11 | + |
| 12 | +## Support for contexts when working with Dispatch CLI [Breaking change] |
| 13 | +After installing Dispatch, a config file `HOME/.dispatch/config.json` is generated to store details about the Dispatch deployment. |
| 14 | +This file includes information like Dispatch API URL, authentication details or organization name. Until recently |
| 15 | +this meant that if you wanted to connect to multiple Dispatch deployments, you had to maintain multiple config files and shuffle them around |
| 16 | +every time you wanted to change the current environment. |
| 17 | + |
| 18 | +To make using multiple Dispatch deployments a little bit easier, in this release we introduce CLI contexts. |
| 19 | +CLI context is nothing more than a group of configuration options related to a particular Dispatch deployment. |
| 20 | +The `HOME/.dispatch/config.json` file can now store multiple contexts: |
| 21 | + |
| 22 | +```json |
| 23 | +{ |
| 24 | + "current": "dev", |
| 25 | + "contexts": { |
| 26 | + "dev": { |
| 27 | + "host": "dev.dispatch.example.com", |
| 28 | + "port": 443, |
| 29 | + "scheme": "", |
| 30 | + "organization": "dispatch", |
| 31 | + "cookie": "", |
| 32 | + "namespace": "dispatch" |
| 33 | + }, |
| 34 | + "prod": { |
| 35 | + "host": "prod.dispatch.example.com", |
| 36 | + "port": 443, |
| 37 | + "scheme": "", |
| 38 | + "organization": "dispatch", |
| 39 | + "cookie": "", |
| 40 | + "namespace": "dispatch" |
| 41 | + } |
| 42 | + } |
| 43 | +} |
| 44 | +``` |
| 45 | + |
| 46 | +Dispatch CLI allows you to list them: |
| 47 | + |
| 48 | +```shell |
| 49 | +$ dispatch manage context |
| 50 | + CONTEXT | CONFIG |
| 51 | +------------------------------------------------ |
| 52 | + dev | { |
| 53 | + | "host": "dev.dispatch.example.com", |
| 54 | + | "port": 443, |
| 55 | + | "scheme": "", |
| 56 | + | "organization": "dispatch", |
| 57 | + | "cookie": "", |
| 58 | + | "namespace": "dispatch" |
| 59 | + | } |
| 60 | + * prod | { |
| 61 | + | "host": "prod.dispatch.example.com", |
| 62 | + | "port": 443, |
| 63 | + | "scheme": "", |
| 64 | + | "organization": "dispatch", |
| 65 | + | "cookie": "", |
| 66 | + | "namespace": "dispatch" |
| 67 | + | } |
| 68 | +``` |
| 69 | + |
| 70 | +and set the active context: |
| 71 | +```shell |
| 72 | +$ dispatch manage context --set dev |
| 73 | +Set context to dev |
| 74 | + |
| 75 | +$ dispatch manage context |
| 76 | + CONTEXT | CONFIG |
| 77 | +------------------------------------------------ |
| 78 | + * dev | { |
| 79 | + | "host": "dev.dispatch.example.com", |
| 80 | + | "port": 443, |
| 81 | + | "scheme": "", |
| 82 | + | "organization": "dispatch", |
| 83 | + | "cookie": "", |
| 84 | + | "namespace": "dispatch" |
| 85 | + | } |
| 86 | + prod | { |
| 87 | + | "host": "prod.dispatch.example.com", |
| 88 | + | "port": 443, |
| 89 | + | "scheme": "", |
| 90 | + | "organization": "dispatch", |
| 91 | + | "cookie": "", |
| 92 | + | "namespace": "dispatch" |
| 93 | + | } |
| 94 | + |
| 95 | +``` |
| 96 | + |
| 97 | +**NOTE:** This change requires config file to be context-aware (old version of config won't work with new CLI, and vice-versa). |
| 98 | +
|
| 99 | +
|
| 100 | +## CLI login now works with service accounts |
| 101 | +Previously, `dispatch login` command only worked with OIDC users (e.g. when authentication has been configured using GitHub auth provider). |
| 102 | +Now you can run `dispatch login --service-account test-svc-account --jwt-private-key <path-to-key-file>` and the auth data will be stored in the dispatch config file. |
| 103 | +there is also a corresponding `dispatch logout` command to clear the credentials. Note that login takes your context into account and allows you to use |
| 104 | +different users for different environments. |
| 105 | +
|
| 106 | +
|
| 107 | +## Batch resource creation now supports all resource types |
| 108 | +One of the handy features of Dispatch CLI is batch creation of resources, where user can specify multiple resources using YAML file, and then create them all |
| 109 | +using `dispatch create -f file.yaml` command. In this release, the batch file supports all resource types (previously event drivers, driver types, event subscriptions and APIs were missing). |
| 110 | +
|
| 111 | +The following excerpt shows an example of a file that creates all currently supported resources: |
| 112 | +
|
| 113 | +```yaml |
| 114 | +kind: BaseImage |
| 115 | +name: nodejs-base |
| 116 | +dockerUrl: dispatchframework/nodejs-base:0.0.7 |
| 117 | +language: nodejs |
| 118 | +tags: |
| 119 | + - key: role |
| 120 | + value: test |
| 121 | +--- |
| 122 | +kind: Image |
| 123 | +name: nodejs |
| 124 | +baseImageName: nodejs-base |
| 125 | +tags: |
| 126 | + - key: role |
| 127 | + value: test |
| 128 | +--- |
| 129 | +kind: Function |
| 130 | +name: hello-js |
| 131 | +sourcePath: 'nodejs/hello.js' |
| 132 | +image: nodejs |
| 133 | +schema: |
| 134 | + in: |
| 135 | + properties: |
| 136 | + name: |
| 137 | + minLength: 1 |
| 138 | + pattern: "^[A-Za-z]+$" |
| 139 | + type: string |
| 140 | + place: |
| 141 | + minLength: 1 |
| 142 | + pattern: "^[A-Za-z]+$" |
| 143 | + type: string |
| 144 | + required: |
| 145 | + - name |
| 146 | + out: |
| 147 | + properties: |
| 148 | + myField: |
| 149 | + type: string |
| 150 | + required: |
| 151 | + - myField |
| 152 | +tags: |
| 153 | + - key: role |
| 154 | + value: test |
| 155 | +--- |
| 156 | +kind: Secret |
| 157 | +name: open-sesame |
| 158 | +secrets: |
| 159 | + password: OpenSesame |
| 160 | +tags: |
| 161 | + - key: role |
| 162 | + value: test |
| 163 | +--- |
| 164 | +kind: API |
| 165 | +name: post-hello |
| 166 | +enabled: true |
| 167 | +function: hello-py |
| 168 | +methods: |
| 169 | + - POST |
| 170 | +protocols: |
| 171 | + - https |
| 172 | +uris: |
| 173 | + - /hello |
| 174 | +tags: |
| 175 | + - key: role |
| 176 | + value : test |
| 177 | +--- |
| 178 | +kind: DriverType |
| 179 | +name: ticker |
| 180 | +image: kars7e/timer:latest |
| 181 | +tags: |
| 182 | + - key: role |
| 183 | + value : test |
| 184 | +--- |
| 185 | +kind: Driver |
| 186 | +name: ticker |
| 187 | +type: ticker |
| 188 | +config: |
| 189 | + - key: seconds |
| 190 | + value: 2 |
| 191 | +tags: |
| 192 | + - key: role |
| 193 | + value : test |
| 194 | +--- |
| 195 | +kind: Subscription |
| 196 | +event-type: ticker.tick |
| 197 | +function: hello-py |
| 198 | +name: ticker-sub |
| 199 | +source-type: ticker |
| 200 | +tags: |
| 201 | + - key: role |
| 202 | + value : test |
| 203 | +--- |
| 204 | +``` |
0 commit comments