blob: d7f4218ec8715941afd8a366fa89cf5b759f8adb [file] [log] [blame]
Zack Williams3403ff42019-08-13 18:30:42 -07001#!/usr/bin/env bash
2
3# Copyright 2019-present Open Networking Foundation
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# sync-dir.sh - run build step then sync a directory to a remote server
18set -eu -o pipefail
19
20# when not running under Jenkins, use current dir as workspace, a blank project
21# name
22WORKSPACE=${WORKSPACE:-.}
23
24# run the build command
25$BUILD_COMMAND
26
27# sync the files to the target
28rsync -rvzh --delete-after --exclude=.git "$WORKSPACE/$BUILD_OUTPUT_PATH" "$SYNC_TARGET_SERVER:$SYNC_TARGET_PATH"