-
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.
Merge pull request #1999 from priyawadhwa/custom
Add custom artifact for custom local builds
- Loading branch information
Showing
23 changed files
with
693 additions
and
25 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
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 @@ | ||
#!/bin/bash | ||
|
||
bazel build //:skaffold_example.tar | ||
TAR_PATH=$(bazel info bazel-bin) | ||
docker load -i $TAR_PATH/skaffold_example.tar | ||
|
||
|
||
images=$(echo $IMAGES | tr " " "\n") | ||
|
||
for image in $images | ||
do | ||
docker tag bazel:skaffold_example $image | ||
|
||
if $PUSH_IMAGE | ||
then | ||
docker push $image | ||
fi | ||
|
||
done | ||
|
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 @@ | ||
build: | ||
artifacts: | ||
- image: gcr.io/k8s-skaffold/example | ||
custom: | ||
buildCommand: ./build.sh | ||
dependencies: | ||
paths: | ||
- . | ||
ignore: | ||
- README* |
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
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 @@ | ||
load("@io_bazel_rules_docker//go:image.bzl", "go_image") | ||
|
||
go_image( | ||
name = "skaffold_example", | ||
srcs = ["main.go"], | ||
goos = "linux", | ||
goarch = "amd64", | ||
static = "on", | ||
) |
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 @@ | ||
workspace(name = "skaffold") | ||
|
||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
http_archive( | ||
name = "io_bazel_rules_docker", | ||
strip_prefix = "rules_docker-0.7.0", | ||
urls = ["https://github.com/bazelbuild/rules_docker/archive/v0.7.0.tar.gz"], | ||
sha256 = "aed1c249d4ec8f703edddf35cbe9dfaca0b5f5ea6e4cd9e83e99f3b0d1136c3d", | ||
) | ||
|
||
http_archive( | ||
name = "io_bazel_rules_go", | ||
urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.16.5/rules_go-0.16.5.tar.gz"], | ||
sha256 = "7be7dc01f1e0afdba6c8eb2b43d2fa01c743be1b9273ab1eaf6c233df078d705", | ||
) | ||
|
||
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains") | ||
|
||
go_rules_dependencies() | ||
go_register_toolchains( | ||
go_version = "1.10.1", | ||
) | ||
|
||
load( | ||
"@io_bazel_rules_docker//go:image.bzl", | ||
_go_image_repos = "repositories", | ||
) | ||
|
||
_go_image_repos() |
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 @@ | ||
#!/bin/bash | ||
|
||
bazel build //:skaffold_example.tar | ||
TAR_PATH=$(bazel info bazel-bin) | ||
docker load -i $TAR_PATH/skaffold_example.tar | ||
|
||
|
||
images=$(echo $IMAGES | tr " " "\n") | ||
|
||
for image in $images | ||
do | ||
docker tag bazel:skaffold_example $image | ||
|
||
if $PUSH_IMAGE | ||
then | ||
docker push $image | ||
fi | ||
|
||
done | ||
|
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 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: bazel | ||
spec: | ||
containers: | ||
- name: bazel | ||
image: gcr.io/k8s-skaffold/skaffold-bazel |
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 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"time" | ||
) | ||
|
||
func main() { | ||
for { | ||
fmt.Println("Hello bazel!") | ||
time.Sleep(time.Second * 1) | ||
} | ||
} |
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 @@ | ||
apiVersion: skaffold/v1beta10 | ||
kind: Config | ||
build: | ||
artifacts: | ||
- image: gcr.io/k8s-skaffold/skaffold-bazel | ||
custom: | ||
buildCommand: ./build.sh | ||
dependencies: | ||
paths: | ||
- . | ||
ignore: | ||
- bazel* | ||
- README* |
Oops, something went wrong.