blob: b99507f77ebd0c02eed92db5c145f78a20be189a [file] [log] [blame]
Zack Williamsbe2f86f2019-09-30 22:39:13 -07001#!/usr/bin/env bash
2
Joey Armstrongbeef4cd2023-01-18 09:59:58 -05003# Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
Zack Williamsbe2f86f2019-09-30 22:39:13 -07004#
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"