Skip to content

Commit 9e4711d

Browse files
committed
Allow running single instance container with local changes
This change adds support for running the single-instance container using local source tree instead of the system zypper package. This can help testing changes to openQA code inside the container without requiring package installation. Related ticket: https://progress.opensuse.org/issues/181409
1 parent a9d64b7 commit 9e4711d

File tree

2 files changed

+38
-9
lines changed

2 files changed

+38
-9
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# SPDX-License-Identifier: MIT
2+
#!BuildTag: openqa-single-instance-devel:latest opensuse/openqa-single-instance-devel:latest opensuse/openqa-single-instance-devel:%PKG_VERSION% opensuse/openqa-single-instance-devel:%PKG_VERSION%.%RELEASE%
3+
4+
# hadolint ignore=DL3006
5+
FROM opensuse/openqa_devel
6+
7+
# labelprefix=org.opensuse.openqa-single-instance-devel
8+
LABEL org.opencontainers.image.title="openQA developer single-instance container"
9+
LABEL org.opencontainers.image.description="A complete openQA developer instance composed of all necessary components to execute openQA tests including an openQA worker"
10+
LABEL org.opencontainers.image.version="%PKG_VERSION%.%RELEASE%"
11+
LABEL org.opensuse.reference="registry.opensuse.org/opensuse/openqa-single-instance-devel:%PKG_VERSION%.%RELEASE%"
12+
LABEL org.openbuildservice.disturl="%DISTURL%"
13+
LABEL org.opencontainers.image.created="%BUILDTIME%"
14+
# endlabelprefix
15+
16+
COPY . /opt/openqa
17+
WORKDIR /opt/openqa
18+
19+
RUN make node_modules
20+
21+
EXPOSE 80 443 9526
22+
ENV skip_suse_specifics=1
23+
ENV skip_suse_tests=1
24+
ENV OPENQA_SERVICE_PORT_DELTA=0
25+
ENV LC_ALL C.UTF-8
26+
27+
ENTRYPOINT ["/opt/openqa/script/openqa-bootstrap"]

script/openqa-bootstrap

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
set -xeuo pipefail
55

6+
OPENQA_DIR=${OPENQA_DIR:=/usr/share/openqa}
7+
68
dbname="${dbname:="openqa"}"
79
dbuser="${dbuser:="geekotest"}"
810
running_systemd=
@@ -26,24 +28,24 @@ start-database() {
2628
start-worker() {
2729
if [[ -z $running_systemd ]]; then
2830
/usr/bin/install -d -m 0755 -o _openqa-worker /var/lib/openqa/pool/1
29-
su _openqa-worker -c '/usr/share/openqa/script/worker --instance 1' &
31+
su _openqa-worker -c "$OPENQA_DIR/script/worker --instance 1" &
3032
else
3133
systemctl enable --now openqa-worker@1
3234
fi
3335
}
3436

3537
start-daemons() {
3638
if [[ -z $running_systemd ]]; then
37-
pgrep -f openqa-scheduler-daemon > /dev/null || su geekotest -c /usr/share/openqa/script/openqa-scheduler-daemon &
38-
pgrep -f openqa-websockets-daemon > /dev/null || su geekotest -c /usr/share/openqa/script/openqa-websockets-daemon &
39-
pgrep -f openqa-gru > /dev/null || su geekotest -c /usr/share/openqa/script/openqa-gru &
40-
pgrep -f openqa-livehandler-daemon > /dev/null || su geekotest -c /usr/share/openqa/script/openqa-livehandler-daemon &
39+
pgrep -f openqa-scheduler-daemon > /dev/null || su geekotest -c "$OPENQA_DIR/script/openqa-scheduler-daemon" &
40+
pgrep -f openqa-websockets-daemon > /dev/null || su geekotest -c "$OPENQA_DIR/script/openqa-websockets-daemon" &
41+
pgrep -f openqa-gru > /dev/null || su geekotest -c "$OPENQA_DIR/script/openqa-gru" &
42+
pgrep -f openqa-livehandler-daemon > /dev/null || su geekotest -c "$OPENQA_DIR/script/openqa-livehandler-daemon" &
4143
if [[ $setup_web_proxy == "nginx" ]]; then
4244
nginx
4345
else
4446
/usr/sbin/start_apache2 -k start
4547
fi
46-
pgrep -f openqa-webui-daemon > /dev/null || su geekotest -c /usr/share/openqa/script/openqa-webui-daemon &
48+
pgrep -f openqa-webui-daemon > /dev/null || su geekotest -c "$OPENQA_DIR/script/openqa-webui-daemon" &
4749
else
4850
if [[ $setup_web_proxy == "nginx" ]]; then
4951
systemctl enable --now nginx
@@ -101,12 +103,12 @@ retry -e -s 30 -r 7 -- sh -c "zypper -n --gpg-auto-import-keys ref && zypper -n
101103
# setup database
102104
chown -R postgres: /var/lib/pgsql/ # fix broken postgres working dir permissions in the nspawn container
103105
start-database
104-
su postgres -c "/usr/share/openqa/script/setup-db" "$dbuser" "$dbname"
106+
su postgres -c "$OPENQA_DIR/script/setup-db" "$dbuser" "$dbname"
105107

106108
# setup webserver and fake-auth
107109
proxy_args=""
108110
[[ -n "$setup_web_proxy" ]] && proxy_args="--proxy=$setup_web_proxy"
109-
setup=/usr/share/openqa/script/configure-web-proxy
111+
setup="$OPENQA_DIR/script/configure-web-proxy"
110112
if command -v $setup; then
111113
bash -ex $setup "$proxy_args"
112114
else
@@ -140,7 +142,7 @@ if [[ -z $skip_suse_tests ]]; then
140142
# use faster local mirror if run from within SUSE network
141143
export needles_giturl="https://gitlab.suse.de/openqa/os-autoinst-needles-opensuse-mirror.git"
142144
fi
143-
/usr/share/openqa/script/fetchneedles
145+
"$OPENQA_DIR/script/fetchneedles"
144146
if [[ ! -e /var/lib/openqa/tests/sle ]]; then
145147
ln -s opensuse /var/lib/openqa/tests/sle
146148
fi

0 commit comments

Comments
 (0)