File tree 8 files changed +75
-6
lines changed
8 files changed +75
-6
lines changed Original file line number Diff line number Diff line change 1
1
/dist
2
+ * .retry
Original file line number Diff line number Diff line change @@ -96,7 +96,6 @@ COPY --from=0 $BUILD_DIR/dist/ /app/
96
96
# Install packages and build essentials
97
97
ARG DEBIAN_FRONTEND="noninteractive"
98
98
RUN apt-get update && apt install -y \
99
- ansible \
100
99
build-essential \
101
100
cmake \
102
101
curl \
@@ -110,20 +109,16 @@ RUN apt-get update && apt install -y \
110
109
ssh \
111
110
sshpass \
112
111
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1 \
113
-
114
112
# Install retry script
115
113
&& curl $RETRY_SCRIPT -o /usr/local/bin/retry && chmod +x /usr/local/bin/retry \
116
-
117
114
# Build and install Qemu from source
118
115
&& git clone --single-branch --branch $QEMU_BRANCH $QEMU_GIT $BUILD_DIR/qemu/ \
119
116
&& mkdir $BUILD_DIR/qemu/build \
120
117
&& (cd $BUILD_DIR/qemu/build && ../configure --target-list=aarch64-softmmu) \
121
118
&& make -C $BUILD_DIR/qemu/build install -j$BUILD_CORES \
122
119
&& rm -r $BUILD_DIR \
123
-
124
120
# Unzip distro image
125
121
&& gunzip /app/distro.qcow2.gz \
126
-
127
122
# Start distro as daemon
128
123
&& qemu-system-aarch64 \
129
124
-M raspi3 \
@@ -152,12 +147,13 @@ RUN apt-get update && apt install -y \
152
147
libpixman-1-dev \
153
148
ninja-build \
154
149
pkg-config \
150
+ python3.8 \
155
151
sshpass \
156
152
# Stop the virtual machine
157
153
&& sleep 20 \
158
154
&& kill -15 $(pidof qemu-system-aarch64) \
159
155
&& sleep 10 \
160
- # Finally compress the distro image
156
+ # Compress distro image
161
157
&& gzip /app/distro.qcow2
162
158
163
159
# Copy start script
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ TEST_DIR=" $( cd " $( dirname " $0 " ) " && pwd) /test/"
3
+
4
+ ansible-playbook -i $TEST_DIR /hosts.yml $TEST_DIR /main.yml
Original file line number Diff line number Diff line change
1
+ ---
2
+ # This playbook prints a simple debug message
3
+ - hosts : local
4
+ connection : local
5
+ tasks :
6
+ - name : Start raspi machine
7
+ docker_container :
8
+ name : raspi
9
+ image : ptrsr/rpi-qemu-kernel
10
+ state : started
11
+ network_mode : host
12
+ # images:
13
+ # - '../dist:/dist'
14
+
15
+ # Check machine connection
16
+ - hosts : raspi
17
+ gather_facts : no
18
+ tasks :
19
+ - name : Wait for machine startup
20
+ wait_for_connection :
21
+ timeout : 100
Original file line number Diff line number Diff line change
1
+ ---
2
+ - hosts : raspi
3
+ any_errors_fatal : false
4
+ tasks :
5
+ - name : Shutdown vm
6
+ shell : shutdown now
7
+ become : true
8
+ async : 1
9
+ poll : 0
10
+
11
+ - hosts : local
12
+ connection : local
13
+ tasks :
14
+ - name : Wait for shutdown
15
+ pause :
16
+ seconds : 5
17
+
18
+ - name : Stop raspi container
19
+ docker_container :
20
+ name : raspi
21
+ state : absent
Original file line number Diff line number Diff line change
1
+ all :
2
+ hosts :
3
+ local :
4
+ ansible_host : localhost
5
+ raspi :
6
+ ansible_host : localhost
7
+ ansible_port : 2222
8
+ ansible_ssh_user : pi
9
+ ansible_ssh_pass : raspberry
10
+ ansible_ssh_common_args : ' -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
Original file line number Diff line number Diff line change
1
+ ---
2
+ # # Start raspi vm machine
3
+ - import_playbook : host/start.yml
4
+
5
+ # # Execute tasks on raspi
6
+ - import_playbook : raspi/test.yml
7
+
8
+ # Stop raspi vm machine
9
+ - import_playbook : host/stop.yml
Original file line number Diff line number Diff line change
1
+ ---
2
+ # Print debug message in raspi machine
3
+ - hosts : raspi
4
+ tasks :
5
+ - name : Print debug message
6
+ debug :
7
+ msg : Hello, world!
You can’t perform that action at this time.
0 commit comments