Skip to content

Commit 9cb9702

Browse files
authored
Try a workaround for the bazel-bin inconsistency. (#592)
If anyone has a better idea, I am all ears. Maybe we could build //src/bootstrap/cloud:crc-binary, then unpack to a tempdir, install from there and delete tempdir via EXIT trap?
1 parent cd7472e commit 9cb9702

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

deploy.sh

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,12 @@ function kc {
7878
}
7979

8080
function prepare_source_install {
81+
# For whatever reasons different combinations of bazel environemnt seem to
82+
# work differently wrt bazel-bin. This hack ensure that both synk and the
83+
# files that synk will install are in bazel-bin
84+
tmpdir="$(mktemp -d)"
8185
bazel ${BAZEL_FLAGS} build //src/go/cmd/synk
82-
# Temporary check for location of the built synk binary:
83-
echo "# 1: Finding synk binary location"
84-
bazel info || /bin/true
85-
find -L ${DIR}/bazel-bin/ -name "synk" -exec ls -al {} \; || /bin/true
86+
cp -a ${DIR}/bazel-bin/src/go/cmd/synk/synk_/synk ${tmpdir}/synk
8687

8788
bazel ${BAZEL_FLAGS} build \
8889
"@hashicorp_terraform//:terraform" \
@@ -91,16 +92,12 @@ function prepare_source_install {
9192
//src/app_charts/platform-apps:platform-apps-cloud \
9293
//src/app_charts:push \
9394
//src/bootstrap/cloud:setup-robot.digest \
94-
//src/go/cmd/setup-robot:setup-robot.push \
95-
//src/go/cmd/synk
96-
97-
# Temporary check for location of the built synk binary:
98-
echo "# 2: Finding synk binary location"
99-
bazel info || /bin/true
100-
# Haha: '/workspace/bazel-bin/src/go/cmd/synk': No such file or directory
101-
# find -L ${DIR}/bazel-bin/src/go/cmd/synk -name "synk" -type f
102-
# only /workspace/bazel-bin/src/go/pkg/synk
103-
find -L ${DIR}/bazel-bin/ -name "synk" -exec ls -al {} \; || /bin/true
95+
//src/go/cmd/setup-robot:setup-robot.push
96+
97+
mkdir -p ${DIR}/bazel-bin/src/go/cmd/synk/synk_/
98+
mv -n ${tmpdir}/synk ${DIR}/bazel-bin/src/go/cmd/synk/synk_/synk
99+
rm -f ${tmpdir}/synk
100+
rmdir ${tmpdir} || /bin/true
104101

105102
# TODO(rodrigoq): the artifactregistry API would be enabled by Terraform, but
106103
# that doesn't run until later, as it needs the digest of the setup-robot

0 commit comments

Comments
 (0)