Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
buildgrid
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
6
Snippets
Groups
Projects
Show more breadcrumbs
BuildGrid
buildgrid
Commits
9dd954df
Commit
9dd954df
authored
6 years ago
by
finnball
Browse files
Options
Downloads
Patches
Plain Diff
If BuildBox fails, raise error.
Will also return stdout to client.
parent
afdcb559
No related branches found
No related tags found
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
buildgrid/_app/bots/buildbox.py
+20
-6
20 additions, 6 deletions
buildgrid/_app/bots/buildbox.py
with
20 additions
and
6 deletions
buildgrid/_app/bots/buildbox.py
+
20
−
6
View file @
9dd954df
...
...
@@ -19,7 +19,9 @@ import tempfile
from
google.protobuf
import
any_pb2
from
buildgrid.settings
import
HASH_LENGTH
from
buildgrid.client.cas
import
upload
from
buildgrid._exceptions
import
BotError
from
buildgrid._protos.build.bazel.remote.execution.v2
import
remote_execution_pb2
from
buildgrid._protos.google.bytestream
import
bytestream_pb2_grpc
from
buildgrid.utils
import
read_file
,
write_file
,
parse_to_pb2_from_fetch
...
...
@@ -87,17 +89,30 @@ def work_buildbox(context, lease):
command_line
=
subprocess
.
Popen
(
command_line
,
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
)
# TODO: Should return the stdout and stderr to the user.
command_line
.
communicate
()
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
stdout
,
stderr
=
command_line
.
communicate
()
action_result
=
remote_execution_pb2
.
ActionResult
()
# TODO: Upload to CAS or output RAW
# For now, just pass raw
# https://gitlab.com/BuildGrid/buildgrid/issues/90
action_result
.
stdout_raw
=
stdout
if
stderr
:
# TODO: Upload to CAS or output RAW
# For now, just pass raw
# https://gitlab.com/BuildGrid/buildgrid/issues/90
logger
.
error
(
"
BuildBox error: [{}]
"
.
format
(
stderr
))
raise
BotError
(
stderr
,
detail
=
stdout
,
reason
=
"
Captured stderr
"
)
output_digest
=
remote_execution_pb2
.
Digest
()
output_digest
.
ParseFromString
(
read_file
(
output_digest_file
.
name
))
logger
.
debug
(
"
Output root digest: {}
"
.
format
(
output_digest
))
if
len
(
output_digest
.
hash
)
<
64
:
logger
.
warning
(
"
Buildbox command failed - no output root digest present.
"
)
if
len
(
output_digest
.
hash
)
<
HASH_LENGTH
:
raise
BotError
(
"
Output hash length too small
"
,
detail
=
stdout
,
reason
=
"
No output root digest present.
"
)
# TODO: Have BuildBox helping us creating the Tree instance here
# See https://gitlab.com/BuildStream/buildbox/issues/7 for details
...
...
@@ -110,7 +125,6 @@ def work_buildbox(context, lease):
output_directory
.
tree_digest
.
CopyFrom
(
output_tree_digest
)
output_directory
.
path
=
os
.
path
.
relpath
(
working_directory
,
start
=
'
/
'
)
action_result
=
remote_execution_pb2
.
ActionResult
()
action_result
.
output_directories
.
extend
([
output_directory
])
action_result_any
=
any_pb2
.
Any
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment