Skip to content

Commit 74cceee

Browse files
author
Derek
committed
fix: Linear CLI verify path, add test.sh for ansible testing
- Use full path for Linear CLI verify task (npm-global not in PATH during ansible) - Add ansible/test.sh for install.sh-equivalent testing flags
1 parent 9d5c008 commit 74cceee

2 files changed

Lines changed: 155 additions & 1 deletion

File tree

ansible/roles/dfe_developer_core/tasks/verify.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
become: false
5555

5656
- name: Verify Linear CLI
57-
ansible.builtin.command: "linear --version"
57+
ansible.builtin.command: "{{ dfe_user_home }}/.npm-global/bin/linear --version"
5858
register: verify_linear
5959
changed_when: false
6060
failed_when: verify_linear.rc != 0

ansible/test.sh

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
#!/bin/bash
2+
# Test script for running ansible playbooks with install.sh-equivalent flags
3+
#
4+
# Usage:
5+
# ./test.sh --all # Full installation (winlike)
6+
# ./test.sh --all --maclike # Full installation (maclike)
7+
# ./test.sh --core # Core tools only
8+
# ./test.sh --winlike # Just winlike GNOME config
9+
# ./test.sh --maclike # Just maclike GNOME config
10+
# ./test.sh --rdp # Just RDP config
11+
# ./test.sh --tags developer,base # Custom tags
12+
#
13+
# Requires inventory file at /tmp/inventory_test.yml or specify with -i
14+
15+
set -euo pipefail
16+
17+
INVENTORY="${INVENTORY:-/tmp/inventory_test.yml}"
18+
LIMIT=""
19+
TAGS=""
20+
EXTRA_ARGS=""
21+
22+
show_help() {
23+
cat << 'EOF'
24+
Usage: ./test.sh [OPTIONS] [ANSIBLE_ARGS...]
25+
26+
OPTIONS:
27+
--all Full installation: developer,base,core,advanced,vm,optimizer,rdp,winlike
28+
--all --maclike Full installation with maclike instead of winlike
29+
--core Core tools: developer,base,core,advanced
30+
--winlike Windows-style GNOME: developer,base,winlike
31+
--maclike macOS-style GNOME: developer,base,maclike
32+
--rdp RDP only: rdp
33+
--tags TAGS Custom tags (passed directly to ansible)
34+
--limit HOST Limit to specific host (fedora, ubuntu)
35+
-i INVENTORY Use custom inventory file
36+
--check Dry-run mode
37+
--help Show this help
38+
39+
EXAMPLES:
40+
./test.sh --all --limit fedora # Full install on Fedora only
41+
./test.sh --core --limit ubuntu # Core tools on Ubuntu only
42+
./test.sh --winlike --limit fedora # Just GNOME winlike on Fedora
43+
./test.sh --all --maclike --limit fedora # Full install with maclike
44+
45+
INVENTORY:
46+
Default: /tmp/inventory_test.yml
47+
Create with:
48+
cat > /tmp/inventory_test.yml << 'INV'
49+
[fedora]
50+
dfe-dev.tyrell.com.au ansible_user=dfe ansible_password=dfe ansible_become_password=dfe
51+
52+
[ubuntu]
53+
dfe-dev-u.tyrell.com.au ansible_user=dfe ansible_password=dfe ansible_become_password=dfe
54+
INV
55+
EOF
56+
exit 0
57+
}
58+
59+
# Parse arguments
60+
MACLIKE_OVERRIDE=false
61+
62+
while [[ $# -gt 0 ]]; do
63+
case $1 in
64+
--all)
65+
TAGS="developer,base,core,advanced,vm,optimizer,rdp,winlike"
66+
shift
67+
;;
68+
--core)
69+
TAGS="developer,base,core,advanced"
70+
shift
71+
;;
72+
--winlike)
73+
if [[ -z "$TAGS" ]]; then
74+
TAGS="developer,base,winlike"
75+
else
76+
TAGS="${TAGS},winlike"
77+
fi
78+
shift
79+
;;
80+
--maclike)
81+
MACLIKE_OVERRIDE=true
82+
if [[ -z "$TAGS" ]]; then
83+
TAGS="developer,base,maclike"
84+
else
85+
TAGS="${TAGS},maclike"
86+
fi
87+
shift
88+
;;
89+
--rdp)
90+
TAGS="rdp"
91+
shift
92+
;;
93+
--tags)
94+
TAGS="$2"
95+
shift 2
96+
;;
97+
--limit)
98+
LIMIT="--limit $2"
99+
shift 2
100+
;;
101+
-i)
102+
INVENTORY="$2"
103+
shift 2
104+
;;
105+
--check)
106+
EXTRA_ARGS="$EXTRA_ARGS --check"
107+
shift
108+
;;
109+
--help|-h)
110+
show_help
111+
;;
112+
*)
113+
EXTRA_ARGS="$EXTRA_ARGS $1"
114+
shift
115+
;;
116+
esac
117+
done
118+
119+
# Handle maclike override (remove winlike if maclike specified)
120+
if $MACLIKE_OVERRIDE && [[ "$TAGS" == *"winlike"* ]]; then
121+
echo "[INFO] maclike specified - removing winlike from tags"
122+
TAGS="${TAGS//,winlike/}"
123+
TAGS="${TAGS//winlike,/}"
124+
TAGS="${TAGS//winlike/}"
125+
fi
126+
127+
# Default tags if none specified
128+
if [[ -z "$TAGS" ]]; then
129+
TAGS="developer,base"
130+
fi
131+
132+
# Check inventory exists
133+
if [[ ! -f "$INVENTORY" ]]; then
134+
echo "[ERROR] Inventory file not found: $INVENTORY"
135+
echo "Create it with:"
136+
echo " cat > /tmp/inventory_test.yml << 'EOF'"
137+
echo " [fedora]"
138+
echo " dfe-dev.tyrell.com.au ansible_user=dfe ansible_password=dfe ansible_become_password=dfe"
139+
echo ""
140+
echo " [ubuntu]"
141+
echo " dfe-dev-u.tyrell.com.au ansible_user=dfe ansible_password=dfe ansible_become_password=dfe"
142+
echo " EOF"
143+
exit 1
144+
fi
145+
146+
echo "[INFO] Running: ansible-playbook -i $INVENTORY playbooks/main.yml --tags $TAGS $LIMIT $EXTRA_ARGS"
147+
echo ""
148+
149+
ansible-playbook \
150+
-i "$INVENTORY" \
151+
playbooks/main.yml \
152+
--tags "$TAGS" \
153+
$LIMIT \
154+
$EXTRA_ARGS

0 commit comments

Comments
 (0)