google / upvote_py2

A multi-platform binary whitelisting solution
Apache License 2.0
452 stars 35 forks source link

init script deploy error #62

Open rjnordeen opened 4 years ago

rjnordeen commented 4 years ago

Getting this error when installing

environment:

I tried:

error on the last command bazel run upvote/gae:monolith_binary.deploy -- "${PROJ_ID}" app.yaml


+ gcloud config set project redacted
Updated property [core/project].
+ echo Deploying to App Engine...
Deploying to App Engine...
+ bazel run upvote/gae:monolith_binary.deploy -- redacted-app.yaml
Starting local Bazel server and connecting to it...
INFO: Writing tracer profile to '/private/var/tmp/_bazel_/7efb8f1f32f0c308f1333fb4570cfc62/command.profile.gz'
ERROR: /private/var/tmp/_bazel_/7efb8f1f32f0c308f1333fb4570cfc62/external/com_google_protobuf/protobuf.bzl:130:19: Traceback (most recent call last):
    File "/private/var/tmp/_bazel_/7efb8f1f32f0c308f1333fb4570cfc62/external/com_google_protobuf/protobuf.bzl", line 125
        rule(<3 more arguments>)
    File "/private/var/tmp/_bazel_/7efb8f1f32f0c308f1333fb4570cfc62/external/com_google_protobuf/protobuf.bzl", line 130, in rule
        attr.label(cfg = "host", <3 more arguments>)
'single_file' is no longer supported. use allow_single_file instead. You can use --incompatible_disable_deprecated_attr_params=false to temporarily disable this check.
INFO: Call stack for the definition of repository 'remote_java_tools_darwin' which is a http_archive (rule definition at /private/var/tmp/_bazel_/7efb8f1f32f0c308f1333fb4570cfc62/external/bazel_tools/tools/build_defs/repo/http.bzl:292:16):
 - /private/var/tmp/_bazel_/7efb8f1f32f0c308f1333fb4570cfc62/external/bazel_tools/tools/build_defs/repo/utils.bzl:205:9
 - /DEFAULT.WORKSPACE.SUFFIX:280:1
ERROR: /private/var/tmp/_bazel_/7efb8f1f32f0c308f1333fb4570cfc62/external/com_google_javascript_closure_compiler/BUILD:7:1: error loading package '@com_google_protobuf//': Extension file 'protobuf.bzl' has errors and referenced by '@com_google_javascript_closure_compiler//:com_google_javascript_closure_compiler'
ERROR: Analysis of target '//upvote/gae:monolith_binary.deploy' failed; build aborted: error loading package '@com_google_protobuf//': Extension file 'protobuf.bzl' has errors
INFO: Elapsed time: 11.606s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (95 packages loaded, 1507 targets configured)
FAILED: Build did NOT complete successfully (95 packages loaded, 1507 targets configured)
    Fetching @local_config_xcode; fetching 7s
    Fetching @com_google_javascript_closure_library; Restarting.```
rjnordeen commented 4 years ago

I also tried: bazel run upvote/gae:monolith_binary.deploy --incompatible_disable_deprecated_attr_params=false and got this:


 - /Users//git/upvote/WORKSPACE:215:1
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN npm No description
npm WARN npm No repository field.
npm WARN npm No license field.
added 4 packages from 2 contributors and audited 4 packages in 1.603s

found 0 vulnerabilities

yarn install v1.12.1
warning package.json: No license field
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 0.26s.
ERROR: /private/var/tmp/_bazel_/7efb8f1f32f0c308f1333fb4570cfc62/external/io_bazel_rules_closure/closure/library/string/BUILD:93:1: in closure_js_library rule @io_bazel_rules_closure//closure/library/string:typedstring:
Traceback (most recent call last):
    File "/private/var/tmp/_bazel_/7efb8f1f32f0c308f1333fb4570cfc62/external/io_bazel_rules_closure/closure/library/string/BUILD", line 93
        closure_js_library(name = 'typedstring')
    File "/private/var/tmp/_bazel_/7efb8f1f32f0c308f1333fb4570cfc62/external/io_bazel_rules_closure/closure/compiler/closure_js_library.bzl", line 386, in _closure_js_library
        _closure_js_library_impl(<20 more arguments>)
    File "/private/var/tmp/_bazel_/7efb8f1f32f0c308f1333fb4570cfc62/external/io_bazel_rules_closure/closure/compiler/closure_js_library.bzl", line 233, in _closure_js_library_impl
        sort_roots(<1 more arguments>)
    File "/private/var/tmp/_bazel_/7efb8f1f32f0c308f1333fb4570cfc62/external/io_bazel_rules_closure/closure/private/defs.bzl", line 198, in sort_roots
        sorted(<1 more arguments>)
    File "/private/var/tmp/_bazel_/7efb8f1f32f0c308f1333fb4570cfc62/external/io_bazel_rules_closure/closure/private/defs.bzl", line 198, in sorted
        [(-(len(r.split("/"))), r) for r in roots]
type 'depset' is not iterable. Use the `to_list()` method to get a list. Use --incompatible_depset_is_not_iterable=false to temporarily disable this check.
ERROR: Analysis of target '//upvote/gae:monolith_binary.deploy' failed; build aborted: Analysis of target '@io_bazel_rules_closure//closure/library/string:typedstring' failed; build aborted
INFO: Elapsed time: 68.554s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (121 packages loaded, 25535 targets configured)
FAILED: Build did NOT complete successfully (121 packages loaded, 25535 targets configured)
    Fetching @npm; Restarting. 10s
    Fetching @build_bazel_rules_nodejs_npm_install_deps; fetching```
