Zack Williams | be2f86f | 2019-09-30 22:39:13 -0700 | [diff] [blame^] | 1 | #!/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 |
| 18 | set -eu -o pipefail |
| 19 | |
| 20 | # when not running under Jenkins, use current dir as workspace, a blank project |
| 21 | # name |
| 22 | WORKSPACE=${WORKSPACE:-.} |
| 23 | |
| 24 | # run the build command |
| 25 | $BUILD_COMMAND |
| 26 | |
| 27 | # sync the files to the target |
| 28 | rsync -rvzh --delete-after --exclude=.git "$WORKSPACE/$BUILD_OUTPUT_PATH" "$SYNC_TARGET_SERVER:$SYNC_TARGET_PATH" |