obs: docker-build: move osc file creation.

We need to create the osc file before enter the container.
If build_all.sh is executed without a container and osc
is intalled osc will ask for setup but in the container
fails do to a missing tty.

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
This commit is contained in:
Jose Carlos Venegas Munoz 2018-08-22 18:19:46 -05:00
parent dbe64e6461
commit 1a751c5214
2 changed files with 18 additions and 13 deletions

View File

@ -16,7 +16,6 @@ readonly script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=scripts/obs-docker.sh
source "${script_dir}/scripts/obs-pkgs.sh"
OSCRC="${HOME}/.oscrc"
PUSH=${PUSH:-""}
LOCAL=${LOCAL:-""}
PUSH_TO_OBS=""
@ -27,8 +26,6 @@ export BUILD_DISTROS=${BUILD_DISTROS:-xUbuntu_16.04}
export AUTHOR="${AUTHOR:-user}"
export AUTHOR_EMAIL="${AUTHOR_EMAIL:-user@example.com}"
OBS_API="https://api.opensuse.org"
usage() {
msg="${1:-}"
exit_code=$"${2:-0}"
@ -43,16 +40,6 @@ EOT
main() {
local branch="${1:-}"
[ -n "${branch}" ] || usage "missing branch" "1"
if [ -n "${OBS_USER:-}" ] && [ -n "${OBS_PASS:-}" ] && [ ! -e "${OSCRC:-}" ]; then
echo "Creating ${OSCRC} with user $OBS_USER"
cat <<eom >"${OSCRC}"
[general]
apiurl = ${OBS_API}
[${OBS_API}]
user = ${OBS_USER}
pass = ${OBS_PASS}
eom
fi
pushd "${script_dir}"
for p in "${OBS_PKGS_PROJECTS[@]}"; do

View File

@ -26,6 +26,9 @@ source "${script_dir}/scripts/obs-docker.sh"
GO_ARCH=$(go env GOARCH)
export GO_ARCH
OSCRC="${HOME}/.oscrc"
OBS_API="https://api.opensuse.org"
usage() {
msg="${1:-}"
exit_code=$"${2:-0}"
@ -49,6 +52,21 @@ main() {
popd >>/dev/null
#Build all kata packages
make -f "${script_dir}/Makefile" clean
if [ -n "${OBS_USER:-}" ] && [ -n "${OBS_PASS:-}" ] && [ ! -e "${OSCRC}" ]; then
echo "Creating ${OSCRC} with user $OBS_USER"
cat <<eom >"${OSCRC}"
[general]
apiurl = ${OBS_API}
[${OBS_API}]
user = ${OBS_USER}
pass = ${OBS_PASS}
eom
fi
if [ ! -e "${OSCRC}" ]; then
echo "${OSCRC}, please do 'export OBS_USER=your_user ; export OBS_PASS=your_pass' to configure osc for first time."
exit 1
fi
docker_run "${packaging_repo_dir}/obs-packaging/build_all.sh ${branch}"
}