-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: copy files from the contrib templates
- Loading branch information
Showing
33 changed files
with
392 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
e2e/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Bazel settings that apply to this repository. | ||
# Take care to document any settings that you expect users to apply. | ||
# Settings that apply only to CI are in .github/workflows/ci.bazelrc | ||
|
||
# Required until this is the default; expected in Bazel 7 | ||
common --enable_bzlmod | ||
|
||
# Don’t want to push a rules author to update their deps if not needed. | ||
# https://bazel.build/reference/command-line-reference#flag--check_direct_dependencies | ||
# https://bazelbuild.slack.com/archives/C014RARENH0/p1691158021917459?thread_ts=1691156601.420349&cid=C014RARENH0 | ||
common --check_direct_dependencies=off | ||
|
||
# Load any settings specific to the current user. | ||
# .bazelrc.user should appear in .gitignore so that settings are not shared with team members | ||
# This needs to be last statement in this | ||
# config, as the user configuration should be able to overwrite flags from this file. | ||
# See https://docs.bazel.build/versions/master/best-practices.html#bazelrc | ||
# (Note that we use .bazelrc.user so the file appears next to .bazelrc in directory listing, | ||
# rather than user.bazelrc as suggested in the Bazel docs) | ||
try-import %workspace%/.bazelrc.user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
6.2.1 | ||
# The first line of this file is used by Bazelisk and Bazel to be sure | ||
# the right version of Bazel is used to build and test this repo. | ||
# This also defines which version is used on CI. | ||
# | ||
# Note that you should also run integration_tests against other Bazel | ||
# versions you support. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Bazel Central Registry | ||
|
||
When the ruleset is released, we want it to be published to the | ||
Bazel Central Registry automatically: | ||
<https://registry.bazel.build> | ||
|
||
This folder contains configuration files to automate the publish step. | ||
See <https://github.com/bazel-contrib/publish-to-bcr/blob/main/templates/README.md> | ||
for authoritative documentation about these files. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# See https://github.com/bazel-contrib/publish-to-bcr#a-note-on-release-automation | ||
# for guidance about whether to uncomment this section: | ||
# | ||
fixedReleaser: | ||
login: loosebazooka | ||
email: [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"homepage": "https://github.com/GoogleContainerTools/rules_distroless", | ||
"maintainers": [], | ||
"repository": ["github:GoogleContainerTools/rules_distroless"], | ||
"versions": [], | ||
"yanked_versions": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
bcr_test_module: | ||
module_path: "e2e/smoke" | ||
matrix: | ||
platform: ["debian10", "macos", "ubuntu2004", "windows"] | ||
tasks: | ||
run_tests: | ||
name: "Run test module" | ||
platform: ${{ platform }} | ||
test_targets: | ||
- "//..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"integrity": "**leave this alone**", | ||
"strip_prefix": "{REPO}-{VERSION}", | ||
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/rules_distroless-{TAG}.tar.gz" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# In code review, collapse generated files | ||
docs/*.md linguist-generated=true | ||
|
||
################################# | ||
# Configuration for 'git archive' | ||
# See https://git-scm.com/docs/git-archive#ATTRIBUTES | ||
|
||
# Don't include examples in the distribution artifact, to reduce size. | ||
# You may want to add additional exclusions for folders or files that users don't need. | ||
examples export-ignore | ||
|
||
# Occasionally there's a need to "stamp" the release version into a file | ||
distroless/version.bzl export-subst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
load("@buildifier_prebuilt//:rules.bzl", "buildifier") | ||
|
||
buildifier( | ||
name = "buildifier.check", | ||
exclude_patterns = ["./.git/*"], | ||
lint_mode = "warn", | ||
mode = "diff", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Buildifier | ||
|
||
# Controls when the action will run. | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the main branch | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: buildifier | ||
run: bazel run --enable_bzlmod //.github/workflows:buildifier.check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# This file contains Bazel settings to apply on CI only. | ||
# It is referenced with a --bazelrc option in the call to bazel in ci.yaml | ||
|
||
# Debug where options came from | ||
build --announce_rc | ||
# This directory is configured in GitHub actions to be persisted between runs. | ||
# We do not enable the repository cache to cache downloaded external artifacts | ||
# as these are generally faster to download again than to fetch them from the | ||
# GitHub actions cache. | ||
build --disk_cache=~/.cache/bazel | ||
# Don't rely on test logs being easily accessible from the test runner, | ||
# though it makes the log noisier. | ||
test --test_output=errors | ||
# Allows tests to run bazelisk-in-bazel, since this is the cache folder used | ||
test --test_env=XDG_CACHE_HOME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: CI | ||
|
||
# Controls when the action will run. | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the main branch | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
# Cancel previous actions from the same PR: https://stackoverflow.com/a/72408109 | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
test: | ||
uses: bazel-contrib/.github/.github/workflows/bazel.yaml@b134b73fcae522bc77dcc03533d3de20b45714bf | ||
with: | ||
folders: | | ||
[ | ||
".", | ||
"e2e/smoke" | ||
] | ||
exclude: | | ||
[ | ||
{"folder": ".", "bzlmodEnabled": false}, | ||
{"bazelversion": "5.4.0", "bzlmodEnabled": true}, | ||
{"bazelversion": "5.4.0", "os": "macos-latest"}, | ||
{"bazelversion": "5.4.0", "os": "windows-latest"}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Cut a release whenever a new tag is pushed to the repo. | ||
# You should use an annotated tag, like `git tag -a v1.2.3` | ||
# and put the release notes into the commit message for the tag. | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
|
||
jobs: | ||
release: | ||
uses: bazel-contrib/.github/.github/workflows/release_ruleset.yaml@v4 | ||
with: | ||
release_files: rules_distroless-*.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit -o nounset -o pipefail | ||
|
||
# Set by GH actions, see | ||
# https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables | ||
TAG=${GITHUB_REF_NAME} | ||
# The prefix is chosen to match what GitHub generates for source archives | ||
# This guarantees that users can easily switch from a released artifact to a source archive | ||
# with minimal differences in their code (e.g. strip_prefix remains the same) | ||
PREFIX="rules_distroless-${TAG:1}" | ||
ARCHIVE="rules_distroless-$TAG.tar.gz" | ||
|
||
# NB: configuration for 'git archive' is in /.gitattributes | ||
git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip > $ARCHIVE | ||
SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}') | ||
|
||
cat << EOF | ||
## Using Bzlmod with Bazel 6 | ||
1. Enable with \`common --enable_bzlmod\` in \`.bazelrc\`. | ||
2. Add to your \`MODULE.bazel\` file: | ||
\`\`\`starlark | ||
bazel_dep(name = "rules_distroless", version = "${TAG:1}") | ||
\`\`\` | ||
## Using WORKSPACE | ||
Paste this snippet into your `WORKSPACE.bazel` file: | ||
\`\`\`starlark | ||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
http_archive( | ||
name = "rules_distroless", | ||
sha256 = "${SHA}", | ||
strip_prefix = "${PREFIX}", | ||
url = "https://github.com/GoogleContainerTools/rules_distroless/releases/download/${TAG}/${ARCHIVE}", | ||
) | ||
EOF | ||
|
||
awk 'f;/--SNIP--/{f=1}' e2e/smoke/WORKSPACE.bazel | ||
echo "\`\`\`" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
bazel-* | ||
.bazelrc.user | ||
.idea/ | ||
.ijwb/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# See CONTRIBUTING.md for instructions. | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
|
||
# Commitizen runs in commit-msg stage | ||
# but we don't want to run the other hooks on commit messages | ||
default_stages: [commit] | ||
|
||
# Use a slightly older version of node by default | ||
# as the default uses a very new version of GLIBC | ||
default_language_version: | ||
node: 16.18.0 | ||
|
||
repos: | ||
# Check formatting and lint for starlark code | ||
- repo: https://github.com/keith/pre-commit-buildifier | ||
rev: 6.1.0.1 | ||
hooks: | ||
- id: buildifier | ||
- id: buildifier-lint | ||
# Enforce that commit messages allow for later changelog generation | ||
- repo: https://github.com/commitizen-tools/commitizen | ||
rev: v2.18.0 | ||
hooks: | ||
# Requires that commitizen is already installed | ||
- id: commitizen | ||
stages: [commit-msg] | ||
- repo: https://github.com/pre-commit/mirrors-prettier | ||
rev: "v2.4.0" | ||
hooks: | ||
- id: prettier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
docs/*.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
load("@bazel_gazelle//:def.bzl", "gazelle", "gazelle_binary") | ||
|
||
gazelle_binary( | ||
name = "gazelle_bin", | ||
languages = ["@bazel_skylib_gazelle_plugin//bzl"], | ||
) | ||
|
||
gazelle( | ||
name = "gazelle", | ||
gazelle = "gazelle_bin", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
"Bazel dependencies" | ||
|
||
module( | ||
name = "rules_distroless", | ||
version = "0.0.0", | ||
compatibility_level = 1, | ||
) | ||
|
||
bazel_dep(name = "bazel_skylib", version = "1.4.1") | ||
bazel_dep(name = "aspect_bazel_lib", version = "1.32.1") | ||
|
||
bazel_dep(name = "gazelle", version = "0.29.0", dev_dependency = True, repo_name = "bazel_gazelle") | ||
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.4.1", dev_dependency = True) | ||
bazel_dep(name = "buildifier_prebuilt", version = "6.1.2", dev_dependency = True) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Marker that this is the root of a Bazel workspace. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
load("@bazel_skylib//:bzl_library.bzl", "bzl_library") | ||
|
||
# For stardoc to reference the files | ||
exports_files(["defs.bzl"]) | ||
|
||
bzl_library( | ||
name = "repositories", | ||
srcs = ["repositories.bzl"], | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"@bazel_tools//tools/build_defs/repo:http.bzl", | ||
"@bazel_tools//tools/build_defs/repo:utils.bzl", | ||
], | ||
) | ||
|
||
bzl_library( | ||
name = "defs", | ||
srcs = ["defs.bzl"], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
"Public API re-exports" | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""Declare runtime dependencies | ||
These are needed for local dev, and users must install them as well. | ||
See https://docs.bazel.build/versions/main/skylark/deploying.html#dependencies | ||
""" | ||
|
||
load("@bazel_tools//tools/build_defs/repo:http.bzl", _http_archive = "http_archive") | ||
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") | ||
|
||
def http_archive(name, **kwargs): | ||
maybe(_http_archive, name = name, **kwargs) | ||
|
||
# WARNING: any changes in this function may be BREAKING CHANGES for users | ||
# because we'll fetch a dependency which may be different from one that | ||
# they were previously fetching later in their WORKSPACE setup, and now | ||
# ours took precedence. Such breakages are challenging for users, so any | ||
# changes in this function should be marked as BREAKING in the commit message | ||
# and released only in semver majors. | ||
# This is all fixed by bzlmod, so we just tolerate it for now. | ||
def rules_distroless_dependencies(): | ||
# The minimal version of bazel_skylib we require | ||
http_archive( | ||
name = "bazel_skylib", | ||
sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506", | ||
urls = [ | ||
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz", | ||
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz", | ||
], | ||
) | ||
|
||
def distroless_register_toolchains(name): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# This load statement must be in the docs/ package rather than anything users depend on | ||
# so that the dependency on stardoc doesn't leak to them. | ||
load("@aspect_bazel_lib//lib:docs.bzl", "stardoc_with_diff_test", "update_docs") | ||
|
||
stardoc_with_diff_test( | ||
name = "rules", | ||
bzl_library_target = "//distroless:defs", | ||
) | ||
|
||
update_docs(name = "update") |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
"""Provides a simple way to test your rules as an external workspace. | ||
Add a basic smoke-test target below. | ||
""" | ||
|
||
load("@bazel_skylib//rules:build_test.bzl", "build_test") | ||
# load("rules_distroless//distroless:defs.bzl", "...") | ||
|
||
# Replace with a usage of your rule/macro | ||
filegroup(name = "empty") | ||
|
||
build_test( | ||
name = "smoke_test", | ||
targets = [ | ||
# targets you add above | ||
":empty", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
bazel_dep(name = "rules_distroless", version = "0.0.0", dev_dependency = True) | ||
bazel_dep(name = "bazel_skylib", version = "1.3.0", dev_dependency = True) | ||
|
||
local_path_override( | ||
module_name = "rules_distroless", | ||
path = "../..", | ||
) |
Oops, something went wrong.