Skip to content
This repository was archived by the owner on Jul 2, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ def main():
parser.add_argument('-d', '--dir', action='append',
help='Local dir to mount in the '
'image. Will be mounted at /external/<dirname>')
parser.add_argument('-e', '--env', action='append',
help='Environment variables passed directly to '
'docker -e')
parser.add_argument('-v', '--volume', action='append',
help='Volume mounts passed directly to docker -v')
parser.add_argument('--rm', action='store_true',
Expand Down Expand Up @@ -105,6 +108,9 @@ def main():
if args.volume:
for volume in args.volume:
docker_args += ["-v", volume]
if args.env:
for env in args.env:
docker_args += ["-e", env]

# exec "docker run"
docker_args += [CONTAINER, "/usr/local/bin/init-container.sh"]
Expand Down
13 changes: 13 additions & 0 deletions utils/travis-build-repo-internal.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

set -eux

REPO_PATH=$1
REPO=`basename $REPO_PATH`

cp -r $REPO_PATH .
cd $REPO

eval $REPO_CONFIGURE_CMD
eval $REPO_BUILD_CMD
eval $REPO_TEST_CMD
42 changes: 42 additions & 0 deletions utils/travis-build-repo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/sh

# This script is intended to called from inside a git repo by travis.
# It will download travis-build-repo-internal.sh and run.py, launch a
# xenserver-build-env container with the git repo mounted, and will finally
# run the script travis-build-repo-internal.sh inside the container.
#
# travis-build-repo.sh makes use of the following environment variables:
# $BUILDENV_USER (optional - default 'xenserver')
# - The github user from which to pull the required scripts.
# $BUILDENV_BRANCH (optional - default 'master')
# - The github branch from which to pull the required scripts.
# $REPO_PACKAGE_NAME (required)
# - The package for which dependencies will be installed in the container.
# $REPO_CONFIGURE_CMD (optional - default './configure')
# - The configure command to run in the repo.
# $REPO_BUILD_CMD (optional - default 'make')
# - The build command to run in the repo.
# $REPO_TEST_CMD (optional - default 'make test')
# - The test command to run in the repo.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice docs 👍


set -eux

BUILDENV_USER=${BUILDENV_USER:-xenserver}
BUILDENV_BRANCH=${BUILDENV_BRANCH:-master}

wget https://raw.githubusercontent.com/${BUILDENV_USER}/xenserver-build-env/${BUILDENV_BRANCH}/run.py
wget https://raw.githubusercontent.com/${BUILDENV_USER}/xenserver-build-env/${BUILDENV_BRANCH}/utils/travis-build-repo-internal.sh

REPO=`basename $PWD`
REPO_PATH=/repos/$REPO

REPO_CONFIGURE_CMD=${REPO_CONFIGURE_CMD:-./configure}
REPO_BUILD_CMD=${REPO_BUILD_CMD:-make}
REPO_TEST_CMD=${REPO_TEST_CMD:-make test}

python run.py -p $REPO_PACKAGE_NAME --rm \
-e "REPO_CONFIGURE_CMD=$REPO_CONFIGURE_CMD" \
-e "REPO_BUILD_CMD=$REPO_BUILD_CMD" \
-e "REPO_TEST_CMD=$REPO_TEST_CMD" \
-v $PWD:$REPO_PATH \
sh $REPO_PATH/travis-build-repo-internal.sh $REPO_PATH