Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • bazel/rules_curl
1 result
Show changes
Commits on Source (4)
# Authentication
common --credential_helper=gitlab.arm.com=%workspace%/.credentials.sh
# `bzlmod` pre-release registries
common --registry https://bcr.bazel.build
common --registry=https://gitlab.arm.com/bazel/rules_toolchain/-/releases/v1.0.0-alpha.16/downloads
common --registry=https://gitlab.arm.com/bazel/rules_download/-/releases/v1.0.0-alpha.5/downloads
common --registry=https://gitlab.arm.com/bazel/rules_cosmos/-/releases/v1.0.0-alpha.2/downloads
# Build cache
build --experimental_guard_against_concurrent_changes
......
#! /bin/sh
# https://github.com/bazelbuild/proposals/blob/main/designs/2022-06-07-bazel-credential-helpers.md
# https://github.com/docker/docker-credential-helpers
# Strict shell
set -o errexit -o nounset
# Validate the command
if test ${#} != 1; then
printf >&2 'Error: unexpected number of arguments: %s\n' "${#}"
exit 1
elif test "${1}" != "get"; then
printf >&2 'Error: unexpected credentials command: %s\n' "${1}"
exit 1
fi
# Read in the JSON
while IFS= read -r LINE; do
printf >&2 'Error: unexpected newline on stdin: %s\n' "${LINE}"
exit 2
done
JSON="${LINE}"
readonly JSON
# "Process" the JSON
URI="${JSON}"
URI="${URI#*{}"
URI="${URI#*\"uri\"}"
URI="${URI#*:}"
URI="${URI#*\"}"
URI="${URI%\}*}"
URI="${URI%\"*}"
readonly URI
printf >&2 'URI: %s\n' "${URI}"
# Grab the host
HOST="${URI}"
HOST="${HOST#https://}"
HOST="${HOST#http://}"
HOST="${HOST%%/*}"
readonly HOST
printf >&2 'HOST: %s\n' "${HOST}"
# Attempt to parse the `.netrc`
if test -f "${HOME}/.netrc"; then
while IFS= read -r LINE <&3; do
# shellcheck disable=SC2249
case "${LINE}" in
"machine "*"${HOST}")
while IFS= read -r LINE <&3; do
case "${LINE}" in
"machine "*)
break
;;
"password "*)
printf >&2 'Using network run commands\n'
printf '{"headers":{"Authorization": ["Bearer %s"]}}\n' "${LINE##password }"
exit 0
;;
esac
done
;;
esac
done 3<"${HOME}/.netrc"
fi
if ! test -z ${BZLMOD_TOKEN+x}; then
printf >&2 'Using Bazel Module Token\n'
printf '{"headers":{"PRIVATE-TOKEN": ["%s"]}}\n' "${BZLMOD_TOKEN}"
exit 0
fi
if ! test -z ${GITLAB_TOKEN+x}; then
printf >&2 'Using GitLab Token\n'
printf '{"headers":{"PRIVATE-TOKEN": ["%s"]}}\n' "${GITLAB_TOKEN}"
exit 0
fi
if ! test -z ${CI_JOB_TOKEN+x}; then
printf >&2 'Using CI Job Token\n'
printf '{"headers":{"JOB-TOKEN": ["%s"]}}\n' "${CI_JOB_TOKEN}"
exit 0
fi
printf >&2 'No authentication found\n'
printf '{}\n'
exit 0
# [1.0.0-alpha.6](https://git.gitlab.arm.com/bazel/rules_curl/compare/v1.0.0-alpha.5...v1.0.0-alpha.6) (2024-02-15)
### Bug Fixes
- switch to `toolchain_utils`/`ape` from BCR ([2d3127a](https://git.gitlab.arm.com/bazel/rules_curl/commit/2d3127a5c51e0e4604a3dbead5f2d37c560dbb2f))
# [1.0.0-alpha.5](https://git.gitlab.arm.com/bazel/rules_curl/compare/v1.0.0-alpha.4...v1.0.0-alpha.5) (2024-02-08)
### Features
......
module(
name = "rules_curl",
version = "1.0.0-alpha.5",
version = "1.0.0-alpha.6",
bazel_compatibility = [
">=7.0.0",
],
compatibility_level = 1,
)
bazel_dep(name = "rules_toolchain", version = "1.0.0-alpha.16")
bazel_dep(name = "rules_cosmos", version = "1.0.0-alpha.2")
bazel_dep(name = "toolchain_utils", version = "1.0.0-beta.1")
bazel_dep(name = "ape", version = "1.0.0-alpha.1")
export = use_extension("@rules_toolchain//toolchain/export:defs.bzl", "toolchain_export")
use_repo(export, "cosmos-curl")
export = use_extension("@toolchain_utils//toolchain/export:defs.bzl", "toolchain_export")
use_repo(export, "ape-curl")
export.symlink(
name = "curl",
target = "@cosmos-curl",
target = "@ape-curl",
)
use_repo(export, "curl")
resolved = use_repo_rule("@rules_toolchain//toolchain/resolved:defs.bzl", "toolchain_resolved")
resolved = use_repo_rule("@toolchain_utils//toolchain/resolved:defs.bzl", "toolchain_resolved")
resolved(
name = "resolved-curl",
......
This diff is collapsed.
# `rules_curl`
> A Bazel ruleset for performing operations with cURL
> A Bazel ruleset for performing operations with cURL, hermetically.
## Getting Started
......
load("@rules_toolchain//toolchain/test:defs.bzl", "toolchain_test")
load("@toolchain_utils//toolchain/test:defs.bzl", "toolchain_test")
toolchain_type(
name = "type",
......@@ -6,8 +6,8 @@ toolchain_type(
)
toolchain(
name = "cosmos",
toolchain = "@cosmos-curl//:curl",
name = "ape",
toolchain = "@ape-curl//:curl",
toolchain_type = ":type",
)
......
......@@ -7,7 +7,7 @@ alias(
name = "template",
actual = select(
{
"@rules_toolchain//toolchain/constraint/os:windows": ":nt.tmpl.bat",
"@toolchain_utils//toolchain/constraint/os:windows": ":nt.tmpl.bat",
"//conditions:default": ":posix.tmpl.sh",
},
no_match_error = "No script template available for `curl_upload_file`",
......
# Authentication
common --credential_helper=gitlab.arm.com=%workspace%/.credentials.sh
# `bzlmod` pre-release registries
common --registry https://bcr.bazel.build
common --registry=https://gitlab.arm.com/bazel/rules_toolchain/-/releases/v1.0.0-alpha.16/downloads
common --registry=https://gitlab.arm.com/bazel/rules_download/-/releases/v1.0.0-alpha.5/downloads
common --registry=https://gitlab.arm.com/bazel/rules_cosmos/-/releases/v1.0.0-alpha.2/downloads
# Build cache
build --experimental_guard_against_concurrent_changes
......
#! /bin/sh
# https://github.com/bazelbuild/proposals/blob/main/designs/2022-06-07-bazel-credential-helpers.md
# https://github.com/docker/docker-credential-helpers
# Strict shell
set -o errexit -o nounset
# Validate the command
if test ${#} != 1; then
printf >&2 'Error: unexpected number of arguments: %s\n' "${#}"
exit 1
elif test "${1}" != "get"; then
printf >&2 'Error: unexpected credentials command: %s\n' "${1}"
exit 1
fi
# Read in the JSON
while IFS= read -r LINE; do
printf >&2 'Error: unexpected newline on stdin: %s\n' "${LINE}"
exit 2
done
JSON="${LINE}"
readonly JSON
# "Process" the JSON
URI="${JSON}"
URI="${URI#*{}"
URI="${URI#*\"uri\"}"
URI="${URI#*:}"
URI="${URI#*\"}"
URI="${URI%\}*}"
URI="${URI%\"*}"
readonly URI
printf >&2 'URI: %s\n' "${URI}"
# Grab the host
HOST="${URI}"
HOST="${HOST#https://}"
HOST="${HOST#http://}"
HOST="${HOST%%/*}"
readonly HOST
printf >&2 'HOST: %s\n' "${HOST}"
# Attempt to parse the `.netrc`
if test -f "${HOME}/.netrc"; then
while IFS= read -r LINE <&3; do
# shellcheck disable=SC2249
case "${LINE}" in
"machine "*"${HOST}")
while IFS= read -r LINE <&3; do
case "${LINE}" in
"machine "*)
break
;;
"password "*)
printf >&2 'Using network run commands\n'
printf '{"headers":{"Authorization": ["Bearer %s"]}}\n' "${LINE##password }"
exit 0
;;
esac
done
;;
esac
done 3<"${HOME}/.netrc"
fi
if ! test -z ${BZLMOD_TOKEN+x}; then
printf >&2 'Using Bazel Module Token\n'
printf '{"headers":{"PRIVATE-TOKEN": ["%s"]}}\n' "${BZLMOD_TOKEN}"
exit 0
fi
if ! test -z ${GITLAB_TOKEN+x}; then
printf >&2 'Using GitLab Token\n'
printf '{"headers":{"PRIVATE-TOKEN": ["%s"]}}\n' "${GITLAB_TOKEN}"
exit 0
fi
if ! test -z ${CI_JOB_TOKEN+x}; then
printf >&2 'Using CI Job Token\n'
printf '{"headers":{"JOB-TOKEN": ["%s"]}}\n' "${CI_JOB_TOKEN}"
exit 0
fi
printf >&2 'No authentication found\n'
printf '{}\n'
exit 0
......@@ -6,14 +6,14 @@ module(
)
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "rules_toolchain", version = "1.0.0-alpha.16")
bazel_dep(name = "toolchain_utils", version = "1.0.0-beta.1")
bazel_dep(name = "rules_curl")
local_path_override(
module_name = "rules_curl",
path = "..",
)
export = use_extension("@rules_toolchain//toolchain/export:defs.bzl", "toolchain_export")
export = use_extension("@toolchain_utils//toolchain/export:defs.bzl", "toolchain_export")
use_repo(export, "curl")
register_toolchains("//mock:all")
This diff is collapsed.
load("@rules_toolchain//toolchain/symlink/target:defs.bzl", "toolchain_symlink_target")
load("@rules_toolchain//toolchain/test:defs.bzl", "toolchain_test")
load("@toolchain_utils//toolchain/symlink/target:defs.bzl", "toolchain_symlink_target")
load("@toolchain_utils//toolchain/test:defs.bzl", "toolchain_test")
package(default_visibility = ["//visibility:public"])
......@@ -11,7 +11,7 @@ toolchain_symlink_target(
toolchain(
name = "linux",
exec_compatible_with = [
"@rules_toolchain//toolchain/constraint/os:linux",
"@toolchain_utils//toolchain/constraint/os:linux",
],
toolchain = ":shell",
toolchain_type = "@rules_curl//curl/toolchain/cli:type",
......@@ -20,7 +20,7 @@ toolchain(
toolchain(
name = "macos",
exec_compatible_with = [
"@rules_toolchain//toolchain/constraint/os:macos",
"@toolchain_utils//toolchain/constraint/os:macos",
],
toolchain = ":shell",
toolchain_type = "@rules_curl//curl/toolchain/cli:type",
......