initial infrastructure checkin

This commit is contained in:
Mike Aizatsky 2016-07-20 14:58:10 -07:00
parent a694d54103
commit a28f555148
9 changed files with 279 additions and 0 deletions

View File

@ -0,0 +1,42 @@
# 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.
#
################################################################################
FROM libfuzzer/base
MAINTAINER mike.aizatsky@gmail.com
RUN apt-get install -y build-essential make cmake ninja-build git python2.7
# Checkout & build llvm+clang+deps
#
RUN mkdir /src /work
RUN cd /src && git clone --depth 1 http://llvm.org/git/llvm.git
RUN cd /src/llvm/tools && git clone --depth 1 http://llvm.org/git/clang.git
RUN cd /src/llvm/projects && git clone --depth 1 http://llvm.org/git/compiler-rt.git
RUN cd /src/llvm/projects && git clone --depth 1 http://llvm.org/git/libcxx.git
RUN cd /src/llvm/projects && git clone --depth 1 http://llvm.org/git/libcxxabi.git
RUN cd /src/llvm/projects && git clone --depth 1 http://llvm.org/git/lld.git
RUN mkdir -p /work/llvm && cd /work/llvm \
&& cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DLIBCXX_ENABLE_SHARED=OFF -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON /src/llvm \
&& ninja
#RUN ln -s /work/llvm/bin/lld /work/llvm/bin/ld
RUN apt-get remove --purge -y cmake ninja-build python2.7 build-essential
RUN apt-get autoremove -y
ENV PATH="/work/llvm/bin:$PATH"
COPY env /work/llvm

View File

@ -0,0 +1,35 @@
#!/bin/bash
# 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.
#
################################################################################
set -e -x
export WORKSPACE="/workspace"
export CC="/work/llvm/bin/clang"
export CXX="/work/llvm/bin/clang++"
export CCC="/work/llvm/bin/clang++"
pushd $PWD > /dev/null
echo -n "Compiling libFuzzer..."
cd /work/libfuzzer
cp /src/llvm/lib/Fuzzer/*.h .
$CXX -g -std=c++11 -stdlib=libc++ $sanitizer_flags -c /src/llvm/lib/Fuzzer/*.cpp -I.
echo "Done."
popd > /dev/null
export CFLAGS="-g $sanitizer_flags $cov_flags"
export LIBCXX_FLAGS="-stdlib=libc++"
export CXXFLAGS="$CFLAGS $LIBCXX_FLAGS "

View File

@ -0,0 +1,33 @@
# 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.
#
################################################################################
FROM libfuzzer/base-clang
MAINTAINER aizatsky@google.com
RUN mkdir /workspace
WORKDIR /workspace
VOLUME /workspace
RUN mkdir -p /work/libfuzzer
ENV sanitizer_flags="-fsanitize=address"
ENV cov_flags="-fsanitize-coverage=edge,indirect-calls,8bit-counters"
ENV ASAN_OPTIONS="symbolize=1"
RUN mkdir /out
VOLUME /out

View File

@ -0,0 +1,21 @@
# 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.
#
################################################################################
# Base image for all other images.
FROM ubuntu:16.04
MAINTAINER mike.aizatsky@gmail.com
RUN apt-get update && apt-get upgrade -y

View File

@ -0,0 +1,18 @@
# 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.
#
################################################################################
FROM jenkins
USER root

View File

@ -0,0 +1,57 @@
apiVersion: apps/v1alpha1
kind: PetSet
metadata:
name: jenkins-master
spec:
serviceName: "jenkins-master"
replicas: 1
template:
metadata:
labels:
app: jenkins-master
annotations:
pod.alpha.kubernetes.io/initialized: "true"
spec:
terminationGracePeriodSeconds: 0
containers:
- name: jenkins-master
image: gcr.io/meta-iterator-105109/jenkins
env:
- name: KUB_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: KUB_POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: JAVA_OPTS
value: "-Duser.timezone=America/Los_Angeles"
ports:
- containerPort: 8080
- containerPort: 50000
volumeMounts:
- name: jenkins-work
mountPath: "/var/jenkins_home"
livenessProbe:
httpGet:
path: "/login"
port: 8080
initialDelaySeconds: 60
timeoutSeconds: 15
resources:
requests:
memory: "4Gi"
securityContext:
privileged: true
volumeClaimTemplates:
- metadata:
name: jenkins-work
annotations:
volume.alpha.kubernetes.io/storage-class: anything
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 250Gi

View File

@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: jenkins-http
spec:
type: LoadBalancer
selector:
app: jenkins-master
ports:
- port: 80
targetPort: 8080

View File

@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: jenkins-master
labels:
app: jenkins-master
spec:
type: NodePort
selector:
app: jenkins-master
ports:
- port: 50000
targetPort: 50000
nodePort: 31001
protocol: TCP

View File

@ -0,0 +1,47 @@
#!/bin/bash
# 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.
#
################################################################################
set -x
PROJECT="gcr.io/meta-iterator-105109"
DIR=$(dirname $0)
docker build --pull -t $PROJECT/jenkins $DIR/
gcloud docker push $PROJECT/jenkins
# delete jenkins-master if it exists before starting
kubectl get petset jenkins-master
if [ $? -eq 0 ]
then
kubectl delete -f $DIR/jenkins-master.yaml
fi
kubectl create -f $DIR/jenkins-master.yaml
# do not restart services to keep IP addresses stable.
kubectl get service jenkins-http
if [ $? -ne 0 ]
then
kubectl create -f $DIR/service-jenkins-http.yaml
fi
kubectl get service jenkins-master
if [ $? -ne 0 ]
then
kubectl create -f $DIR/service-jenkins-master.yaml
fi
kubectl describe petset jenkins-master
kubectl describe service jenkins-http