Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
buildstream
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
6
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
BuildStream
buildstream
Commits
9ab61d63
Commit
9ab61d63
authored
6 years ago
by
Daniel Playle
Browse files
Options
Downloads
Patches
Plain Diff
fixup! Support dynamic client certificates for CAS cache
parent
170ad40c
No related branches found
No related tags found
Loading
Pipeline
#27036833
passed
6 years ago
Stage: prepare
Stage: test
Stage: post
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
buildstream/_artifactcache/casserver.py
+1
-1
1 addition, 1 deletion
buildstream/_artifactcache/casserver.py
contrib/bst-test
+209
-0
209 additions, 0 deletions
contrib/bst-test
with
210 additions
and
1 deletion
buildstream/_artifactcache/casserver.py
+
1
−
1
View file @
9ab61d63
This diff is collapsed.
Click to expand it.
contrib/bst-test
0 → 100755
+
209
−
0
View file @
9ab61d63
#!/usr/bin/env bash
#
# Copyright (C) 2018 Codethink Limited
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library. If not, see <http://www.gnu.org/licenses/>.
#
# Authors:
# Tristan Maat <tristan.maat@codethink.co.uk>
set
-eu
usage
()
{
cat
<<
EOF
Usage:
test-bst [options] [<bst-version>]
Run a test buildstream container with your cwd as /src. Also allows
using an editable local copy of the buildstream repository, or a
different branch from the current repository.
The bst-version argument is presumed to be a branch of the main repo
by default, and will default to "master" if not specified.
Options:
-b|--branch Treat bst-version as a branch name
-c|--commit Treat bst-version as a commit sha
-d|--directory Treat bst-version as a local directory
containing buildstream's repository
-i|--image Use the given image as base
-v|--volume Specify additional volumes to mount; should be in format
'host-src:container-dest' same as 'docker run -v'
-e|--env Specify additional environment variables; same as
'docker run --env'
--keep-artifacts Enable local artifact cache
--no-source-cache Disable local source cache
--help Display this help message and exit
EOF
}
RED
=
'\033[0;31m'
RESET
=
'\033[0m'
main
()
{
local env
local
image
local
branch
local
commit
local
volumes
local
buildstream_dir
local
keep_sources
=
true
local
keep_artifacts
=
false
while
:
;
do
case
"
${
1
:-}
"
in
""
)
break
;;
-v
|
--volume
)
volumes
=
"
$volumes
$2
"
shift
2
;;
-e
|
--env
)
env
=
"
$env
$2
"
shift
2
;;
-d
|
--directory
)
if
[
!
-z
"
$branch
"
]
||
[
!
-z
"
$commit
"
]
;
then
echo
-e
"
${
RED
}
Error: Cannot specify '
$1
' and '-c' or '-b'"
usage
exit
1
fi
buildstream_dir
=
$(
abspath
"
$2
"
)
shift
2
;;
-b
|
--branch
)
if
[
!
-z
"
$buildstream_dir
"
]
||
[
!
-z
"
$commit
"
]
;
then
echo
-e
"
${
RED
}
Error: Cannot specify '
$1
' and '-d' or '-c'"
usage
exit
1
fi
branch
=
"
$2
"
shift
2
;;
-c
|
--commit
)
if
[
!
-z
"
$buildstream_dir
"
]
||
[
!
-z
"
$branch
"
]
;
then
echo
-e
"
${
RED
}
Error: Cannot specify '
$1
' and '-d' or '-b'"
usage
exit
1
fi
commit
=
"
$2
"
shift
2
;;
-i
|
--image
)
image
=
"
$2
"
shift
2
;;
--no-source-cache
)
keep_sources
=
false
shift
;;
--keep-artifacts
)
keep_artifacts
=
true
shift
;;
*
)
echo
-e
"
${
RED
}
Error: Unrecognized argument '
${
1
:-}
'
${
RESET
}
"
1>&2
usage
exit
1
;;
esac
done
run_bst
"
$branch
"
"
$keep_sources
"
"
$keep_artifacts
"
"
$buildstream_dir
"
"
$commit
"
"
$image
"
}
abspath
()
{
local
path
=
"
$1
"
cd
"
$(
dirname
"
$path
"
)
"
path
=
"
$(
basename
"
$path
"
)
"
while
[
-L
"
$path
"
]
;
do
path
=
"
$(
readlink
"
$path
"
)
"
cd
"
$(
dirname
"
$path
"
)
"
path
=
"
$(
basename
"
$path
"
)
"
done
echo
"
$(
pwd
-P
)
/
$path
"
}
run_bst
()
{
local
branch
=
"
$1
"
local
keep_sources
=
"
$2
"
local
keep_artifacts
=
"
$3
"
local
buildstream_dir
=
"
$4
"
local
commit
=
"
$5
"
local
opt_args
=
""
local
install_bst
if
[
-z
"
$branch
"
]
;
then
branch
=
"master"
fi
if
[
-z
"
$image
"
]
;
then
image
=
"
${
BUILDSTREAM_DOCKER_IMAGE
:-
buildstream
/buildstream-fedora
:latest
}
"
fi
# Install the version of buildstream that the user specified
if
[
!
-z
"
$commit
"
]
;
then
install_bst
=
"(set -e;
git clone https://gitlab.com/BuildStream/buildstream.git /buildstream;
git -C /buildstream checkout
$commit
;
pip3 install --no-index /buildstream)"
elif
[
!
-z
"
$buildstream_dir
"
]
;
then
install_bst
=
"(set -e; pip3 install --no-index -e /buildstream)"
opt_args
=
"
$opt_args
--volume
$buildstream_dir
:/buildstream"
else
install_bst
=
"(set -e;
git clone -b
$branch
https://gitlab.com/BuildStream/buildstream.git /buildstream;
pip3 install --no-index /buildstream)"
fi
# Create a volume to cache sources
if
[
"
$keep_sources
"
==
true
]
;
then
opt_args
=
"
$opt_args
--env BST_SOURCE_CACHE=/temp/bst_cache/buildstream/sources"
opt_args
=
"
$opt_args
--env XDG_CACHE_HOME=/temp/bst_cache/"
opt_args
=
"
$opt_args
--volume bst-test-sources:/temp/bst_cache/buildstream/sources"
docker volume create
"bst-test-sources"
fi
# Create a volume to cache artifacts
if
[
"
$keep_artifacts
"
==
true
]
;
then
opt_args
=
"
$opt_args
--env XDG_CACHE_HOME=/temp/bst_cache"
opt_args
=
"
$opt_args
--volume bst-test-artifacts:/temp/bst_cache/buildstream/artifacts"
docker volume create
"bst-test-artifacts"
fi
# Run a container with a buildstream setup as specified.
#
# --privileged is required to run bst in docker
# --net="host" is used for local artifact cache server testing
# --device /dev/fuse is required to run bst in docker
# --security-opt seccomp=unconfined is required to run bst in docker
# --env PS1 is set to distinguish the shell from a normal shell
#
# Any un-escaped variables are argument lists - unfortunately we
# can't disable shellcheck warnings for these here.
#
exec
docker run
--rm
-it
\
--privileged
\
--net
=
"host"
\
--device
/dev/fuse
\
--security-opt
seccomp
=
unconfined
\
--env
PS1
=
"
${
PS1
:-
bst
-test
:
\u@\h \
$
}
"
\
--volume
"
$PWD
"
:/src
\
${
volumes
// / --volume
}
\
${
env
// / --env
}
\
--workdir
/src
\
$opt_args
\
"
$image
"
\
/bin/bash
-c
"
$install_bst
; bash -i"
}
main
"
$@
"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment