Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions container/incremental_load.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,14 @@ set -eu
# This is a generated file that loads all docker layers built by "docker_build".

function guess_runfiles() {
pushd ${BASH_SOURCE[0]}.runfiles > /dev/null 2>&1
pwd
popd > /dev/null 2>&1
if [ -d ${BASH_SOURCE[0]}.runfiles ]; then
# Runfiles are adjacent to the current script.
echo "$( cd ${BASH_SOURCE[0]}.runfiles && pwd )"
else
# The current script is within some other script's runfiles.
mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo $mydir | sed -e 's|\(.*\.runfiles\)/.*|\1|'
fi
}

RUNFILES="${PYTHON_RUNFILES:-$(guess_runfiles)}"
Expand Down
11 changes: 8 additions & 3 deletions container/push-tag.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@
set -eu

function guess_runfiles() {
pushd ${BASH_SOURCE[0]}.runfiles > /dev/null 2>&1
pwd
popd > /dev/null 2>&1
if [ -d ${BASH_SOURCE[0]}.runfiles ]; then
# Runfiles are adjacent to the current script.
echo "$( cd ${BASH_SOURCE[0]}.runfiles && pwd )"
else
# The current script is within some other script's runfiles.
mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo $mydir | sed -e 's|\(.*\.runfiles\)/.*|\1|'
fi
}

RUNFILES="${PYTHON_RUNFILES:-$(guess_runfiles)}"
Expand Down
11 changes: 8 additions & 3 deletions contrib/push-all.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@

set -eu
function guess_runfiles() {
pushd ${BASH_SOURCE[0]}.runfiles > /dev/null 2>&1
pwd
popd > /dev/null 2>&1
if [ -d ${BASH_SOURCE[0]}.runfiles ]; then
# Runfiles are adjacent to the current script.
echo "$( cd ${BASH_SOURCE[0]}.runfiles && pwd )"
else
# The current script is within some other script's runfiles.
mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo $mydir | sed -e 's|\(.*\.runfiles\)/.*|\1|'
fi
}

RUNFILES="${PYTHON_RUNFILES:-$(guess_runfiles)}"
Expand Down
8 changes: 8 additions & 0 deletions testdata/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,14 @@ cc_image(
binary = ":cc_binary",
)

# Test that we can also load image from within another script.
sh_binary(
name = "cc_image_wrapper",
srcs = ["cc_image_wrapper.sh"],
args = ["$(location :cc_image)"],
data = [":cc_image"],
)

load(
"//java:image.bzl",
"java_image",
Expand Down
4 changes: 4 additions & 0 deletions testdata/cc_image_wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
set -euo pipefail

"$1" || { echo "FAIL!"; exit 1; }
7 changes: 7 additions & 0 deletions testing/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ function test_cc_binary_as_image() {
EXPECT_CONTAINS "$(bazel run "$@" testdata:cc_binary_as_image)" "Hello World"
}

function test_cc_image_wrapper() {
cd "${ROOT}"
clear_docker
EXPECT_CONTAINS "$(bazel run "$@" testdata:cc_image_wrapper)" "Hello World"
}

function test_go_image() {
cd "${ROOT}"
clear_docker
Expand Down Expand Up @@ -375,6 +381,7 @@ test_cc_image -c opt
test_cc_image -c dbg
test_cc_binary_as_image -c opt
test_cc_binary_as_image -c dbg
test_cc_image_wrapper
test_go_image -c opt
test_go_image -c dbg
test_go_image_busybox
Expand Down