Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
63 changes: 58 additions & 5 deletions .github/workflows/workstation-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,64 @@ jobs:
exit 1
fi

python3 -c 'import json,sys; j=json.loads(sys.stdin.read());
req=["profile","ok","gnome","required_missing","optional_missing","warnings"];
miss=[k for k in req if k not in j];
assert not miss, "missing keys: "+",".join(miss);
print("ok")' <<<"$out"
python3 -c '
import json, sys
j = json.loads(sys.stdin.read())
req = ["profile", "ok", "gnome", "required_missing", "optional_missing", "warnings"]
miss = [k for k in req if k not in j]
assert not miss, "missing keys: " + ",".join(miss)
assert isinstance(j["warnings"], list), "warnings must be a list"
assert isinstance(j["required_missing"], list), "required_missing must be a list"
assert isinstance(j["optional_missing"], list), "optional_missing must be a list"
assert isinstance(j["ok"], bool), "ok must be a bool"
assert isinstance(j["gnome"], bool), "gnome must be a bool"
print("ok: schema valid, warnings count=" + str(len(j["warnings"])))
' <<<"$out"

- name: Smoke: sourceos status --json warnings includes aggregate polish checks
run: |
set -euo pipefail
f='profiles/linux-dev/workstation-v0/bin/sourceos'

# Validate commands (as required by validation evidence requirement):
echo "CMD: bash -n $f"
bash -n "$f"
echo "PASS: bash -n"

echo "CMD: SOURCEOS_PROFILE_DIR=profiles/linux-dev/workstation-v0 bash $f status --json"
set +e
out=$(SOURCEOS_PROFILE_DIR=profiles/linux-dev/workstation-v0 bash "$f" status --json)
rc=$?
set -e
echo "exit code: $rc"

if [ "$rc" -ne 0 ] && [ "$rc" -ne 2 ]; then
echo "FAIL: unexpected exit code $rc" >&2
exit 1
fi
echo "PASS: exit code $rc is 0 or 2"

# Validate JSON schema and aggregate polish warning integration
python3 -c '
import json, sys
j = json.loads(sys.stdin.read())

# Schema check: all expected keys present
req = ["profile", "ok", "gnome", "required_missing", "optional_missing", "warnings"]
miss = [k for k in req if k not in j]
assert not miss, "missing keys: " + ",".join(miss)
print("PASS: all schema keys present:", req)

# Type check: warnings is a list (aggregate polish warnings integrate here)
assert isinstance(j["warnings"], list), "warnings must be a list"
print("PASS: warnings is list, count=" + str(len(j["warnings"])))
print("warnings:", j["warnings"])

# Confirm profile value
assert j["profile"] == "linux-dev/workstation-v0", "unexpected profile: " + str(j["profile"])
print("PASS: profile =", j["profile"])
' <<<"$out"
echo "PASS: aggregate polish warning integration validated"

- name: Drift guard: forbid legacy launcher strings
run: |
Expand Down
22 changes: 22 additions & 0 deletions profiles/linux-dev/workstation-v0/bin/sourceos
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,27 @@ status_check_lampstand_unit(){
[[ "$active" == "yes" || "$active" == "unknown" ]] || WARNINGS+=("lampstand user unit not active")
}

status_check_workstation_polish(){
local helper="$PROFILE_DIR/bin/check-workstation-polish.sh"
local out policy_ok

if [[ ! -f "$helper" ]]; then
WARNINGS+=("missing workstation polish helper: $helper")
return
fi

if ! out="$(bash "$helper" 2>/dev/null)"; then
WARNINGS+=("workstation polish helper failed")
return
fi

grep -Fqx 'mac_polish.helper=present' <<<"$out" || WARNINGS+=("mac polish helper missing")
grep -Fqx 'keyboard_policy.helper=present' <<<"$out" || WARNINGS+=("keyboard policy helper missing")

policy_ok="$(awk -F= '$1=="keyboard_policy.policy_ok" {print $2}' <<<"$out" | tail -n1)"
[[ "$policy_ok" == "yes" ]] || WARNINGS+=("keyboard policy is not valid")
}

status_collect(){
REQUIRED_MISSING=()
OPTIONAL_MISSING=()
Expand Down Expand Up @@ -355,6 +376,7 @@ status_collect(){

status_check_lampstand
status_check_lampstand_unit
status_check_workstation_polish

if gnome_detect; then
if ! check_bin gsettings; then
Expand Down