Skip to content

Commit

Permalink
BuildFarm bug: add example
Browse files Browse the repository at this point in the history
  • Loading branch information
laszlocsomor committed Jan 24, 2019
1 parent 8af1378 commit 3290d2d
Show file tree
Hide file tree
Showing 7 changed files with 180 additions and 0 deletions.
10 changes: 10 additions & 0 deletions bazel/gh-7030-buildfarm-includecheck-fails/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cc_binary(
name = "foo-bin",
srcs = ["foo.cc"],
deps = [":foo-lib"],
)

cc_library(
name = "foo-lib",
hdrs = ["foo.h"],
)
36 changes: 36 additions & 0 deletions bazel/gh-7030-buildfarm-includecheck-fails/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
1. Download Bazel 0.18.0 and 0.21.0
1. Check out https://github.com/bazelbuild/bazel-buildfarm/tree/ec7a05362d70b8074a29803d283f5ffeb2e33f28
1. Build BuildFarm server + worker with Bazel 0.18.0

```
bazel-0.18.0.exe build //src/main/java/build/buildfarm:buildfarm-worker //src/main/java/build/buildfarm:buildfarm-server
```

1. Start the worker and the server in two separate consoles:

```
<path>\<to>\buildfarm-server.exe <path>\<to>\server.config
```

```
<path>\<to>\buildfarm-worker.exe <path>\<to>\server.config
```

They don't print anything to stdout/stderr. This is fine.

1. Build the targets in this workspace:

```
bazel build --spawn_strategy=remote --remote_executor=localhost:8980 //:foo-bin
```

The build fails with:

```
ERROR: C:/src/my-projects/bazel/gh-7030-buildfarm-includecheck-fails/BUILD:1:1: undeclared inclusion(s) in rule '//:foo-bin':
this rule is missing dependency declarations for the following files included by 'foo.cc':
'D:/gh-7030/worker/default_memory_instance/operations/af056149-3fd3-4c74-9c8e-3f8880e89041/foo.h'
Target //:foo-bin failed to build
```

1. However, the build succeeds when built locally.
Empty file.
5 changes: 5 additions & 0 deletions bazel/gh-7030-buildfarm-includecheck-fails/foo.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include "foo.h"

int main() {
return foo_func();
}
1 change: 1 addition & 0 deletions bazel/gh-7030-buildfarm-includecheck-fails/foo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
int foo_func() { return 0; }
5 changes: 5 additions & 0 deletions bazel/gh-7030-buildfarm-includecheck-fails/server.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -------------------------------------------------------------------------------------------------
# Based on BuildFarm's examples: https://github.com/bazelbuild/bazel-buildfarm/tree/master/examples
# My only modification was the "root:" entry.
# -------------------------------------------------------------------------------------------------

123 changes: 123 additions & 0 deletions bazel/gh-7030-buildfarm-includecheck-fails/worker.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# -------------------------------------------------------------------------------------------------
# Based on BuildFarm's examples: https://github.com/bazelbuild/bazel-buildfarm/tree/master/examples
# My only modification was the "root:" entry.
# -------------------------------------------------------------------------------------------------

# the digest function for this worker, required
# to match out of band between the client and server
# since resource names must be determined on the client
# for a valid upload
digest_function: SHA256

# the endpoint used to execute operations
operation_queue: {
target: "localhost:8980"

# the instance domain that this worker will execute work in
# all requests will be tagged with this instance name
instance_name: "default_memory_instance"
}

# the endpoint used for cas interactions
content_addressable_storage: {
target: "localhost:8980"

# the instance domain that this worker will make resource requests in
# all requests will be tagged with this instance name
instance_name: "default_memory_instance"
}

# the endpoint used for action cache interactions
action_cache: {
target: "localhost:8980"

# the instance domain that this worker will make resource requests in
# all requests will be tagged with this instance name
instance_name: "default_memory_instance"
}

# all content for the operations will be stored under this path
root: "d:/gh-7030/worker"

# the local cache location relative to the 'root', or absolute
cas_cache_directory: "cache"

# total size in bytes of inline content for action results
# output files, stdout, and stderr content, in that order
# will be inlined if their cumulative size does not exceed this limit.
inline_content_limit: 1048567 # 1024 * 1024

# whether the stdout of running processes should be streamed
stream_stdout: true

# whether to insert stdout into the CAS, can be:
# ALWAYS_INSERT: stdout is always inserted into the CAS
# INSERT_ABOVE_LIMIT: stdout is inserted into the CAS when it exceeds the inline limit above
stdout_cas_policy: ALWAYS_INSERT

# whether the stderr of running processes should be streamed
stream_stderr: true

# whether to insert stderr into the CAS, can be:
# ALWAYS_INSERT: stderr is always inserted into the CAS
# INSERT_ABOVE_LIMIT: stderr is inserted into the CAS when it exceeds the inline limit above
stderr_cas_policy: ALWAYS_INSERT

# whether to insert output files into the CAS, can be:
# ALWAYS_INSERT: output files are always inserted into the CAS
# INSERT_ABOVE_LIMIT: output files are inserted into the CAS when it exceeds the inline limit above
file_cas_policy: ALWAYS_INSERT

# ContentAddressableStorage#getTree per-page directory count
# value of '0' means let the server decide
tree_page_size: 0

# the period between poll operations at any stage
operation_poll_period: {
seconds: 1
nanos: 0
}

# key/value set of definining capabilities of this worker
# all execute requests must match perfectly with workers which
# provide capabilities
# so an action with a required platform: { arch: "x86_64" } must
# match with a worker with at least { arch: "x86_64" } here
platform: {
# commented out here for illustrative purposes, a default empty
# 'platform' is a sufficient starting point without specifying
# any platform requirements on the actions' side
###
# property: {
# name: "key_name"
# value: "value_string"
# }
}

# limit for contents of files retained
# from CAS in the cache
cas_cache_max_size_bytes: 2147483648 # 2 * 1024 * 1024 * 1024

# the number of concurrently available slots in the execute phase
execute_stage_width: 1

# an imposed action-key-invariant timeout used in the unspecified timeout case
default_action_timeout: {
seconds: 600
nanos: 0
}

# a limit on the action timeout specified in the action, above which
# the operation will report a failed result immediately
maximum_action_timeout: {
seconds: 3600
nanos: 0
}

# prefix command executions with this path
#execution_policies: {
# name: "test"
# wrapper: {
# path: "/path/to/execution/wrapper"
# }
#}

0 comments on commit 3290d2d

Please sign in to comment.