Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move testflinger-server code to monorepo layout #131

Merged
merged 856 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
856 commits
Select commit Hold shift + click to select a range
ec674fb
Merge pull request #10 from canonical/pyproject-conversion
plars Jan 12, 2023
56a5c49
Remove currently unused logstash support
plars Jan 31, 2023
dc470ea
Fix changes requested by new version of black formatting
plars Feb 3, 2023
d0f4745
Merge pull request #30 from canonical/new-black-fixup
plars Feb 3, 2023
4d03533
Improve handling of maas errors and a few more pylint cleanups
plars Jan 3, 2023
3821763
minor cleanups
plars Jan 25, 2023
29c53f9
Improve error handling on failed commands in maas:deploy_node()
plars Feb 3, 2023
67582d4
Merge pull request #27 from canonical/maas2-better-error-handling
plars Feb 6, 2023
e0c4526
Merge pull request #29 from canonical/remove-logstash
plars Feb 7, 2023
3f8fcfd
Different way of getting IP address
plars Feb 6, 2023
2db9f85
Pylint cleanups on __init__.py
plars Feb 6, 2023
7b9d7c5
Remove ubuntu-device-format support
plars Feb 7, 2023
9e77a3b
Merge pull request #31 from canonical/pylint-sda-init
plars Feb 10, 2023
e260d8d
Fix a few use-dict-literal warnings from pylint
plars Feb 10, 2023
ef78488
Merge pull request #20 from plars/pylint-fix-dicts
plars Feb 10, 2023
f2da85c
Convert from setup.py to pyproject
plars Feb 10, 2023
e5b994a
Merge pull request #21 from plars/pyproject-conversion
plars Feb 13, 2023
346c363
Remove rpi3 device agent since we use muxpi instead now
plars Feb 13, 2023
03ef5b1
enable agent data (state, job, etc) to post to api server
hum4n0id Feb 16, 2023
7a1093b
update test_agent unit test to account for state
hum4n0id Feb 16, 2023
05e007f
update test_agent unit test to account for state
hum4n0id Feb 16, 2023
639835a
remove agent unit test changes
hum4n0id Feb 16, 2023
de3b529
Break out code to update results from the phase from run_test_phase
plars Feb 14, 2023
828641a
assign rmock post to var to scope failing job_data assertion
hum4n0id Feb 16, 2023
b8659fa
assign rmock post to var to scope failing job_data assertion
hum4n0id Feb 16, 2023
8653e3a
Merge pull request #14 from canonical/update-phase-results
plars Feb 17, 2023
8920adb
Merge pull request #32 from canonical/deprecate-rpi3-provisioning
plars Feb 17, 2023
7e7988f
pylint fixes for schema.py
plars Feb 17, 2023
5a94e19
Convert to using pyproject.toml for setup
plars Feb 17, 2023
58e67aa
Merge pull request #33 from canonical/pyproject-conversion
plars Feb 21, 2023
bb876cd
pack location and queue data in same request
hum4n0id Feb 22, 2023
ffd1816
clear job id data when on job exit
hum4n0id Feb 22, 2023
bbaafa7
add agent data logging (api)
hum4n0id Feb 22, 2023
8150402
add agent data logging (api)
hum4n0id Feb 22, 2023
a84760f
Restructure to use src-tree layout
plars Feb 17, 2023
c0d44c2
Merge pull request #34 from canonical/use-src-layout
plars Feb 22, 2023
51d8446
minor handler refactor
hum4n0id Feb 22, 2023
8c1259f
scope requests exception handling, req_logger matches logger level, f…
hum4n0id Feb 23, 2023
3d845c3
fix empty location and enforce adv_queue data type
hum4n0id Feb 23, 2023
73516c0
Add a starting place for the multi-device agent
plars Feb 22, 2023
89d37f6
consistent naming, proper buffer clear, contain request exceptions
hum4n0id Feb 24, 2023
12df5ac
consistent naming, proper buffer clear, contain request exceptions
hum4n0id Feb 24, 2023
4ba39c9
Merge pull request #35 from canonical/basic-multi-device-agent
plars Feb 24, 2023
d2bc308
Merge pull request #17 from canonical/schema-pylint
plars Feb 27, 2023
22096c2
minor refactoring - location and exception handling
hum4n0id Feb 28, 2023
f42deae
remove erroneous post method
hum4n0id Feb 28, 2023
e3599fb
enable atomic iteration over buffer queue to address deque mutation e…
hum4n0id Feb 28, 2023
407ea10
bump up request post timeout to avoid excessive resets
hum4n0id Feb 28, 2023
c5397d2
Merge pull request #18 from hum4n0id/agent_logging_requests
plars Feb 28, 2023
e8c0110
add location to test_agent config data
hum4n0id Mar 1, 2023
5f12016
added agent data mock request and associated mock data
hum4n0id Mar 1, 2023
1768df1
added agent data mock request and associated mock data
hum4n0id Mar 1, 2023
8acf208
Merge pull request #16 from canonical/renovate/actions-setup-python-4.x
plars Mar 1, 2023
6180910
update flush() logic to serially empty buffer
hum4n0id Mar 2, 2023
0feecb5
Remove unneeded mock data from test_agent
plars Mar 2, 2023
a1eed2a
Fix deprecated API
plars Mar 2, 2023
8a2cc14
Merge pull request #16 from hum4n0id/agent-data_agent_client
plars Mar 2, 2023
bbfac13
Improve exception handling
plars Mar 2, 2023
7f99499
Timeout multi-device jobs if we fail to reach allocated state before …
plars Mar 2, 2023
164881d
Remove references to check_job_state from agent since it moved to client
plars Mar 4, 2023
94711fd
Merge pull request #20 from canonical/exception-improvements
plars Mar 7, 2023
708bc6c
Use pathlib on muxpi agent
plars Mar 7, 2023
61d0e6f
Merge pull request #21 from canonical/remove-agent-check-job-state
plars Mar 9, 2023
f99372c
Add limerick device support to muxpi device agent
plars Mar 8, 2023
c4b701a
Merge pull request #36 from canonical/multi-device-allocate-timeout
plars Mar 9, 2023
60fd47f
Merge pull request #37 from canonical/muxpi-pathlib
plars Mar 9, 2023
521177a
Merge pull request #38 from canonical/limerick-support
plars Mar 10, 2023
b90969e
Fix exception expected for failed _run_control
plars Mar 10, 2023
9270ee7
Merge pull request #39 from canonical/wrong-exception
plars Mar 10, 2023
52bf12f
Remove the multiprocess cancellation watcher from process_jobs
plars Mar 10, 2023
6a21168
Fix deprecated requests.adapters.Retry API
plars Mar 10, 2023
5aaa152
Break out post_job_state to a method and rename set_agent_state
plars Mar 13, 2023
4389269
create the remote tmpdir for limerick in case it's missing
plars Mar 20, 2023
6ef8553
pylint cleanups on oemrecovery
plars Mar 21, 2023
a5b2d5e
Merge pull request #22 from canonical/simplify-process-jobs
plars Mar 21, 2023
39ac45e
Merge pull request #23 from canonical/fix-deprecated-api
plars Mar 21, 2023
230c239
Break out the sudo setup and also run it for limerick devices
plars Mar 22, 2023
f6ffa84
Change default logging level back to info
plars Mar 23, 2023
f2dd13d
Merge pull request #43 from canonical/default-loglevel-info
plars Mar 24, 2023
6b85cfb
Merge pull request #40 from canonical/limerick-fix-missing-remote-dir
plars Mar 25, 2023
3eaeb0e
Merge pull request #24 from canonical/post-job-state
plars Mar 27, 2023
4890031
Add oemscript device agent
plars Mar 29, 2023
8d8c7fe
setuptools is weird
plars Mar 29, 2023
72fad0c
post buffer at once
hum4n0id Mar 29, 2023
6d43978
Merge pull request #19 from hum4n0id/update_reqlog_flush
plars Mar 29, 2023
2a0fe46
Temporarily disable sending agent logs to the server
plars Mar 29, 2023
bb80fe5
Merge pull request #25 from canonical/temp-disable-sending-agent-logs
plars Mar 29, 2023
c413461
Revert "Remove the multiprocess cancellation watcher from process_jobs"
plars Mar 29, 2023
8c553c6
Merge pull request #26 from canonical/revert-simplify-multiprocess
plars Mar 29, 2023
b71970d
Merge pull request #42 from canonical/muxpi-configure-sudo
plars Mar 30, 2023
c0d5fd8
Inject allocate_data section into multi-agent sub-jobs
plars Mar 31, 2023
57d1dbd
Merge pull request #45 from canonical/multi-agent-inject-allocate-data
plars Apr 3, 2023
0e7ffc3
Merge pull request #41 from canonical/oemrecover-pylint-cleanups
plars Apr 3, 2023
d95d356
Add allocate subcommand for all devices
plars Apr 5, 2023
bf36aed
Move post-job-state to client
plars Apr 5, 2023
0d973b9
Merge pull request #27 from canonical/move-post-job-state
plars Apr 5, 2023
7abb76a
Merge pull request #44 from canonical/oemscript-provisioning
plars Apr 5, 2023
568a5e3
Merge pull request #47 from canonical/device-allocate-command2
plars Apr 5, 2023
9f07441
Run the allocate phase from the agent
plars Apr 5, 2023
941fa62
Add cleanup subcommand
plars Apr 5, 2023
90261cd
Transmit and use device_info gathered during the allocate phase for m…
plars Apr 5, 2023
09454bd
Get output when confirming tpm clear sent
plars Apr 7, 2023
5a4e02e
Merge pull request #49 from canonical/fix-maas-tpm-clear
plars Apr 12, 2023
ecd2931
Merge pull request #28 from canonical/agent-allocate-phase-handling
plars Apr 12, 2023
7a52e2d
Merge pull request #48 from canonical/multi-job-data
plars Apr 12, 2023
ba47040
implement agent data importation into influxdb
hum4n0id Apr 13, 2023
0b03438
implement agent data importation into influxdb
hum4n0id Apr 13, 2023
04786e2
import and del influxdb module to address unit tests (potentially temp)
hum4n0id Apr 13, 2023
d5c7ae7
remove unnecessary unit test module importations
hum4n0id Apr 13, 2023
00e2484
actually check influx env vars & add influxdb to pyprojectt.toml requ…
hum4n0id Apr 17, 2023
5dfac0f
remove try block around influx_client constructor
hum4n0id Apr 17, 2023
01e93bc
post phase, duration, result at once againt agent, job_id
hum4n0id Apr 17, 2023
11275e9
use config.get call to derive agent_id
hum4n0id Apr 17, 2023
37db8d5
remove kwargs (use args instead) from client.post_influx call)
hum4n0id Apr 17, 2023
e489e2e
move job_id to measurment field as a potential alternative to using t…
hum4n0id Apr 17, 2023
8aa3711
test if influxdb connection is established. allow empty INFLUX_USER &…
hum4n0id Apr 19, 2023
0ac97c1
move phase and result to tags
hum4n0id Apr 19, 2023
129bddd
Merge pull request #29 from hum4n0id/influx_agent_data
plars Apr 19, 2023
78e1840
Inject the parent job_id into subordinate jobs for multi-device
plars Apr 19, 2023
fe20df9
Wait for completion of the parent job then continue from allocate
plars Apr 19, 2023
988dff8
If the job is cancelled, exit the loop after terminating the process
plars Apr 20, 2023
6c00a4c
For multi-device jobs, detect if we get cancelled during the provisio…
plars Apr 20, 2023
178d6f1
create agent job db in influx if it doesn't exist
hum4n0id Apr 28, 2023
38564b2
use db list fetch as connectivity check instead of ping()
hum4n0id Apr 28, 2023
0eb2417
Download images directly for muxpi device agents
plars May 2, 2023
fbdfaf6
Move some of the remaining user-data content out of source and into f…
plars May 2, 2023
d60b4bf
use database creation as connection test
hum4n0id May 3, 2023
402b9ea
Merge pull request #31 from hum4n0id/create_influx_db
plars May 4, 2023
f521546
Add unit test for multi-device agent this_job_complete()
plars May 9, 2023
88377da
Multi-device: move check for parent completion out of the for loop
plars May 9, 2023
d066398
small static test fixes
plars May 9, 2023
21894d7
Merge pull request #30 from canonical/allocate-wait-for-completion
plars May 10, 2023
e88f8f8
Merge pull request #52 from canonical/multi-inject-parent-jobid
plars May 10, 2023
ad7cc67
meta-data is also needed for ubuntu core 16/18
plars May 12, 2023
453a7a7
Merge pull request #53 from canonical/muxpi-direct-downloads
plars May 15, 2023
61d7d46
Make curl fail for bad URLs in muxpi device agent
plars May 17, 2023
ce037e8
Simplify job processing by eliminating multiprocess
plars Apr 13, 2023
fc61c2e
Use read() instead of readline() in run_with_log()
plars Apr 14, 2023
5c01948
Remove _status_worker process
plars May 18, 2023
ac8e45c
Merge pull request #55 from canonical/muxpi-curl-fail-fast
plars May 18, 2023
1c34bb7
Merge pull request #54 from canonical/user-data-files
plars May 19, 2023
1ac31f7
Raise an exception if server URL isn't specified for multi-agent
plars Jun 13, 2023
42491cd
maas device agent storage module wip
hum4n0id Jun 15, 2023
be13426
Merge pull request #59 from canonical/ensure-multi-agent-tf-server-sp…
plars Jun 20, 2023
50ee738
Check job_list.json exists for multi-jobs and return error if missing
plars Jun 21, 2023
cd859e3
Merge pull request #62 from canonical/check-missing-job-list-file
plars Jun 21, 2023
163e310
Complete overhaul of maas_storage.py to functional version. Necessary…
hum4n0id Jun 26, 2023
4b0e82c
Complete overhaul of maas_storage.py to functional version. Necessary…
hum4n0id Jun 26, 2023
12f0721
Refined how partition data is returned in order to process formats an…
hum4n0id Jun 26, 2023
37f4450
Refined how partition data is returned in order to process formats an…
hum4n0id Jun 26, 2023
52ab567
Storage configuration must take place prior to allocation, in 'ready'…
hum4n0id Jun 26, 2023
f5d5dc9
Refine logic to verify that node is in a ready state.
hum4n0id Jun 26, 2023
1587eaf
Docstring additions and further refinement
hum4n0id Jun 26, 2023
3e963a5
Move verbose logging to debug level
hum4n0id Jun 27, 2023
86355ea
Cleanup
hum4n0id Jun 27, 2023
ec84670
Black reformatting
hum4n0id Jun 27, 2023
4dd3a09
Merge branch 'canonical:main' into maas_storage
hum4n0id Jun 28, 2023
281254b
Add support for tegra devices through muxpi agent
rmartin013 Jun 29, 2023
d1782e5
Add return statement to make sure we don't execute other control comm…
rmartin013 Jun 29, 2023
2d4c12f
Merge pull request #68 from rmartin013/muxpi-tegra
plars Jun 30, 2023
4e02418
Log errors instead of exceptions in tfclient
plars Jul 5, 2023
b7661f3
Merge pull request #71 from canonical/no-log-exception-tfclient
plars Jul 6, 2023
0d085db
Updated maas2.py, maas_storage.py to incorporate feedback and additio…
hum4n0id Jul 10, 2023
dd645e5
Update test_maas_storage.py
hum4n0id Jul 10, 2023
70f732b
Added preamble to tests
hum4n0id Jul 10, 2023
7b61240
Updated test path in import
hum4n0id Jul 10, 2023
e65b0ba
added module documentation and how to implement in a job definition
hum4n0id Jul 11, 2023
60a9aef
move test_process_partition assertion to 'assert_called_with'
hum4n0id Jul 11, 2023
9aca5e8
cleanup based on PR feedback
hum4n0id Jul 12, 2023
a504e42
cleanup based on PR feedback
hum4n0id Jul 12, 2023
6f286ee
cleanup based on PR feedback
hum4n0id Jul 12, 2023
5205841
cleanup and logic cleanup based on PR feedback
hum4n0id Jul 14, 2023
0eda514
Merge pull request #60 from hum4n0id/maas_storage
plars Jul 18, 2023
7ab7a25
Merge pull request #32 from canonical/remove-multiprocessing
plars Aug 2, 2023
e9e5171
The correct name of a complete job should be "complete"
plars Aug 3, 2023
7fc77ca
Fix state to be complete rather than completed for consistency
plars Aug 3, 2023
d0553a4
refine how we post agent data to influxdb for state timeline, status …
hum4n0id Aug 7, 2023
fe2c1f1
refine how we post agent data to influxdb for state timeline, status …
hum4n0id Aug 7, 2023
50675b0
Update config items in the README.rst
plars Aug 7, 2023
614c8cf
Support both "complete" and "completed" as a state while we migrate t…
plars Aug 8, 2023
d452e9b
Support both "complete" and "completed" as valid while we migrate to …
plars Aug 8, 2023
c72c1c2
Transitional patch to accept both complete and completed states as fi…
plars Aug 8, 2023
2ebbf80
Merge pull request #34 from hum4n0id/influx_updates
plars Aug 9, 2023
6df0d6f
Merge pull request #23 from canonical/accept-complete-and-completed
plars Aug 9, 2023
960714d
Merge pull request #72 from canonical/complete-typo
plars Aug 9, 2023
c786d47
Merge pull request #33 from canonical/fix-completed-invalid-state
plars Aug 9, 2023
c57da15
Update README.rst with information about job phases
plars Aug 16, 2023
2cbecbe
Merge pull request #35 from canonical/update-readme-conf-items
plars Aug 17, 2023
c5c2182
Tell the server not to decode gzipped artifact downloads
plars Aug 18, 2023
ce5bc65
Merge pull request #24 from canonical/no-decode-artifact-downloads
plars Aug 18, 2023
5d8a0b7
Add: Support for provisioning erlangen devices to muxpi agent
zongminl Aug 21, 2023
a2a3ee4
Fix black formatting issues
plars Aug 21, 2023
8f32787
A few updates to the readme
plars Aug 22, 2023
ad1716b
Fix: Change image_type "oem" to "ce-oem-iot" to better reflect the im…
zongminl Aug 23, 2023
6b0c1ec
Change: Using regex to check the image buildstamp format instead of o…
zongminl Aug 23, 2023
bf500f0
Merge branch 'add-support-erlangen' of github.com:zongminl/snappy-dev…
zongminl Aug 23, 2023
47f711f
Fix tox testing issue
zongminl Aug 23, 2023
ed3ecc1
Merge pull request #75 from canonical/readme-updates
plars Aug 24, 2023
1c8cc88
Don't automatically resubmit jobs when they fail to provision
plars Aug 24, 2023
9a97eb1
multi-device agents should ignore error 400 if job is already cancelled
plars Aug 27, 2023
6a8e812
Reuse sessions more when talking to the server
plars Aug 28, 2023
76b07b8
Merge pull request #37 from canonical/reuse-sessionss
plars Aug 28, 2023
2f23c5c
Merge pull request #78 from canonical/ignore-400-when-job-already-can…
plars Aug 31, 2023
1a1b17c
If parent job doesn't exist, don't poll the state during allocate
plars Aug 31, 2023
6ca542b
Update actions/checkout action to v4
renovate[bot] Sep 4, 2023
020cf51
Update actions/checkout action to v4
renovate[bot] Sep 4, 2023
10f38e0
Merge pull request #80 from canonical/renovate/actions-checkout-4.x
plars Sep 5, 2023
12d5ff6
Make noise if there's an unknown error during cancel
plars Sep 6, 2023
d3e7851
fixes the following issues: 74, 76, 77. Now successfully applies capt…
hum4n0id Sep 7, 2023
569d4b0
Merge pull request #26 from canonical/cancel-complain-unknown-errors
plars Sep 8, 2023
f347847
Merge pull request #25 from canonical/renovate/actions-checkout-4.x
plars Sep 10, 2023
7b139a2
Break out check_ce_oem_iot_image() and add unit tests
plars Sep 11, 2023
807181d
Incorporate suggested changes in PR82, and incorporated valid volume/…
hum4n0id Sep 12, 2023
a759d09
Incorporate suggested changes in PR82, and incorporated valid volume/…
hum4n0id Sep 12, 2023
5e339c6
Cleanup test_process_format logic
hum4n0id Sep 12, 2023
cbaae32
black reformating of test_process_format
hum4n0id Sep 12, 2023
8975f59
black reformating of test_process_format
hum4n0id Sep 12, 2023
4d0421e
Merge pull request #38 from canonical/no-check-missing-parent-job
plars Sep 12, 2023
40fb90a
Merge pull request #36 from canonical/no-resubmit-jobs
plars Sep 12, 2023
00e60e2
Merge pull request #82 from hum4n0id/maas_storage_fixes
plars Sep 12, 2023
7429d84
Add more ce-oem-iot image build stamps to cover different type of ima…
zongminl Sep 13, 2023
241e8c7
Merge pull request #73 from zongminl/add-support-erlangen
plars Sep 14, 2023
b3d0c05
Rename as much as we can of snappy-device-agents to testflinger-devic…
plars Sep 28, 2023
8f6d57f
Also support the old name for the entrypoint while we deprecate it
plars Sep 29, 2023
cbd6b8e
Merge pull request #84 from canonical/small-rename2
plars Oct 3, 2023
6e9ee1c
Fix module imported when calling the cli with the old name
plars Oct 5, 2023
a75ffee
Merge pull request #85 from canonical/fix-old-snappy-device-agent-com…
plars Oct 5, 2023
6baf802
Add oemscriptubr provisioning method
plars Aug 29, 2023
c54b9a2
split oemscript into lenovo and dell variants
plars Sep 5, 2023
9ab160e
Update path for new device agents to testflinger_device_connectors
plars Oct 5, 2023
0d687aa
Merge pull request #79 from canonical/oemscriptubr
plars Oct 5, 2023
a2eeddc
Update tegra image detection test and surcharge cloud-init user config
rmartin013 Oct 9, 2023
d7e0370
Merge pull request #87 from rmartin013/muxpi-tegra
plars Oct 11, 2023
e7b6818
rename omitted DeviceAgent
nancyc12 Oct 12, 2023
f72b3c5
Merge pull request #88 from canonical/fix-agent-rename
nancyc12 Oct 12, 2023
47900ac
[monorepo] move testflinger to /testflinger-server
plars Oct 17, 2023
594e83b
Monorepo related changes to testflinger-server .github dir
plars Oct 17, 2023
acd7923
Adapt docs dir to monorepo
plars Oct 17, 2023
a6cd39a
[monorepo] move testflinger-agent to /testflinger-agent
plars Oct 17, 2023
91552f3
merge testflinger-agent into testflinger monorepo
plars Oct 17, 2023
05f7f8b
Move testflinger-agent github workflows to monorepo location
plars Oct 17, 2023
95848e5
[monorepo] move testflinger-device-connectors to /testflinger-device-…
plars Oct 17, 2023
8778ccb
merge testflinger-device-connectors into testflinger monorepo
plars Oct 17, 2023
8cf1acf
Move testflinger-device-connectors github workflows to monorepo location
plars Oct 17, 2023
ccb4e86
[monorepo] move testflinger-cli to /testflinger-cli
plars Oct 17, 2023
8002716
merge testflinger-cli into testflinger monorepo
plars Oct 17, 2023
63f210b
Move testflinger-cli github workflows to monorepo location
plars Oct 17, 2023
c420dd0
Strip testflinger- prefix from directory names
plars Oct 20, 2023
86697fc
Update github workflows for the new directory structure
plars Oct 20, 2023
6d1c66c
Differentiate the names for each of the tox runs in github
plars Oct 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
name: Run unit tests
name: "[agent] Run unit tests"

