From 4cf95296ede4a92959307b51b846ab888aa6da83 Mon Sep 17 00:00:00 2001 From: Dan Kirkwood Date: Tue, 7 Mar 2017 15:48:36 -0700 Subject: [PATCH] builds tarball when all rpms being built --- build/build.sh | 22 ++++++++----- build/functions.sh | 2 +- infrastructure/docker/build/Dockerfile-source | 33 +++++++++++++++++++ .../docker/build/docker-compose.yml | 8 +++++ 4 files changed, 55 insertions(+), 10 deletions(-) create mode 100644 infrastructure/docker/build/Dockerfile-source diff --git a/build/build.sh b/build/build.sh index 558fb9ed10..472d1d8ab8 100755 --- a/build/build.sh +++ b/build/build.sh @@ -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" diff --git a/build/functions.sh b/build/functions.sh index 8cbdbd5cf8..54fc04c27c 100755 --- a/build/functions.sh +++ b/build/functions.sh @@ -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 diff --git a/infrastructure/docker/build/Dockerfile-source b/infrastructure/docker/build/Dockerfile-source new file mode 100644 index 0000000000..5eb2c89f7f --- /dev/null +++ b/infrastructure/docker/build/Dockerfile-source @@ -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 diff --git a/infrastructure/docker/build/docker-compose.yml b/infrastructure/docker/build/docker-compose.yml index a59d5327b2..518ed86e16 100644 --- a/infrastructure/docker/build/docker-compose.yml +++ b/infrastructure/docker/build/docker-compose.yml @@ -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: