blob: 07f4d725682262b0cc680a7207b6485919f82e6f [file] [log] [blame]
Zack Williamsbe2f86f2019-09-30 22:39:13 -07001#!/usr/bin/env bash
2
Joey Armstrong518f3572024-02-11 07:56:25 -05003# Copyright 2019-2024 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
Eric Ball550960b2025-03-28 18:05:25 -070028rsync -rvzh --delete-after --exclude=.git "$WORKSPACE/$BUILD_OUTPUT_PATH/$GERRIT_BRANCH" \
29 "$SYNC_TARGET_SERVER:$SYNC_TARGET_PATH/$GERRIT_BRANCH"
30# Parent dir index.html will only be created on master build.
31rsync -vzh "$WORKSPACE/$BUILD_OUTPUT/index.html" \
32 "$SYNC_TARGET_SERVER:$SYNC_TARGET_PATH/index.html" || true