Skip to content

Commit

Permalink
Fix mirror_coursier script (#1044)
Browse files Browse the repository at this point in the history
* Fix mirror_coursier script

* Fix formatting.
  • Loading branch information
jin authored Jan 18, 2024
1 parent e61798e commit 6777e0d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 2 additions & 0 deletions scripts/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("//private/rules:artifact.bzl", "artifact")
load("//private:versions.bzl", "COURSIER_CLI_HTTP_FILE_NAME")

genrule(
name = "buildifier-bin",
Expand All @@ -17,6 +18,7 @@ sh_binary(
srcs = [":mirror_coursier.sh"],
data = ["@coursier_cli//file"],
visibility = ["//:__pkg__"],
args = [COURSIER_CLI_HTTP_FILE_NAME],
)

genrule(
Expand Down
15 changes: 8 additions & 7 deletions scripts/mirror_coursier.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
# on Google Cloud Storage for redundancy. The original artifacts are
# hosted on https://github.com/coursier/coursier/releases.

set -euo pipefail
set -xeuo pipefail

readonly repo_name=$(ls external/ | grep coursier_cli_v*)
readonly coursier_cli_jar="external/$repo_name/file/downloaded"
readonly dest_filename=$1; shift;
readonly coursier_cli_jar="external/_main~_repo_rules~coursier_cli/file/downloaded"
chmod u+x $coursier_cli_jar

# Upload Coursier to GCS
# -n for no-clobber, so we don't overwrite existing files
gsutil cp -n $coursier_cli_jar \
gs://bazel-mirror/coursier_cli/$repo_name.jar
# Upload Coursier to Bazel/Google-managed GCS
# -n for no-clobber, so we don't overwrite existing files.
# -v prints the URI after a successful upload.
gsutil cp -v -n $coursier_cli_jar \
gs://bazel-mirror/coursier_cli/$dest_filename.jar

0 comments on commit 6777e0d

Please sign in to comment.