From 393618f7156429b7736ec8ed34e13984153acf6d Mon Sep 17 00:00:00 2001 From: mirons Date: Wed, 22 Mar 2017 11:47:51 -0500 Subject: [PATCH] Establishing a common download URL between DM and travis (#135) * Enabling common binaries for travis and DM. * Updates. * Updating protoc url download filename. --- data/protoc_url.txt | 1 + deployment-templates/py/forseti-instance.py | 6 +++-- scripts/travis_install.sh | 28 --------------------- scripts/travis_install_protoc.sh | 7 +++--- 4 files changed, 9 insertions(+), 33 deletions(-) create mode 100644 data/protoc_url.txt delete mode 100644 scripts/travis_install.sh diff --git a/data/protoc_url.txt b/data/protoc_url.txt new file mode 100644 index 0000000000..86155b5022 --- /dev/null +++ b/data/protoc_url.txt @@ -0,0 +1 @@ +https://github.com/google/protobuf/releases/download/v3.2.0/protoc-3.2.0-linux-x86_64.zip diff --git a/deployment-templates/py/forseti-instance.py b/deployment-templates/py/forseti-instance.py index 98d8f97bbd..6d9761f828 100644 --- a/deployment-templates/py/forseti-instance.py +++ b/deployment-templates/py/forseti-instance.py @@ -79,6 +79,7 @@ def GenerateConfig(context): sudo apt-get install -y python-pip python-dev USER_HOME=/home/ubuntu +FORSETI_PROTOC_URL=https://raw.githubusercontent.com/GoogleCloudPlatform/forseti-security/master/data/protoc # Check whether Cloud SQL proxy is installed CLOUD_SQL_PROXY=$(ls $USER_HOME/cloud_sql_proxy) @@ -118,8 +119,9 @@ def GenerateConfig(context): PROTOC_PATH=$(which protoc) if [ -z "$PROTOC_PATH" ]; then cd $USER_HOME - wget https://github.com/google/protobuf/releases/download/v3.2.0/protoc-3.2.0-linux-x86_64.zip - unzip -o protoc-3.2.0-linux-x86_64.zip + PROTOC_DOWNLOAD_URL=$(curl -s $FORSETI_PROTOC_URL) + wget $PROTOC_DOWNLOAD_URL + unzip -o $(basename $PROTOC_DOWNLOAD_URL) sudo cp bin/protoc /usr/local/bin fi diff --git a/scripts/travis_install.sh b/scripts/travis_install.sh deleted file mode 100644 index 9a39f6275b..0000000000 --- a/scripts/travis_install.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# Copyright 2017 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. - -# A script to perform the download and installation of protobuf. - -set -e - -echo "Downloading protoc." -mkdir -p $PROTOC_DOWNLOAD_PATH -cd $PROTOC_DOWNLOAD_PATH -wget https://github.com/google/protobuf/releases/download/v3.2.0/protoc-3.2.0-linux-x86_64.zip - -echo "Installing protoc." -unzip protoc-3.2.0-linux-x86_64.zip -sudo cp /tmp/protoc/bin/protoc $PROTOC_PATH -sudo chmod 755 $PROTOC diff --git a/scripts/travis_install_protoc.sh b/scripts/travis_install_protoc.sh index 12355a073f..ca08051294 100644 --- a/scripts/travis_install_protoc.sh +++ b/scripts/travis_install_protoc.sh @@ -18,10 +18,11 @@ set -e PROTOC_DOWNLOAD_PATH="/tmp/protoc" +FORSETI_PROTOC_URL="https://raw.githubusercontent.com/GoogleCloudPlatform/forseti-security/master/data/protoc" echo "Downloading protoc." mkdir -p $PROTOC_DOWNLOAD_PATH cd $PROTOC_DOWNLOAD_PATH -wget -P $PROTOC_DOWNLOAD_PATH \ - https://github.com/google/protobuf/releases/download/v3.2.0/protoc-3.2.0-linux-x86_64.zip -unzip -d $PROTOC_DOWNLOAD_PATH protoc-3.2.0-linux-x86_64.zip +PROTOC_DOWNLOAD_URL=$(curl -s $FORSETI_PROTOC_URL) +wget -P $PROTOC_DOWNLOAD_PATH $PROTOC_DOWNLOAD_URL +unzip -d $PROTOC_DOWNLOAD_PATH $(basename PROTOC_DOWNLOAD_URL)