ericzinnikas commented 4 years ago

Seeing the same issue with:

OSX 10.15.4

$ java -version
openjdk version "12.0.2" 2019-07-16
OpenJDK Runtime Environment AdoptOpenJDK (build 12.0.2+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 12.0.2+10, mixed mode)
$ bazel version
Build label: 2.2.0
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Mar 3 09:28:15 2020 (1583227695)
Build timestamp: 1583227695
Build timestamp as int: 1583227695

Error:

ERROR: /private/var/tmp/_bazel_ezinnikas/273f5db6f619d70b723d8f469b298c26/external/io_bazel_rules_closure/closure/library/string/BUILD:93:1: in closure_js_library rule @io_bazel_rules_closure//closure/library/string:typedstring:
Traceback (most recent call last):
    File "/private/var/tmp/_bazel_ezinnikas/273f5db6f619d70b723d8f469b298c26/external/io_bazel_rules_closure/closure/library/string/BUILD", line 93
        closure_js_library(name = 'typedstring')
    File "/private/var/tmp/_bazel_ezinnikas/273f5db6f619d70b723d8f469b298c26/external/io_bazel_rules_closure/closure/compiler/closure_js_library.bzl", line 386, in _closure_js_library
        _closure_js_library_impl(<20 more arguments>)
    File "/private/var/tmp/_bazel_ezinnikas/273f5db6f619d70b723d8f469b298c26/external/io_bazel_rules_closure/closure/compiler/closure_js_library.bzl", line 233, in _closure_js_library_impl
        sort_roots(<1 more arguments>)
    File "/private/var/tmp/_bazel_ezinnikas/273f5db6f619d70b723d8f469b298c26/external/io_bazel_rules_closure/closure/private/defs.bzl", line 198, in sort_roots
        sorted(<1 more arguments>)
    File "/private/var/tmp/_bazel_ezinnikas/273f5db6f619d70b723d8f469b298c26/external/io_bazel_rules_closure/closure/private/defs.bzl", line 198, in sorted
        [(-(len(r.split("/"))), r) for r in roots]
type 'depset' is not iterable
ERROR: Analysis of target '//upvote/gae:monolith_binary.deploy' failed; build aborted: Analysis of target '@io_bazel_rules_closure//closure/library/string:typedstring' failed; build aborted
aaronstasis commented 3 years ago

For people coming here in the future, I spent quite a bit of time trying to get this to work... I ended up getting it to work by installing bazel using the installer from github via https://docs.bazel.build/versions/master/install-os-x.html. I went with 0.27.1 since it was the oldest one/about the same date as the last release of upvote.

then I still had to use the following command-line flags to get it to build:

bazel run upvote/gae:monolith_binary.deploy --host_force_python=PY2 --incompatible_depset_union=false --incompatible_depset_is_not_iterable=false --incompatible_disable_deprecated_attr_params=false  -- "${PROJ_ID}" app.yaml

After that whole thing, it built, but the deployment step failed for some reason and i ended up having to do my gcloud deploy manually from:

bazel-bin/upvote/gae/monolith_binary.deploy.runfiles/__main_

Since this is a security focused app, I'm nervous deploying it having to use outdated tools / code that hasn't been updated since 2019. If google is actually still maintaining this internally, would love to see an update! Otherwise, thinking about investigating what it would take to make a PR updating the Bazel tooling.

Also I should mention that this tool is awesome, so I'd love to encourage an update/contribute.