-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: bazel oci rule support (#9048)
* feat: bazel oci rule support * fix: bazel test by creating starstand fake tar * chore: remove todo * chore: fix linting issues
- Loading branch information
1 parent
fc367c1
commit 1255d6c
Showing
9 changed files
with
133 additions
and
40 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
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 @@ | ||
load("@rules_oci//oci:defs.bzl", "oci_tarball") | ||
|
||
oci_tarball( | ||
name = "hello.tar", | ||
image = "@hello//:hello", | ||
repo_tags = ["hello: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,30 @@ | ||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
http_archive( | ||
name = "rules_oci", | ||
sha256 = "db57efd706f01eb3ce771468366baa1614b5b25f4cce99757e2b8d942155b8ec", | ||
strip_prefix = "rules_oci-1.0.0", | ||
url = "https://github.com/bazel-contrib/rules_oci/releases/download/v1.0.0/rules_oci-v1.0.0.tar.gz", | ||
) | ||
|
||
load("@rules_oci//oci:dependencies.bzl", "rules_oci_dependencies") | ||
|
||
rules_oci_dependencies() | ||
|
||
load("@rules_oci//oci:repositories.bzl", "LATEST_CRANE_VERSION", "LATEST_ZOT_VERSION", "oci_register_toolchains") | ||
|
||
oci_register_toolchains( | ||
name = "oci", | ||
crane_version = LATEST_CRANE_VERSION, | ||
# Uncommenting the zot toolchain will cause it to be used instead of crane for some tasks. | ||
# Note that it does not support docker-format images. | ||
# zot_version = LATEST_ZOT_VERSION, | ||
) | ||
|
||
load("@rules_oci//oci:pull.bzl", "oci_pull") | ||
|
||
oci_pull( | ||
name = "hello", | ||
digest = "sha256:845f77fab71033404f4cfceaa1ddb27b70c3551ceb22a5e7f4498cdda6c9daea", | ||
image = "us-docker.pkg.dev/google-samples/containers/gke/hello-app", | ||
) |
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,25 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: helloweb | ||
labels: | ||
app: hello | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: hello | ||
tier: web | ||
template: | ||
metadata: | ||
labels: | ||
app: hello | ||
tier: web | ||
spec: | ||
containers: | ||
- name: hello-app | ||
image: hello-image | ||
ports: | ||
- containerPort: 8080 | ||
resources: | ||
requests: | ||
cpu: 200m |
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,23 @@ | ||
apiVersion: skaffold/v4beta5 | ||
kind: Config | ||
metadata: | ||
name: hello | ||
build: | ||
tagPolicy: | ||
sha256: {} | ||
artifacts: | ||
- image: hello-image | ||
bazel: | ||
target: //:hello.tar | ||
deploy: | ||
kubectl: {} | ||
manifests: | ||
rawYaml: | ||
- "deploy.yaml" | ||
profiles: | ||
- name: target-with-package | ||
build: | ||
artifacts: | ||
- image: hello-image | ||
bazel: | ||
target: //sub-dir:hello.tar |
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 @@ | ||
load("@rules_oci//oci:defs.bzl", "oci_tarball") | ||
|
||
oci_tarball( | ||
name = "hello.tar", | ||
image = "@hello//:hello", | ||
repo_tags = ["hello-whatever: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
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
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