OK-5123 Add validate playbook and update readme#61
Conversation
spikeburton
left a comment
There was a problem hiding this comment.
General question about this one - this specifically validates that both the primary tooling (Engine) is installed, as well as Android specific tooling (considered "additional").
As not everyone will install the Android tooling, does it make sense to separate this into different roles/playbooks?
Or - alternatively - add tags, so at least you can pass --skip-tags for the Android tooling validation?
| # ── Android SDK ── | ||
| - name: "Validate: sdkmanager exists" | ||
| ansible.builtin.stat: | ||
| path: /opt/android-sdk/cmdline-tools/latest/bin/sdkmanager |
There was a problem hiding this comment.
Instead of having the tasks directly in the playbook - I would move them to a role. I would also add role defaults for the paths.
In fact, we have a role already that defines the default path here. See how this is included in another role (example here)
Similar comment for the other paths (Java, run-avd script etc.) - we have vars defined for these in the roles
There was a problem hiding this comment.
- Created
roles/validatewithtasks,defaults, andmeta(depends onandroid_sdk_common,mirroring sdkmanager_install) - Moved Java home to
android_sdk_commonasandroid_sdk_common_java_home, removedinstall_android_sdk_java_homefrominstall_android_sdk - Removed
validate_java_pathfromvalidatedefaults - Engine / run-avd / socat paths kept as
validate_*defaults
| register: engine_binary | ||
| failed_when: not engine_binary.stat.exists | ||
|
|
||
| # Engine socket validation disabled — the become/sudo stat on the socket |
There was a problem hiding this comment.
Do we need this comment?
Also - below we run orka-engine image list. Which communicates with the server over the socket. So this check is not necessary ... if image list fails, the server is not running
There was a problem hiding this comment.
Yeah this is not a good comment to leave in. Absolutely should take it out.
As for the engine binary existence and running orka-engine image list, these are used in 2 different places throughout the validation workflow I was working on in the monorepo. Checking for the binary after installation, and then checking orka-engine image list after pulling an image.
Here is the workflow in the monorepo for more context. https://github.com/macstadium/monorepo-dev/pull/23537/changes
Co-authored-by: Spike Burton <44298491+spikeburton@users.noreply.github.com>
Summary
Adds
validate.yml, a new playbook that performs idempotent checks against target hosts to confirm the engine, Android SDK, SDK components, and OCI images are installed correctly.Why
There hasn't been a built-in way to verify a host is correctly provisioned after running the install playbooks. Operators have had to either:
validate.ymlmakes the verification explicit and reusable — a single playbook anyone (CLI users, CI workflows, customers integrating this orchestration into their own pipelines) can run to confirm a host is in the expected state.Design
ansible.builtin.statfor path existence checks andansible.builtin.commandfor the OCI image list query — nobecomeor shell module calls. Safe to run alongside other workflows without side effects.--skip-tags sdk-components,images--tags sdk-componentssdkmanager_install.yml--tags imagesplatform— Android platform to check for (default:android-36)image_types— Comma-separated list of system image types (default:default,google_apis)image_name— Substring (orname:tag) to look for in the engine's image list (default:sequoia)Test plan
validate.yml— confirm it fails on the first missing checkinstall_engine.yml+install_android_sdk.yml, then runvalidate.yml --skip-tags sdk-components,images— confirm passessdkmanager_install.yml, then runvalidate.yml --tags sdk-components— confirm passespull_image.ymlwith a known image, then runvalidate.yml --tags images -e "image_name=<that-image>"— confirm passesvalidate.yml(full, no tags) on a fully-provisioned host — confirm all checks pass and the summary line is displayed