Skip to content

Commit 9e2ea22

Browse files
committed
Add back download fns to lib.sh
1 parent 460157b commit 9e2ea22

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

test/scripts/utils/lib.sh

+56
Original file line numberDiff line numberDiff line change
@@ -284,3 +284,59 @@ function build_current_version {
284284
echo "GUI e2e executable for current version already exists at $gui_test_bin, skipping build"
285285
fi
286286
}
287+
288+
function download_app_package {
289+
local version=$1
290+
local os=$2
291+
local package_repo=""
292+
293+
if is_dev_version "$version"; then
294+
package_repo="${BUILD_DEV_REPOSITORY}"
295+
else
296+
package_repo="${BUILD_RELEASE_REPOSITORY}"
297+
fi
298+
299+
local filename
300+
filename=$(get_app_filename "$version" "$os")
301+
local url="${package_repo}/$version/$filename"
302+
303+
local package_dir
304+
package_dir=$(get_package_dir)
305+
if [[ ! -f "$package_dir/$filename" ]]; then
306+
echo "Downloading build for $version ($os) from $url"
307+
if ! curl -sf -o "$package_dir/$filename" "$url"; then
308+
echo "Failed to download package from $url (hint: build may not exist, check the url)" 1>&2
309+
exit 1
310+
fi
311+
else
312+
echo "App package for version $version ($os) already exists at $package_dir/$filename, skipping download"
313+
fi
314+
}
315+
316+
function download_e2e_executable {
317+
local version=${1:?Error: version not set}
318+
local os=${2:?Error: os not set}
319+
local package_repo
320+
321+
if is_dev_version "$version"; then
322+
package_repo="${BUILD_DEV_REPOSITORY}"
323+
else
324+
package_repo="${BUILD_RELEASE_REPOSITORY}"
325+
fi
326+
327+
local filename
328+
filename=$(get_e2e_filename "$version" "$os")
329+
local url="${package_repo}/$version/additional-files/$filename"
330+
331+
local package_dir
332+
package_dir=$(get_package_dir)
333+
if [[ ! -f "$package_dir/$filename" ]]; then
334+
echo "Downloading e2e executable for $version ($os) from $url"
335+
if ! curl -sf -o "$package_dir/$filename" "$url"; then
336+
echo "Failed to download package from $url (hint: build may not exist, check the url)" 1>&2
337+
exit 1
338+
fi
339+
else
340+
echo "GUI e2e executable for version $version ($os) already exists at $package_dir/$filename, skipping download"
341+
fi
342+
}

0 commit comments

Comments
 (0)