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
1=== modified file '.bzrignore'
2--- .bzrignore 2015-10-08 21:35:21 +0000
3+++ .bzrignore 2015-10-26 15:54:41 +0000
4@@ -5,3 +5,4 @@
5 __pycache__
6 run
7 version_info.py
8+docs/*.html
9
10=== modified file 'docs/tutorial.md'
11--- docs/tutorial.md 2015-10-22 21:15:03 +0000
12+++ docs/tutorial.md 2015-10-26 15:54:41 +0000
13@@ -20,7 +20,7 @@
14
15 In order to complete this tutorial, you will need the following resources:
16
17-- A host computer running [Ubuntu 14.04](http://www.ubuntu.com/download/desktop), with an SD card reader.
18+- 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.
19 - A [Raspberry Pi 2 Model B](https://www.raspberrypi.org/products/raspberry-pi-2-model-b/).
20 - A minimum 4GB Micro SDHC card.
21 - The host computer and Raspberry Pi connected on the same local ethernet network.
22@@ -30,7 +30,7 @@
23
24 ## Introduction to Snappy Product Integration (SPI)
25
26-SPI (Snappy Product Integration) is the system you will use to model your
27+Snappy Product Integration (SPI) is the system you will use to model your
28 product such that proposed updates will be automatically tested. Once
29 configured, you will have the ability to prevent identified-broken updates from
30 reaching your customers.
31@@ -73,7 +73,7 @@
32
33 IMPORTANT SECURITY NOTE:
34
35-The config file now has data (```consumer_secret```, ```token_secret```, and ```token_key```) equivalent to your user and password.
36+The config file now has data (```consumer_secret```, ```token_secret```, and ```token_key```) that are equivalent to your password.
37
38 You are responsible for storing this securely. The device on which the
39 Agent runs should be protected from unauthorized access.
40@@ -103,7 +103,11 @@
41
42 ./agent.py --register config.ini
43
44-If you get a 401 error like:
45+You should see something like:
46+
47+ [agent-queue] Registered at https://spi.canonical.com/orgs/my-org/labs/agent-groups/default
48+
49+If you get a 401 error:
50
51 {
52 "id": "unauthorized",
53@@ -125,9 +129,11 @@
54
55 ## Product update testing walkthrough
56
57-### Base/Test image setup {.c4 .c19 .c25 .c44}
58-
59-On your host computer, first install the latest snappy tools:
60+### Creating a Product Image
61+
62+#### Host Setup
63+
64+Now it is time to create your first product based on Ubuntu Core. On your host computer, first install the latest snappy tools:
65
66 sudo add-apt-repository ppa:snappy-dev/tools
67 sudo apt-get update
68@@ -136,6 +142,8 @@
69
70 See [Snappy Getting Started Guide](https://developer.ubuntu.com/en/snappy/start/) for further details.
71
72+#### Image Building
73+
74 Next, you will create an image for RPI2 from the rolling/edge channel, with our test-snap pre-installed:
75
76 wget https://spi.canonical.com/assets/test-snap_1_all.snap
77@@ -154,9 +162,14 @@
78 Then uncompress the downloaded file:
79
80 unxz spi-test_pi2.img.xz
81-
82+
83+When 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.
84+
85+#### Provisioning the RPi2
86+
87 Now, because remotely flashing the Raspberry Pi is still in development, you
88-will need to manually flash an SD card with the image.
89+will need to manually flash an SD card with the image. We are going to do a walkthrough of this now
90+to ensure that you have everything setup correctly.
91
92 On the host machine, insert your SD card and determine which device it is (using ```df -h``` or other tools).
93
94@@ -175,57 +188,60 @@
95 If the device is not accessible, you can troubleshoot by using a serial
96 cable 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.
97
98-### Configure SPI
99+### Product and Test Setup
100
101 For SPI to generate tests in case of new snap revisions, some configuration needs to be done.
102
103-The 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.
104+The 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.
105
106-To create a Manifest, you need to issue an HTTP request specifying the
107-following:
108+To create a Manifest, you need to issue an HTTP request specifying the following:
109
110 - ```image_name```: the name of the image you will be testing, to relate the Manifest to the Test Specs we will be creating later
111-- ```release```: the Snappy release this products aims for
112-- ```base_image_reference```: the URL where to download the image
113-- ```snaps```: the list of snaps that the product uses
114+- ```release```: the Ubuntu Core release this products aims for (currently "15.04" or "rolling")
115+- ```base_image_reference```: a pointer to the base image, in this case a URL pointing to the image binary
116+- ```snaps```: the list of snaps that that comprise the product
117
118 So, in the agent directory execute the following from your computer (where you already authenticated during the lab setup above):
119
120 ./api_example.py -X POST config.ini https://spi.canonical.com/orgs/$ORGANIZATION/products/manifests --data '{
121 "image_name": "tutorial-raspi2-image",
122- "release": "rolling-core",
123+ "release": "rolling",
124 "base_image_reference": "https://spi.canonical.com/assets/spi-test_pi2.img.xz",
125- "snaps": [["test-snap.spi-test", 1, false],
126- ["ubuntu-core.canonical", null, false]]
127+ "snaps": [
128+ ["ubuntu-core.canonical", null, false],
129+ ["test-snap.spi-test", 1, false],
130+ ["webdm.canonical", null, false]]
131 }'
132
133-Note 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.
134-
135-Then, create the Test Specification, specifying:
136-
137-- ```platform```: the platform where image will be installed and test run
138-- ```image_name```: the same than we put in the Manifest above
139-- ```name```: just a reference so later the system can show you which test this is
140+Note "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.
141+
142+Next you'll define your test scenario via a Test Specification, with the following fields:
143+
144+- ```name```: a unique reference to identify tests and their results
145+- ```image_name```: the same that we put in the Manifest above
146+- ```platform```: defines the target device and is used to route tests to the proper agents.
147 - ```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
148
149 So, execute the following:
150
151 ./api_example.py -X POST config.ini https://spi.canonical.com/orgs/$ORGANIZATION/tests/specs --data '{
152+ "name": "Tutorial Example Test Specification",
153+ "image_name": "tutorial-raspi2-image",
154 "platform": "spi-tutorial-raspi2",
155- "image_name": "tutorial-raspi2-image",
156- "name": "Tutorial Example Test Specification",
157- "test_payload": {
158- "tarball_url": "https://spi.canonical.com/assets/test_tarball.tar.gz",
159- "test_cmd": "./test"
160+ "test_payload": {
161+ "tarball_url": "https://spi.canonical.com/assets/test_tarball.tar.gz",
162+ "test_cmd": "./test"
163 }
164 }'
165
166-At this point SPI is configured and supervising the Store for new
167-versions of your snap.
168-
169-### Trigger/running of actual tests
170-
171-Now we'll tell SPI manually that a new version of the snap we're using for the tutorial is available:
172+At this point SPI is configured for your Product and Tests and will supervise the Store for new
173+versions of the snaps listed in your Manifest.
174+
175+### Your First Test Run
176+
177+#### Triggering Tests
178+
179+Now we'll tell the system manually that a new version of the snap we're using for the tutorial is available:
180
181 ./api_example.py -X POST config.ini https://spi.canonical.com/orgs/$ORGANIZATION/snap-revisions --data '{
182 "name": "test-snap.spi-test",
183@@ -234,29 +250,32 @@
184
185 In the response there are the ```test_opportunity_id``` and ```image_unique_id``` fields that will be used next, please keep them around.
186
187-At 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):
188+#### Agent Provisioning Kit Setup
189+
190+At 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.
191+
192+So, edit ```config.ini``` and replace the following three fields (the path needs to be absolute, be sure to replace the correct values):
193
194 provcommand = PATH_TO_AGENT/rpi2-sample-provkit/provision
195 setupcommand = PATH_TO_AGENT/rpi2-sample-provkit/setup
196 testcommand = PATH_TO_AGENT/rpi2-sample-provkit/runtest
197
198-Next 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).
199+Next 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).
200
201-So, run:
202+Here we go:
203
204 ./agent.py --once config.ini
205
206 After executing the test, the Agent will automatically retrieve the
207-results and send them back to SPI.
208-
209-Note 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.
210-
211-
212-### How to check tests results and/or progress
213-
214-At any time, you can check the progress of any tests generated in the
215-system, where they stands (to be run, or already run, etc), checking the
216-events in the system:
217+results and send them back to the system.
218+
219+Note 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.
220+
221+
222+#### Checking Test Progress and Results
223+
224+At any time, you can check the progress of tests generated in the
225+system (replace ```<test_opportunity_id>``` with the one you saved from "Triggering Tests" above):
226
227 ./api_example.py config.ini \
228 https://spi.canonical.com/orgs/$ORGANIZATION/tests/events?test_opportunity_id=<test_opportunity_id>
229@@ -268,7 +287,7 @@
230 ./api_example.py config.ini \
231 https://spi.canonical.com/orgs/$ORGANIZATION/tests/events?image_unique_id=<unique_image_id>
232
233-You can see the results produced for all products within an organisation by running:
234+You can see the results produced for all products within an organization by running:
235
236 ./api_example.py config.ini https://spi.canonical.com/orgs/$ORGANIZATION/tests/events
237
238@@ -286,6 +305,5 @@
239
240 ### Ubuntu Core update testing
241
242-
243 ### New Gold Master Candidate Testing
244

Subscribers

People subscribed via source and target branches

to all changes: