[infra] checkout command: automatic code checkout and compiling (#11)

This commit is contained in:
Mike Aizatsky 2016-10-10 13:21:45 -07:00 committed by GitHub
parent 4df734c653
commit 85dad5d52d
8 changed files with 58 additions and 3 deletions

View File

@ -17,4 +17,7 @@
FROM ossfuzz/base-libfuzzer
MAINTAINER mike.aizatsky@gmail.com
RUN apt-get install -y cmake ninja-build golang
ENV GIT_URL "https://boringssl.googlesource.com/boringssl"
COPY build.sh /src/

View File

@ -17,4 +17,8 @@
FROM ossfuzz/base-libfuzzer
MAINTAINER mike.aizatsky@gmail.com
RUN apt-get install -y make autoconf automake libtool docbook2x
ENV GIT_CHECKOUT_DIR="expat"
ENV GIT_URL="git://git.code.sf.net/p/expat/code_git"
COPY build.sh /src/

View File

@ -17,4 +17,7 @@
FROM ossfuzz/base-libfuzzer
MAINTAINER mike.aizatsky@gmail.com
RUN apt-get install -y make autoconf libtool libarchive-dev
ENV GIT_URL="git://git.sv.nongnu.org/freetype/freetype2.git"
COPY build.sh /src/

View File

@ -19,3 +19,4 @@ docker build --pull -t ossfuzz/base $@ infra/base-images/base
docker build -t ossfuzz/base-clang $@ infra/base-images/base-clang
docker build -t ossfuzz/base-libfuzzer $@ infra/base-images/base-libfuzzer
docker build -t ossfuzz/libfuzzer-runner $@ infra/base-images/libfuzzer-runner

View File

@ -19,7 +19,6 @@ MAINTAINER mike.aizatsky@gmail.com
RUN apt-get install -y git libc6-dev
RUN cd /src && git clone --depth 1 https://github.com/google/oss-fuzz.git
VOLUME /src/oss-fuzz
RUN mkdir -p /work/libfuzzer
@ -34,6 +33,6 @@ RUN mkdir /out
VOLUME /out
RUN mkdir /src/bin
COPY compile /src/bin
COPY compile checkout_and_compile /src/bin/
ENV PATH=/src/bin:$PATH
CMD ["compile"]

View File

@ -5,6 +5,10 @@ Supported commands:
* `docker run -ti <image_name> [compile]` - compiles everything. Expects /src/ paths
to be mounted.
* `docker run -ti <image_name> checkout_and_compile` - checks projects sources out
if its location is defined and compiles.
* `docker run -ti <image_name> /bin/bash` - drop into shell. Run `compile` script
to start build.
# Child Image Interface
@ -16,6 +20,17 @@ Following files have to be added by child images:
| ------------- | ----------- |
| `/src/build.sh` | build script to build the library and its fuzzers |
## Optional Environment Variables
Child image can define following environment variables:
| Variable | Description |
| -------- | ----------- |
| `GIT_URL` (optional) | git url for sources |
| `SVN_URL` (optional) | svn url for sources |
| `GIT_CHECKOUT_DIR` (optional) | directory (under `/src/`) to checkout into |
| `SVN_CHECKOUT_DIR` (optional) | directory (under `/src/`) to checkout into |
# Image Layout
| Location | Description |

View File

@ -0,0 +1,29 @@
#!/bin/bash -eux
# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################
cd /src
if [[ ! -z "${GIT_URL-}" ]]; then
git clone --recursive $GIT_URL ${GIT_CHECKOUT_DIR-}
elif [[ ! -z "${SVN_URL-}" ]]; then
svn co $SVN_URL ${SVN_CHECKOUT_DIR-}
else
echo "ERROR: VCS URL Not Defined. Expected ($GET_URL|$SVN_URL)."
exit 1
fi
compile

View File

@ -36,4 +36,5 @@ echo "LDFLAGS=$LDFLAGS"
echo "---------------------------------------------------------------"
/src/build.sh
/src/build.sh