diff --git a/CHANGELOG.md b/CHANGELOG.md index e052f082fd..0b1239f6bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - With the addition of multiple server interfaces, interface data is constructed from IP Address/Gateway/Netmask (and their IPv6 counterparts) and Interface Name and Interface MTU fields on services. These **MUST** have proper, valid data before attempting to upgrade or the upgrade **WILL** fail. In particular IP fields need to be valid IP addresses/netmasks, and MTU must only be positive integers of at least 1280. - The `/servers` and `/servers/{{ID}}}` API endpoints have been updated to use and reflect multi-interface servers. - CDN Snapshots now use a server's "service addresses" to provide its IP addresses +- Traffic Ops and Traffic Ops ORT are now separate, independent builds ### Deprecated - Deprecated the non-nullable `DeliveryService` Go struct and other structs that use it. `DeliveryServiceNullable` structs should be used instead. diff --git a/docs/source/development/building.rst b/docs/source/development/building.rst index 87a0829700..f00601fbfa 100644 --- a/docs/source/development/building.rst +++ b/docs/source/development/building.rst @@ -60,6 +60,7 @@ If present, ``projects`` should be one or more project names. When no specific p - source\ [2]_ - traffic_monitor_build\ [2]_ - traffic_ops_build\ [2]_ +- traffic_ops_ort_build\ [2]_ - traffic_portal_build\ [2]_ - traffic_router_build\ [2]_ - traffic_stats_build\ [2]_ diff --git a/infrastructure/docker/build/Dockerfile-traffic_ops_ort b/infrastructure/docker/build/Dockerfile-traffic_ops_ort new file mode 100644 index 0000000000..5909d6f775 --- /dev/null +++ b/infrastructure/docker/build/Dockerfile-traffic_ops_ort @@ -0,0 +1,37 @@ +# 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 + +# top level of trafficcontrol directory must be mounted as a volume: +# docker run --volume /trafficcontrol:$(pwd) ... +VOLUME /trafficcontrol + +### Common for all sub-component builds +RUN yum -y install \ + git \ + rpm-build && \ + yum -y clean all + +RUN curl -Lo go.tgz https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz && \ + tar -C /usr/local -xvzf go.tgz && \ + ln -s /usr/local/go/bin/go /usr/bin/go && \ + rm go.tgz + +ADD infrastructure/docker/build/clean_build.sh / +CMD /clean_build.sh traffic_ops_ort + +#vi:syntax=Dockerfile diff --git a/infrastructure/docker/build/docker-compose.yml b/infrastructure/docker/build/docker-compose.yml index c68df7e4e7..e2fb397183 100644 --- a/infrastructure/docker/build/docker-compose.yml +++ b/infrastructure/docker/build/docker-compose.yml @@ -42,6 +42,14 @@ services: volumes: - ../../..:/trafficcontrol:z + traffic_ops_ort_build: + image: apache/traffic_ops_ort_builder:master + # build: + # dockerfile: infrastructure/docker/build/Dockerfile-traffic_ops_ort + # context: ../../.. + volumes: + - ../../..:/trafficcontrol:z + traffic_portal_build: image: apache/traffic_portal_builder:master #build: diff --git a/pkg b/pkg index 8a6168f385..63e163b42a 100755 --- a/pkg +++ b/pkg @@ -134,7 +134,7 @@ while (( "$#" )); do if (( "$verbose" == 0 )); then exec >/dev/null 2>&1 fi - "${COMPOSECMD[@]}" -f $COMPOSE_FILE build $1 || exit 1 + "${COMPOSECMD[@]}" -f $COMPOSE_FILE build --pull $1 || exit 1 "${COMPOSECMD[@]}" -f $COMPOSE_FILE run "${RUN_OPTIONS[@]}" --rm $1 || exit 1 ) || { # Don't totally bail out, but make note of the failures. diff --git a/traffic_ops/build/build_rpm.sh b/traffic_ops/build/build_rpm.sh index 6fa490a457..a2e4cbcce9 100755 --- a/traffic_ops/build/build_rpm.sh +++ b/traffic_ops/build/build_rpm.sh @@ -34,7 +34,7 @@ function initBuildArea() { echo "Initializing the build area." mkdir -p "$RPMBUILD"/{SPECS,SOURCES,RPMS,SRPMS,BUILD,BUILDROOT} || { echo "Could not create $RPMBUILD: $?"; exit 1; } - local to_dest=$(createSourceDir traffic_ops) + local dest=$(createSourceDir traffic_ops) cd "$TO_DIR" || \ { echo "Could not cd to $TO_DIR: $?"; exit 1; } @@ -70,31 +70,15 @@ function initBuildArea() { { echo "Could not build convert_profile binary"; exit 1; } popd - # compile atstccfg - pushd ort/atstccfg - "${go_build[@]}" -ldflags "-X main.GitRevision=`git rev-parse HEAD` -X main.BuildTimestamp=`date +'%Y-%M-%dT%H:%M:%s'` -X main.Version=${TC_VERSION}" || \ - { echo "Could not build atstccfg binary"; exit 1; } - popd - - rsync -av etc install "$to_dest"/ || \ - { echo "Could not copy to $to_dest: $?"; exit 1; } - rsync -av app/{bin,conf,cpanfile,db,lib,public,script,templates} "$to_dest"/app/ || \ - { echo "Could not copy to $to_dest/app: $?"; exit 1; } - tar -czvf "$to_dest".tgz -C "$RPMBUILD"/SOURCES $(basename "$to_dest") || \ - { echo "Could not create tar archive $to_dest.tgz: $?"; exit 1; } - cp "$TO_DIR"/build/*.spec "$RPMBUILD"/SPECS/. || \ + rsync -av etc install "$dest"/ || \ + { echo "Could not copy to $dest: $?"; exit 1; } + rsync -av app/{bin,conf,cpanfile,db,lib,public,script,templates} "$dest"/app/ || \ + { echo "Could not copy to $dest/app: $?"; exit 1; } + tar -czvf "$dest".tgz -C "$RPMBUILD"/SOURCES $(basename "$dest") || \ + { echo "Could not create tar archive $dest.tgz: $?"; exit 1; } + cp "$TO_DIR"/build/traffic_ops.spec "$RPMBUILD"/SPECS/. || \ { echo "Could not copy spec files: $?"; exit 1; } - # Create traffic_ops_ort source area - to_ort_dest=$(createSourceDir traffic_ops_ort) - cp -p ort/traffic_ops_ort.pl "$to_ort_dest" - cp -p ort/supermicro_udev_mapper.pl "$to_ort_dest" - mkdir -p "${to_ort_dest}/atstccfg" - cp -R -p ort/atstccfg/* "${to_ort_dest}/atstccfg" - - tar -czvf "$to_ort_dest".tgz -C "$RPMBUILD"/SOURCES $(basename "$to_ort_dest") || \ - { echo "Could not create tar archive $to_ort_dest: $?"; exit 1; } - export PLUGINS=$(grep -l -P '(?&2; + exit 1; + fi + . "$functions_sh"; +} + +#---------------------------------------- +function initBuildArea() { + echo "Initializing the build area for Traffic Ops ORT"; + mkdir -p "$RPMBUILD"/{SPECS,SOURCES,RPMS,SRPMS,BUILD,BUILDROOT} + + local dest=$(createSourceDir traffic_ops_ort); + cd "$ORT_DIR"; + + echo "PATH: $PATH"; + echo "GOPATH: $GOPATH"; + go version; + go env; + + go get -v golang.org/x/crypto/ed25519 golang.org/x/crypto/scrypt golang.org/x/net/ipv4 golang.org/x/net/ipv6 golang.org/x/sys/unix; + + GC=(go build) + GFLAGS=(-v) + if [[ "$DEBUG_BUILD" == true ]]; then + echo "DEBUG_BUILD is enabled, building without optimization or inlining..."; + GFLAGS+=(--gcflags 'all=-N -l'); + fi; + + pushd atstccfg; + "${GC[@]}" "${GCFLAGS[@]}" -ldflags "-X main.GitRevision=`git rev-parse HEAD` -X main.BuildTimestamp=`date +'%Y-%M-%dT%H:%M:%s'` -X main.Version=${TC_VERSION}"; + popd; + + cp -p traffic_ops_ort.pl "$dest"; + cp -p supermicro_udev_mapper.pl "$dest"; + mkdir -p "${dest}/atstccfg"; + cp -a atstccfg/* "${dest}/atstccfg"; + tar -czvf "$dest".tgz -C "$RPMBUILD"/SOURCES $(basename "$dest"); + cp build/traffic_ops_ort.spec "$RPMBUILD"/SPECS/.; + + echo "The build area has been initialized."; +} + +#---------------------------------------- +importFunctions; +checkEnvironment go; +initBuildArea; +buildRpm traffic_ops_ort; diff --git a/traffic_ops/build/traffic_ops_ort.spec b/traffic_ops_ort/build/traffic_ops_ort.spec similarity index 88% rename from traffic_ops/build/traffic_ops_ort.spec rename to traffic_ops_ort/build/traffic_ops_ort.spec index 1147af9b7c..1e14f6b900 100644 --- a/traffic_ops/build/traffic_ops_ort.spec +++ b/traffic_ops_ort/build/traffic_ops_ort.spec @@ -25,7 +25,7 @@ Group: Applications/Communications Source0: traffic_ops_ort-%{version}.tgz URL: https://github.com/apache/trafficcontrol/ Vendor: Apache Software Foundation -Packager: daniel_kirkwood at Cable dot Comcast dot com +Packager: dev at trafficcontrol dot Apache dot org %{?el6:Requires: perl-JSON, perl-libwww-perl, perl-Crypt-SSLeay, perl-Digest-SHA} %{?el7:Requires: perl-JSON, perl-libwww-perl, perl-Crypt-SSLeay, perl-LWP-Protocol-https, perl-Digest-SHA} @@ -39,10 +39,10 @@ tar xvf %{SOURCE0} -C $RPM_SOURCE_DIR %build # copy atstccfg binary -godir=src/github.com/apache/trafficcontrol/traffic_ops/ort/atstccfg +godir=src/github.com/apache/trafficcontrol/traffic_ops_ort/atstccfg ( mkdir -p "$godir" && \ cd "$godir" && \ - cp "$TC_DIR"/traffic_ops/ort/atstccfg/atstccfg . + cp "$TC_DIR"/traffic_ops_ort/atstccfg/atstccfg . ) || { echo "Could not copy go program at $(pwd): $!"; exit 1; } @@ -51,7 +51,7 @@ mkdir -p ${RPM_BUILD_ROOT}/opt/ort cp -p ${RPM_SOURCE_DIR}/traffic_ops_ort-%{version}/traffic_ops_ort.pl ${RPM_BUILD_ROOT}/opt/ort cp -p ${RPM_SOURCE_DIR}/traffic_ops_ort-%{version}/supermicro_udev_mapper.pl ${RPM_BUILD_ROOT}/opt/ort -src=src/github.com/apache/trafficcontrol/traffic_ops/ort/atstccfg +src=src/github.com/apache/trafficcontrol/traffic_ops_ort/atstccfg cp -p "$src"/atstccfg ${RPM_BUILD_ROOT}/opt/ort %clean diff --git a/traffic_ops/ort/supermicro_udev_mapper.pl b/traffic_ops_ort/supermicro_udev_mapper.pl similarity index 100% rename from traffic_ops/ort/supermicro_udev_mapper.pl rename to traffic_ops_ort/supermicro_udev_mapper.pl diff --git a/traffic_ops/ort/traffic_ops_ort.pl b/traffic_ops_ort/traffic_ops_ort.pl similarity index 100% rename from traffic_ops/ort/traffic_ops_ort.pl rename to traffic_ops_ort/traffic_ops_ort.pl