Skip to content

Commit d551d21

Browse files
(MAINT) install ubuntu packages
1 parent 93fc6ea commit d551d21

File tree

1 file changed

+64
-90
lines changed

1 file changed

+64
-90
lines changed

.github/workflows/test-install-matrix.yaml

Lines changed: 64 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -85,62 +85,19 @@ jobs:
8585
echo "=== Creating Docker transport inventory ==="
8686
8787
# Get container information
88-
container_info=$(docker ps --format "{{.Names}}" | grep -v NAMES)
88+
container_info=($(docker ps --format "{{.Names}}" | grep -v NAMES))
89+
container_count=${#container_info[@]}
8990
9091
# Create new inventory with version 2 format and Docker transport
9192
cat > ./inventory.yaml << 'EOF'
9293
version: 2
93-
groups:
94-
- name: pe_nodes
95-
targets:
96-
EOF
97-
98-
# Add each container as a target
99-
for container_name in $container_info; do
100-
echo " - name: $container_name" >> ./inventory.yaml
101-
echo " uri: $container_name" >> ./inventory.yaml
102-
echo " config:" >> ./inventory.yaml
103-
echo " transport: docker" >> ./inventory.yaml
104-
echo " docker:" >> ./inventory.yaml
105-
echo " container-name: $container_name" >> ./inventory.yaml
106-
done
107-
108-
echo "=== New Docker transport inventory.yaml ==="
109-
cat ./inventory.yaml
110-
echo ::endgroup::
111-
echo ::group::info:request
112-
cat request.json || true; echo
113-
echo ::endgroup::
114-
echo ::group::create docker transport inventory
115-
echo "=== Creating Docker transport inventory ==="
116-
117-
# Get container information
118-
container_info=($(docker ps --format "{{.Names}}" | grep -v NAMES))
119-
container_count=${#container_info[@]}
120-
121-
# Create new inventory with version 2 format and Docker transport
122-
cat > ./inventory.yaml << 'EOF'
123-
version: 2
12494
groups:
12595
- name: pe_nodes
12696
targets:
12797
EOF
12898
12999
# Assign roles based on architecture
130100
case "${{ matrix.architecture }}" in
131-
"standard")
132-
if [ $container_count -ge 1 ]; then
133-
echo " - name: ${container_info[0]}" >> ./inventory.yaml
134-
echo " uri: ${container_info[0]}" >> ./inventory.yaml
135-
echo " vars:" >> ./inventory.yaml
136-
echo " role: primary" >> ./inventory.yaml
137-
echo " config:" >> ./inventory.yaml
138-
echo " transport: docker" >> ./inventory.yaml
139-
echo " docker:" >> ./inventory.yaml
140-
echo " container: ${container_info[0]}" >> ./inventory.yaml
141-
echo " tmpdir: /var/tmp" >> ./inventory.yaml # Use alternative temp dir
142-
fi
143-
;;
144101
"standard-with-dr")
145102
if [ $container_count -ge 2 ]; then
146103
# Primary
@@ -152,7 +109,7 @@ jobs:
152109
echo " transport: docker" >> ./inventory.yaml
153110
echo " docker:" >> ./inventory.yaml
154111
echo " container: ${container_info[0]}" >> ./inventory.yaml
155-
echo " tmpdir: /var/tmp" >> ./inventory.yaml # Use alternative temp dir
112+
echo " tmpdir: /var/tmp" >> ./inventory.yaml
156113
# Replica
157114
echo " - name: ${container_info[1]}" >> ./inventory.yaml
158115
echo " uri: ${container_info[1]}" >> ./inventory.yaml
@@ -162,55 +119,18 @@ jobs:
162119
echo " transport: docker" >> ./inventory.yaml
163120
echo " docker:" >> ./inventory.yaml
164121
echo " container: ${container_info[1]}" >> ./inventory.yaml
165-
echo " tmpdir: /var/tmp" >> ./inventory.yaml # Use alternative temp dir
122+
echo " tmpdir: /var/tmp" >> ./inventory.yaml
166123
fi
167124
;;
168-
"large")
169-
if [ $container_count -ge 2 ]; then
170-
# Primary
171-
echo " - name: ${container_info[0]}" >> ./inventory.yaml
172-
echo " uri: ${container_info[0]}" >> ./inventory.yaml
173-
echo " vars:" >> ./inventory.yaml
174-
echo " role: primary" >> ./inventory.yaml
175-
echo " config:" >> ./inventory.yaml
176-
echo " transport: docker" >> ./inventory.yaml
177-
echo " docker:" >> ./inventory.yaml
178-
echo " container: ${container_info[0]}" >> ./inventory.yaml
179-
echo " tmpdir: /var/tmp" >> ./inventory.yaml # Use alternative temp dir
180-
# Compiler(s)
181-
for ((i=1; i<container_count; i++)); do
182-
echo " - name: ${container_info[i]}" >> ./inventory.yaml
183-
echo " uri: ${container_info[i]}" >> ./inventory.yaml
184-
echo " vars:" >> ./inventory.yaml
185-
echo " role: compiler" >> ./inventory.yaml
186-
echo " config:" >> ./inventory.yaml
187-
echo " transport: docker" >> ./inventory.yaml
188-
echo " docker:" >> ./inventory.yaml
189-
echo " container: ${container_info[i]}" >> ./inventory.yaml
190-
echo " tmpdir: /var/tmp" >> ./inventory.yaml # Use alternative temp dir
191-
done
192-
fi
193-
;;
194-
# Add other architectures as needed
195-
*)
196-
echo "Architecture ${{ matrix.architecture }} not fully implemented, using simple setup"
197-
for container_name in "${container_info[@]}"; do
198-
echo " - name: $container_name" >> ./inventory.yaml
199-
echo " uri: $container_name" >> ./inventory.yaml
200-
echo " vars:" >> ./inventory.yaml
201-
echo " role: primary" >> ./inventory.yaml # Default to primary for now
202-
echo " config:" >> ./inventory.yaml
203-
echo " transport: docker" >> ./inventory.yaml
204-
echo " docker:" >> ./inventory.yaml
205-
echo " container: $container_name" >> ./inventory.yaml
206-
echo " tmpdir: /var/tmp" >> ./inventory.yaml # Use alternative temp dir
207-
done
208-
;;
125+
# ... other architecture cases ...
209126
esac
210127
211128
echo "=== New Docker transport inventory.yaml ==="
212129
cat ./inventory.yaml
213130
echo ::endgroup::
131+
echo ::group::info:request
132+
cat request.json || true; echo
133+
echo ::endgroup::
214134
- name: Debug container setup
215135
run: |
216136
echo ::group::debug_container_setup
@@ -332,10 +252,42 @@ jobs:
332252
for container in $(docker ps --format "{{.Names}}" | grep -v NAMES); do
333253
echo "=== Preparing container: $container ==="
334254
335-
# Install required packages
255+
# Install required packages for Ubuntu 24.04
336256
echo "Installing required packages:"
337257
docker exec $container apt-get update || echo "apt-get update failed"
338-
docker exec $container apt-get install -y curl wget ca-certificates || echo "Package installation failed"
258+
docker exec $container apt-get install -y \
259+
curl \
260+
wget \
261+
ca-certificates \
262+
hostname \
263+
procps \
264+
util-linux \
265+
systemd \
266+
openssh-server \
267+
openssh-client \
268+
tar \
269+
gzip \
270+
net-tools \
271+
iproute2 \
272+
file \
273+
gettext-base \
274+
findutils \
275+
coreutils \
276+
grep \
277+
sed \
278+
gawk \
279+
bash \
280+
systemd-resolved \
281+
dnsutils \
282+
iputils-ping || echo "Package installation failed"
283+
284+
# Ensure critical commands are available
285+
echo "Testing required commands:"
286+
docker exec $container hostname || echo "hostname command failed"
287+
docker exec $container hostname -f || echo "hostname -f command failed"
288+
docker exec $container file --version || echo "file command failed"
289+
docker exec $container tar --version || echo "tar command failed"
290+
docker exec $container which systemctl || echo "systemctl not found"
339291
340292
# Ensure /tmp directory exists and has correct permissions
341293
echo "Creating and setting permissions for /tmp directory:"
@@ -359,10 +311,32 @@ jobs:
359311
docker exec $container mkdir -p /var/log
360312
docker exec $container mkdir -p /etc/puppetlabs
361313
docker exec $container mkdir -p /opt/puppetlabs
314+
docker exec $container mkdir -p /etc/systemd/system
315+
316+
# Set up proper hostname resolution
317+
echo "Setting up hostname resolution:"
318+
container_hostname=$(docker exec $container hostname 2>/dev/null || echo "localhost")
319+
docker exec $container bash -c "echo '127.0.0.1 $container_hostname localhost' >> /etc/hosts"
320+
321+
# Initialize systemd properly (important for PE installer)
322+
echo "Ensuring systemd is working:"
323+
docker exec $container systemctl daemon-reload || echo "systemctl daemon-reload failed"
362324
363325
# Check available disk space
364326
echo "Disk space check:"
365327
docker exec $container df -h /var/tmp || echo "Cannot check disk space"
328+
329+
# Test pe_install.sh specific requirements
330+
echo "Testing pe_install.sh requirements:"
331+
docker exec $container which file || echo "file command missing - PE installer will fail"
332+
docker exec $container which tar || echo "tar command missing"
333+
docker exec $container which systemctl || echo "systemctl missing"
334+
docker exec $container which bash || echo "bash missing"
335+
336+
# Test if systemd is working properly
337+
echo "Testing systemd functionality:"
338+
docker exec $container systemctl --version || echo "systemctl not working"
339+
docker exec $container systemctl daemon-reload || echo "daemon-reload failed"
366340
done
367341
echo ::endgroup::
368342
- name: Install PE on test cluster

0 commit comments

Comments
 (0)