Repo

Repository-specific information

Setup

.env file

  • RANCHER_ALWALDEND_COM_K3S_TOKEN: k3s token for //infra/charts/rancher.dc1.alwaldend.com
  • DNSCONTROL_CLOUDFLAREAPI_ACCOUNT_ID: Cloudflare account id for //infra/dns
  • DNSCONTROL_CLOUDFLAREAPI_API_TOKEN: Cloudflare token for //infra/dns

Setup .bzlenv

. "$(bazel run //tools/bzlenv)"

Compile commands

Build compile_commands.json:

bazel run :refresh_compile_commands

Build everything

bazel build //...

Test everything

bazel test //...

Export .env (bzlenv should export it automatically)

export $(cat .env | xargs)

Replace a rule with another one

find \
  "(" -name "*.bazel" -o -name "*.bzl" -o -name ".bazelrc" -o -name "*.md" ")" \
  -type f \
  -exec sed -i 's|//bzl/rules/txt|//tools/txt|g' "{}" ";"`

Parse a tar manifest

bazel build //projects/alwaldend.com:site_source_archive && \
  cat bazel-bin/projects/alwaldend.com/site_source_archive.manifest | \
  jq -r --slurp ". | flatten | .[].dest" | \
  grep "^content"

Remove a rule

find -name "BUILD.bazel" -type f -exec sed -i '/al_readme(/,/)/d' "{}" ";"

Find all public targets (ignores default_visibility)

bazel query 'attr(visibility, "//visibility:public", //...)'