Skip to content

Commit

Permalink
builds tarball when all rpms being built
Browse files Browse the repository at this point in the history
  • Loading branch information
dangogh authored and PSUdaemon committed Mar 10, 2017
1 parent 1be9566 commit 4cf9529
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 10 deletions.
22 changes: 13 additions & 9 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,34 @@ export TC_DIR=$(dirname $(dirname "$topscript"))

checkEnvironment

# Create tarball first
if isInGitTree; then
echo "----- Building tarball ..."
tarball=$(createTarball "$TC_DIR")
ls -l $tarball
else
echo "---- Skipping tarball creation"
fi

if [[ $# -gt 0 ]]; then
projects=( "$*" )
else
# get all subdirs containing build/build_rpm.sh
projects_to_build=( */build/build_rpm.sh )
projects=()
# Always build tarball when building everything..
projects=(tarball)
for p in "${projects_to_build[@]}"; do
p=${p%%/*}
projects+=($p)
done
fi


declare -a badproj
declare -a goodproj
for p in "${projects[@]}"; do
if [[ $p == tarball ]]; then
if isInGitTree; then
echo "----- Building tarball ..."
tarball=$(createTarball "$TC_DIR")
ls -l $tarball
else
echo "---- Skipping tarball creation"
fi
continue
fi
# strip trailing /
p=${p%/}
bldscript="$p/build/build_rpm.sh"
Expand Down
2 changes: 1 addition & 1 deletion build/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function checkEnvironment {

# verify required tools available in path -- extra tools required by subsystem are passed in
for pgm in git rpmbuild "$@"; do
type $pgm 2>/dev/null || { echo "$pgm not found in PATH"; exit 1; }
type $pgm 2>/dev/null || { echo "$pgm not found in PATH"; }
done
# verify git version
requiredGitVersion=1.7.12
Expand Down
33 changes: 33 additions & 0 deletions infrastructure/docker/build/Dockerfile-source
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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 centos:7

MAINTAINER Dan Kirkwood

###
# top level of trafficcontrol directory must be mounted as a volume:
# docker run --volume /trafficcontrol:$(pwd) ...
VOLUME /trafficcontrol

RUN yum -y install \
git && \
yum -y clean all

WORKDIR /trafficcontrol
CMD ./build/build.sh tarball

# vi:syntax=Dockerfile
8 changes: 8 additions & 0 deletions infrastructure/docker/build/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@
version: '2'

services:
source:
image: trafficcontrol_tarball
build:
dockerfile: infrastructure/docker/build/Dockerfile-source
context: ../../..
volumes:
- ../../..:/trafficcontrol

traffic_monitor_build:
image: traffic_monitor_builder
build:
Expand Down

0 comments on commit 4cf9529

Please sign in to comment.