From aa7729f40cf397b8a8105b726bd392c30343a4a8 Mon Sep 17 00:00:00 2001 From: Oliver Kurz Date: Mon, 29 Jul 2024 14:38:28 +0200 Subject: [PATCH] Add development service convenience runner "openqa-run" --- docs/Contributing.asciidoc | 11 +++++++++++ tools/openqa-run | 39 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100755 tools/openqa-run diff --git a/docs/Contributing.asciidoc b/docs/Contributing.asciidoc index 49aac16c20a..9458a82c26a 100644 --- a/docs/Contributing.asciidoc +++ b/docs/Contributing.asciidoc @@ -293,6 +293,17 @@ assets can need a big amount of disk space. WARNING: Be sure to *clear* that variable when running unit tests locally. +For convenience you can use the `openqa-run` wrapper in to call openQA +services with `OPENQA_BASEDIR` set to your local development environment with +the appropriate service account. For example to start the openQA GRU service +call: + +[source,sh] +---- +tools/openqa-run script/openqa-gru +---- + + === Customize configuration directory It can be necessary during development to change the configuration. For example you have to edit `etc/openqa/database.ini` to use another database. diff --git a/tools/openqa-run b/tools/openqa-run new file mode 100755 index 00000000000..eceb6187480 --- /dev/null +++ b/tools/openqa-run @@ -0,0 +1,39 @@ +#!/bin/bash +set -euo pipefail + +usage() { + cat << EOF +Usage: openqa-run [OPTIONS...] OPENQA_SERVICE +Call an openQA service OPENQA_SERVICE with appropriate user account and the +base-dir set to the local working copy. + +Example: + openqa-run openqa-webui-daemon + +Options: + -h, --help display this help +EOF + exit "$1" +} + +OPENQA_BASEDIR="${OPENQA_BASEDIR:-"$(dirname "$0")/../t/data"}" +export OPENQA_BASEDIR + +opts=$(getopt -o h --long help -n "$0" -- "$@") || usage 1 +eval set -- "$opts" +while true; do + case "$1" in + -h | --help) usage 0 ;; + --) + shift + break + ;; + *) break ;; + esac +done + +main() { + "$@" +} + +caller 0 > /dev/null || main "$@"