on:
push:
branches: [ main ]
paths:
- agent/**
pull_request:
branches: [ main ]
paths:
- agent/**

jobs:
build:
defaults:
run:
working-directory: agent
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/cli-tox.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "[cli] Run unit tests"

on:
push:
branches: [ main ]
paths:
- cli/**
pull_request:
branches: [ main ]
paths:
- cli/**

jobs:
build:
defaults:
run:
working-directory: cli
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.8", "3.10"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install tox
run: pip install tox
- name: Run tests
run: |
tox
32 changes: 32 additions & 0 deletions .github/workflows/device-tox.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "[device-connectors] Run unit tests"

on:
push:
branches: [ main ]
paths:
- device-connectors/**
pull_request:
branches: [ main ]
paths:
- device-connectors/**

jobs:
build:
defaults:
run:
working-directory: device-connectors
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.8", "3.10"]
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install tox
run: pip install tox
- name: Run tests
run: |
tox
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
pull_request:
branches:
- main
paths:
- server/**

jobs:
build:
Expand All @@ -17,6 +19,6 @@ jobs:
- name: Check libraries
uses: canonical/charming-actions/[email protected]
with:
charm-path: charm
charm-path: server/charm
credentials: "${{ secrets.CHARMHUB_TOKEN }}"
github-token: "${{ secrets.GITHUB_TOKEN }}"
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
branches:
- main
paths:
- server/**

jobs:
build:
Expand All @@ -17,7 +19,7 @@ jobs:
- name: Upload charm to charmhub
uses: canonical/charming-actions/[email protected]
with:
charm-path: charm
charm-path: server/charm
credentials: "${{ secrets.CHARMHUB_TOKEN }}"
github-token: "${{ secrets.GITHUB_TOKEN }}"
upload-image: "true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ on:
push:
branches: ["main"]
tags: ["v*.*.*"]
paths:
- server/**

env:
REGISTRY: ghcr.io
Expand Down Expand Up @@ -37,7 +39,7 @@ jobs:
- name: Build and push backend Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
context: ./server
file: Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/server-tox.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "[server] Run unit tests"

on:
push:
branches: [ main ]
paths:
- server/**
pull_request:
branches: [ main ]
paths:
- server/**

jobs:
build:
defaults:
run:
working-directory: server
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.8", "3.10"]
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install tox
run: pip install tox
- name: Run tests
run: |
tox
12 changes: 12 additions & 0 deletions agent/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*~
.coverage
.vscode/
build/
env/
__pycache__/
*.py[cod]
*$py.class
*.conf
*.egg*
*.bak
.swp
8 changes: 8 additions & 0 deletions agent/.pmr-merge-hook
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

set -e

rm -rf tfenv
virtualenv -q -p python3 tfenv
. tfenv/bin/activate
./setup.py test
192 changes: 192 additions & 0 deletions agent/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
=================
Testflinger Agent
=================

Testflinger agent waits for job requests on a configured queue, then processes
them. The Testflinger Server submits those jobs, and once the job is complete,
the agent can submit outcome data with limited results back to the server.

Overview
--------

Testflinger-agent connects to the Testflinger microservice to request and
service requests for tests.

Installation
------------

To create a virtual environment and install testflinger-agent:

.. code-block:: console

$ virtualenv env
$ . env/bin/activate
$ ./setup install

Testing
-------

To run the unit tests, first install (see above) then:

.. code-block:: console

$ ./setup test

Configuration
-------------

Configuration is loaded from a yaml configuration file called
testflinger-agent.conf by default. You can specify a different file
to use for config data using the -c option.

The following configuration options are supported:

- **agent_id**:

- Unique identifier for this agent

- **polling_interval**:

- Time to sleep between polling for new tests (default: 10s)

- **server_address**:

- Host/IP and port of the testflinger server

- **execution_basedir**:

- Base directory to use for running jobs (default: /tmp/testflinger/run)

- **logging_basedir**:

- Base directory to use for agent logging (default: /tmp/testflinger/logs)

- **results_basedir**:

- Base directory to use for temporary storage of test results to be transmitted to the server (default: /tmp/testflinger/results)

- **logging_level**:

- Python loglevel name to use for logging (default: INFO)

- **logging_quiet**:

- Only log to the logfile, and not to the console (default: False)

- **job_queues**:

- List of queues that can be serviced by this device

- **advertised_queues**:

- List of public queue names that should be reported to the server to report to users

- **advertised_images**:

- List of images to associate with a queue name so that they can be referenced by name when using testflinger reserve

- **global_timeout**:

- Maximum global timeout (in seconds) a job is allowed to specify for this device agent. The job will timeout during the provision or test phase if it takes longer than the requested global_timeout to run. (Default 4 hours)

- **output_timeout**:

- Maximum output timeout (in seconds) a job is allowed to specify for this device agent. The job will timeout if there has been no output in the test phase for longer than the requested output_timeout. (Default 15 min.)

- **setup_command**:

- Command to run for the setup phase

- **provision_command**:

- Command to run for the provision phase

- **allocate_command**:

- Command to run for the allocate phase

- **test_command**:

- Command to run for the testing phase

- **reserve_command**:

- Command to run for the reserve phase

- **cleanup_command**:

- Command to run for the cleanup phase

Test Phases
-----------
The test will go through several phases depending on the configuration of the
test job and the configuration testflinger agent itself. If a <phase>_command
is not set in the testflinger-agent.conf (see above), then that phase will
be skipped. Even if the phase_command is configured, there are some phases
that are not mandatory, and will be skipped if the job does not contain data
for it, such as the provision, test, allocate, and reserve phases.

The following test phases are currently supported:

- **setup**:

- This phase is run first, and is used to setup the environment for the
test. The test job has no input for this phase and it is completely up to
the device owner to include commands that may need to run here.

- **provision**:

- This phase is run after the setup phase, and is used to provision the
device by installing (if possible) the image requested in the test job.
If the provision_data section is missing from the job, this phase will
not run.

- **test**:

- This phase is run after the provision phase, and is used to run the
test_cmds defined in the test_data section of the job. If the test_data
section is missing from the job, this will not run.

- **allocate**:

- This phase is normally only used by multi-device jobs and is used to
lock the agent into an allocated state to be externally controlled by
another job. During this phase, it will gather device_ip information
and push that information to the results data on the testflinger server
under the running job's job_id. Once that data is pushed successfully
to the server, it will transition the job to a **allocated** state, which
is just a signal that the parent job can make use of that data. The
**allocated** state is just a *job* state though, and not a phase that
needs a separate command configured on the agent.
Normally, the allocate_data section will be missing from the test job,
and this phase will be skipped.

- **reserve**:

- This phase is used for reserving a system for manual control. This
will push the requested ssh key specified in the job data to the
device once it's provisioned and ready for use, then publish output
to the polling log with information on how to reach the device over
ssh. If the reserve_data section is missing from the job, then this
phase will be skipped.

- **cleanup**:

- This phase is run after the reserve phase, and is used to cleanup the
device after the test. The test job has no input for this phase and
it is completely up to the device owner to include commands
that may need to run here.

Usage
-----

When running testflinger, your output will be automatically accumulated
for each stage (setup, provision, test, cleanup) and sent to the testflinger
server, along with an exit status for each stage. If any stage encounters a
non-zero exit code, no further stages will be executed, but the outcome will
still be sent.

If you have additional artifacts that you would like to save along with
the output, you can create a 'artifacts' directory from your test command.
Any files in the artifacts directory under your test execution directory
will automatically be compressed (tar.gz) and sent to the testflinger server.
Loading
Loading