-
Notifications
You must be signed in to change notification settings - Fork 694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make the rules easily reusable in workflows. #148
Comments
@hsyed There is clearly a bug today where: # Works
bazel run path/to:docker_build
# Does not work
bazel build path/to:docker_build
bazel-bin/path/to/docker_build <-- This is essentially what you want to include into other rules. I bet fixing this would unblock you (if you "hold it" right, which is often harder than it looks with Bazel/Skylark), so I will poke at this a little to see if I can figure out how I'm "holding it wrong". :) For your first two scenarios, I think we have a tentative plan or a solution (I've updated the linked issues). The CI system bit is a little vague, but I'm happy to discuss (and/or pull folks in to help). FWIW, part of the reason we do the |
@hsyed Can you try some of your logic that wraps the rules with the linked PR? If you are still having issues, I'd be happy to TAL if you send me a pointer to some WIP rules? |
@mattmoor
docker_push rules do however do not work:
It reports this, I get the same when trying to run it via
|
I will take a look, it should be pretty easy to reproduce. Sorry for the trouble. |
I pushed #153 which should make build/run separable for push as well. |
Ok, #153 is in, so let me know if you are unblocked (or if I should keep whacking moles). |
@hsyed I just want to follow up to see if I can close this now? Are there any remaining issues for you? |
I'd Want to do some more work on what I had in mind, But I'm blocked on the incremental load into minikube front. I wanted to write a deploy step that could switch between loading into minikube vs a docker push depending on the "environment" being pushed to. One thing that occurs to me is that the pusher script will be primed to push to a specific registry:tag, I wonder if it's possible to get a pusher that takes this as an argument. Have you made any more progress on the minikube front ? I still have to set the docker machine env before calling into bazel. |
You can pass @dlorenc for the minikube stuff. |
@r2d4 may know too |
I've made a rule to run multiple executable bazel targets sequentially (see the PR). I tried it with several executable targets and it works. rules_docker/container/push-tag.sh.tpl Lines 19 to 21 in e5ebe3d
When I removed redirections that swallowed errors, turned out it cannot pushd /popd into the directories.
Turned out PR #153 introduced some assumptions about where files are actually stored on disk instead of just relying on
|
ping @mattmoor |
@mattmoor @erain @jayconrod I've also tried running Gazelle via this rule and it also does not work - is this not supported? bazel run //:run_all
INFO: Analysed target //:run_all (18 packages loaded).
INFO: Found 1 target...
Target //:run_all up-to-date:
bazel-bin/run_all.bash
INFO: Elapsed time: 0.849s, Critical Path: 0.53s
INFO: 1 process: 1 darwin-sandbox.
INFO: Build completed successfully, 5 total actions
INFO: Build completed successfully, 5 total actions
Running //:gazelle
Loading:
Loading: 0 packages loaded
ERROR: Skipping '//:gazelle': no such package '': BUILD file not found on package path
WARNING: Target pattern parsing failed.
ERROR: no such package '': BUILD file not found on package path
INFO: Elapsed time: 0.206s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
FAILED: Build did NOT complete successfully (0 packages loaded)
FAILED: Build did NOT complete successfully (0 packages loaded)
error: ./gazelle.bash: script is out of date. Refresh it with the command:
bazel build //:gazelle && cp -fv "" "./gazelle.bash" I think Gazelle also makes some assumptions about how it is invoked. Maybe the script can now be simplified using |
@ash2k I've opened bazel-contrib/bazel-gazelle#259 to track this. The wrapper script produced by the |
I think this issue has been fixed by #522. Thanks a lot @scele! May be closed now, I believe. At least things work for me atlassian/smith#380 |
We should be able to reuse the docker rules logic in other rules. Unless I am missing something we can't
bazel run
from within abazel run
. A lot of this work will be done for rules_k8s it would be great if the problem is addressed in a general way.Use cases:
What I tried:
Tried to prototype a higher level rule that would get a "handle" to a docker_build runnable and then do something before or after incrementally loading the image.
Somewhere in the rule
Problems
It's not straight forward to setup the runtime context of the target rules. I tried to repurpose the logic by studying the internals and this but even if I had managed to get it to work it would not be the way forward as it depends on the internals.
What I hope for
A simple way to reuse the logic in the rules defined here. What would be nicest is a simple handle to the target that I can execute at some arbitrary point in a rule / genrule. If this is not possible some utility functions with examples would be usefull. --e.g.,
The text was updated successfully, but these errors were encountered: