Merge lp:~noise/tanuki-agent/misc-tweaks4 into lp:tanuki-agent

Proposed by Bret Barker
Status: Merged
Approved by: Bret Barker
Approved revision: 128
Merged at revision: 128
Proposed branch: lp:~noise/tanuki-agent/misc-tweaks4
Merge into: lp:tanuki-agent
Diff against target: 243 lines (+71/-52)
2 files modified
.bzrignore (+1/-0)
docs/tutorial.md (+70/-52)
To merge this branch: bzr merge lp:~noise/tanuki-agent/misc-tweaks4
Reviewer Review Type Date Requested Status
Celso Providelo (community) Approve
Review via email: mp+275733@code.launchpad.net

Commit message

lots of little wording and section name changes

To post a comment you must log in.
Revision history for this message
Celso Providelo (cprov) wrote :

Thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.bzrignore'
--- .bzrignore 2015-10-08 21:35:21 +0000
+++ .bzrignore 2015-10-26 15:54:41 +0000
@@ -5,3 +5,4 @@
5__pycache__5__pycache__
6run6run
7version_info.py7version_info.py
8docs/*.html
89
=== modified file 'docs/tutorial.md'
--- docs/tutorial.md 2015-10-22 21:15:03 +0000
+++ docs/tutorial.md 2015-10-26 15:54:41 +0000
@@ -20,7 +20,7 @@
2020
21In order to complete this tutorial, you will need the following resources:21In order to complete this tutorial, you will need the following resources:
2222
23- A host computer running [Ubuntu 14.04](http://www.ubuntu.com/download/desktop), with an SD card reader.23- A host computer running [Ubuntu 14.04](http://www.ubuntu.com/download/desktop), with an SD card reader and at least 6 GB free drive space.
24- A [Raspberry Pi 2 Model B](https://www.raspberrypi.org/products/raspberry-pi-2-model-b/).24- A [Raspberry Pi 2 Model B](https://www.raspberrypi.org/products/raspberry-pi-2-model-b/).
25- A minimum 4GB Micro SDHC card.25- A minimum 4GB Micro SDHC card.
26- The host computer and Raspberry Pi connected on the same local ethernet network.26- The host computer and Raspberry Pi connected on the same local ethernet network.
@@ -30,7 +30,7 @@
3030
31## Introduction to Snappy Product Integration (SPI)31## Introduction to Snappy Product Integration (SPI)
3232
33SPI (Snappy Product Integration) is the system you will use to model your33Snappy Product Integration (SPI) is the system you will use to model your
34product such that proposed updates will be automatically tested. Once34product such that proposed updates will be automatically tested. Once
35configured, you will have the ability to prevent identified-broken updates from35configured, you will have the ability to prevent identified-broken updates from
36reaching your customers.36reaching your customers.
@@ -73,7 +73,7 @@
7373
74IMPORTANT SECURITY NOTE:74IMPORTANT SECURITY NOTE:
7575
76The config file now has data (```consumer_secret```, ```token_secret```, and ```token_key```) equivalent to your user and password. 76The config file now has data (```consumer_secret```, ```token_secret```, and ```token_key```) that are equivalent to your password.
7777
78You are responsible for storing this securely. The device on which the78You are responsible for storing this securely. The device on which the
79Agent runs should be protected from unauthorized access.79Agent runs should be protected from unauthorized access.
@@ -103,7 +103,11 @@
103103
104 ./agent.py --register config.ini104 ./agent.py --register config.ini
105105
106If you get a 401 error like:106You should see something like:
107
108 [agent-queue] Registered at https://spi.canonical.com/orgs/my-org/labs/agent-groups/default
109
110If you get a 401 error:
107111
108 {112 {
109 "id": "unauthorized",113 "id": "unauthorized",
@@ -125,9 +129,11 @@
125129
126## Product update testing walkthrough130## Product update testing walkthrough
127131
128### Base/Test image setup {.c4 .c19 .c25 .c44}132### Creating a Product Image
129133
130On your host computer, first install the latest snappy tools:134#### Host Setup
135
136Now it is time to create your first product based on Ubuntu Core. On your host computer, first install the latest snappy tools:
131137
132 sudo add-apt-repository ppa:snappy-dev/tools138 sudo add-apt-repository ppa:snappy-dev/tools
133 sudo apt-get update139 sudo apt-get update
@@ -136,6 +142,8 @@
136142
137See [Snappy Getting Started Guide](https://developer.ubuntu.com/en/snappy/start/) for further details.143See [Snappy Getting Started Guide](https://developer.ubuntu.com/en/snappy/start/) for further details.
138144
145#### Image Building
146
139Next, you will create an image for RPI2 from the rolling/edge channel, with our test-snap pre-installed:147Next, you will create an image for RPI2 from the rolling/edge channel, with our test-snap pre-installed:
140148
141 wget https://spi.canonical.com/assets/test-snap_1_all.snap149 wget https://spi.canonical.com/assets/test-snap_1_all.snap
@@ -154,9 +162,14 @@
154Then uncompress the downloaded file:162Then uncompress the downloaded file:
155163
156 unxz spi-test_pi2.img.xz164 unxz spi-test_pi2.img.xz
157 165
166When you are working with your real product you will substitute in your custom oem and application snaps. See [OEM snappy package](https://developer.ubuntu.com/en/snappy/guides/oem/) for more information.
167
168#### Provisioning the RPi2
169
158Now, because remotely flashing the Raspberry Pi is still in development, you170Now, because remotely flashing the Raspberry Pi is still in development, you
159will need to manually flash an SD card with the image.171will need to manually flash an SD card with the image. We are going to do a walkthrough of this now
172to ensure that you have everything setup correctly.
160173
161On the host machine, insert your SD card and determine which device it is (using ```df -h``` or other tools). 174On the host machine, insert your SD card and determine which device it is (using ```df -h``` or other tools).
162175
@@ -175,57 +188,60 @@
175If the device is not accessible, you can troubleshoot by using a serial188If the device is not accessible, you can troubleshoot by using a serial
176cable to get a console on the RPi2, see [these instructions](http://elinux.org/RPi_Serial_Connection). Note the pins are the same for RPi1 and RPi2.189cable to get a console on the RPi2, see [these instructions](http://elinux.org/RPi_Serial_Connection). Note the pins are the same for RPi1 and RPi2.
177190
178### Configure SPI191### Product and Test Setup
179192
180For SPI to generate tests in case of new snap revisions, some configuration needs to be done.193For SPI to generate tests in case of new snap revisions, some configuration needs to be done.
181194
182The Manifest will describe how your product is built, and has the basic information that allows SPI to detect changes that affects your product when a new snap revision is available. When this happens, SPI will use the information in the Test Specification to trigger the corresponding tests.195The Manifest will describe how your product is built, and has the basic information that allows SPI to detect changes that affect your product when a new snap revision is available. When this happens, SPI will use the information in the Test Specification to trigger the corresponding tests.
183196
184To create a Manifest, you need to issue an HTTP request specifying the197To create a Manifest, you need to issue an HTTP request specifying the following:
185following:
186198
187- ```image_name```: the name of the image you will be testing, to relate the Manifest to the Test Specs we will be creating later199- ```image_name```: the name of the image you will be testing, to relate the Manifest to the Test Specs we will be creating later
188- ```release```: the Snappy release this products aims for200- ```release```: the Ubuntu Core release this products aims for (currently "15.04" or "rolling")
189- ```base_image_reference```: the URL where to download the image201- ```base_image_reference```: a pointer to the base image, in this case a URL pointing to the image binary
190- ```snaps```: the list of snaps that the product uses202- ```snaps```: the list of snaps that that comprise the product
191203
192So, in the agent directory execute the following from your computer (where you already authenticated during the lab setup above):204So, in the agent directory execute the following from your computer (where you already authenticated during the lab setup above):
193205
194 ./api_example.py -X POST config.ini https://spi.canonical.com/orgs/$ORGANIZATION/products/manifests --data '{206 ./api_example.py -X POST config.ini https://spi.canonical.com/orgs/$ORGANIZATION/products/manifests --data '{
195 "image_name": "tutorial-raspi2-image",207 "image_name": "tutorial-raspi2-image",
196 "release": "rolling-core",208 "release": "rolling",
197 "base_image_reference": "https://spi.canonical.com/assets/spi-test_pi2.img.xz",209 "base_image_reference": "https://spi.canonical.com/assets/spi-test_pi2.img.xz",
198 "snaps": [["test-snap.spi-test", 1, false],210 "snaps": [
199 ["ubuntu-core.canonical", null, false]]211 ["ubuntu-core.canonical", null, false],
212 ["test-snap.spi-test", 1, false],
213 ["webdm.canonical", null, false]]
200 }'214 }'
201215
202Note particularly that one of the snaps is the one used for this Tutorial, in version 1; we'll trigger the tests when a new version comes available for it.216Note "test-snap" is our sample application snap that we'll be using to trigger the tests when a new version becomes available, and we start here with sequence 1 in our base image.
203217
204Then, create the Test Specification, specifying:218Next you'll define your test scenario via a Test Specification, with the following fields:
205219
206- ```platform```: the platform where image will be installed and test run220- ```name```: a unique reference to identify tests and their results
207- ```image_name```: the same than we put in the Manifest above221- ```image_name```: the same that we put in the Manifest above
208- ```name```: just a reference so later the system can show you which test this is222- ```platform```: defines the target device and is used to route tests to the proper agents.
209- ```test_payload```: information for the test to be run; in this case we put where the tests can be downloaded, and the command to trigger their execution223- ```test_payload```: information for the test to be run; in this case we put where the tests can be downloaded, and the command to trigger their execution
210224
211So, execute the following:225So, execute the following:
212226
213 ./api_example.py -X POST config.ini https://spi.canonical.com/orgs/$ORGANIZATION/tests/specs --data '{227 ./api_example.py -X POST config.ini https://spi.canonical.com/orgs/$ORGANIZATION/tests/specs --data '{
228 "name": "Tutorial Example Test Specification",
229 "image_name": "tutorial-raspi2-image",
214 "platform": "spi-tutorial-raspi2",230 "platform": "spi-tutorial-raspi2",
215 "image_name": "tutorial-raspi2-image",231 "test_payload": {
216 "name": "Tutorial Example Test Specification",232 "tarball_url": "https://spi.canonical.com/assets/test_tarball.tar.gz",
217 "test_payload": {233 "test_cmd": "./test"
218 "tarball_url": "https://spi.canonical.com/assets/test_tarball.tar.gz",
219 "test_cmd": "./test"
220 }234 }
221 }'235 }'
222236
223At this point SPI is configured and supervising the Store for new237At this point SPI is configured for your Product and Tests and will supervise the Store for new
224versions of your snap.238versions of the snaps listed in your Manifest.
225239
226### Trigger/running of actual tests240### Your First Test Run
227241
228Now we'll tell SPI manually that a new version of the snap we're using for the tutorial is available:242#### Triggering Tests
243
244Now we'll tell the system manually that a new version of the snap we're using for the tutorial is available:
229245
230 ./api_example.py -X POST config.ini https://spi.canonical.com/orgs/$ORGANIZATION/snap-revisions --data '{246 ./api_example.py -X POST config.ini https://spi.canonical.com/orgs/$ORGANIZATION/snap-revisions --data '{
231 "name": "test-snap.spi-test",247 "name": "test-snap.spi-test",
@@ -234,29 +250,32 @@
234250
235In the response there are the ```test_opportunity_id``` and ```image_unique_id``` fields that will be used next, please keep them around.251In the response there are the ```test_opportunity_id``` and ```image_unique_id``` fields that will be used next, please keep them around.
236252
237At this point the SPI has generated a message that is waiting to be consumed by our Agent, and when that message arrives the Agent will try to run the commands to provision, setup and run the tests. For that we need to put useful commands in the config file. So, edit ```config.ini``` and replace the following three fields (the path needs to be absolute, be sure to replace the correct values):253#### Agent Provisioning Kit Setup
254
255At this point the system has generated a message that is waiting to be consumed by your Agent, and when that message arrives the Agent will try to run the commands to provision, setup and run the tests. Together these scripts are called a "Provisioning Kit", and we have provided a sample kit for this tutorial and as a starting point for your own projects.
256
257So, edit ```config.ini``` and replace the following three fields (the path needs to be absolute, be sure to replace the correct values):
238258
239 provcommand = PATH_TO_AGENT/rpi2-sample-provkit/provision259 provcommand = PATH_TO_AGENT/rpi2-sample-provkit/provision
240 setupcommand = PATH_TO_AGENT/rpi2-sample-provkit/setup260 setupcommand = PATH_TO_AGENT/rpi2-sample-provkit/setup
241 testcommand = PATH_TO_AGENT/rpi2-sample-provkit/runtest261 testcommand = PATH_TO_AGENT/rpi2-sample-provkit/runtest
242262
243Next step, then, is to start the Agent to get that message and start running the test. As of this moment, we'd need to set up the Raspberry Pi manually, so the Agent after receiving the test to run will produce some instructions to get an image and burn it into the device, so please follow those instructions and let the Agent know when you're ready (it will wait for you to press Enter).263Next step, then, is to start the Agent to consume that test opportunity message and start running the test. As remote flashing of the Raspberry Pi is still in development, we'll need to set up the Raspberry Pi manually. After receiving the test to run, the Agent will produce some instructions to get an image and burn it into the device, so please follow those instructions and let the Agent know when you're ready (it will wait for you to press Enter).
244264
245So, run:265Here we go:
246266
247 ./agent.py --once config.ini267 ./agent.py --once config.ini
248268
249After executing the test, the Agent will automatically retrieve the269After executing the test, the Agent will automatically retrieve the
250results and send them back to SPI. 270results and send them back to the system.
251271
252Note that during the provisioning you may get instructions to write the Raspberry Pi's card again; for the case of the tutorial this is not needed, as you already did this step before.272Note that during the provisioning you will be instructed to flash the Raspberry Pi's card again; for the case of the tutorial you may skip this step since you flashed the image earlier during the "Provisioning the RPi2" setup step.
253273
254274
255### How to check tests results and/or progress275#### Checking Test Progress and Results
256276
257At any time, you can check the progress of any tests generated in the277At any time, you can check the progress of tests generated in the
258system, where they stands (to be run, or already run, etc), checking the278system (replace ```<test_opportunity_id>``` with the one you saved from "Triggering Tests" above):
259events in the system:
260279
261 ./api_example.py config.ini \280 ./api_example.py config.ini \
262 https://spi.canonical.com/orgs/$ORGANIZATION/tests/events?test_opportunity_id=<test_opportunity_id>281 https://spi.canonical.com/orgs/$ORGANIZATION/tests/events?test_opportunity_id=<test_opportunity_id>
@@ -268,7 +287,7 @@
268 ./api_example.py config.ini \287 ./api_example.py config.ini \
269 https://spi.canonical.com/orgs/$ORGANIZATION/tests/events?image_unique_id=<unique_image_id>288 https://spi.canonical.com/orgs/$ORGANIZATION/tests/events?image_unique_id=<unique_image_id>
270289
271You can see the results produced for all products within an organisation by running:290You can see the results produced for all products within an organization by running:
272291
273 ./api_example.py config.ini https://spi.canonical.com/orgs/$ORGANIZATION/tests/events292 ./api_example.py config.ini https://spi.canonical.com/orgs/$ORGANIZATION/tests/events
274293
@@ -286,6 +305,5 @@
286305
287### Ubuntu Core update testing306### Ubuntu Core update testing
288307
289
290### New Gold Master Candidate Testing308### New Gold Master Candidate Testing
291309

Subscribers

People subscribed via source and target branches

to all changes: