-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Support incorporation of git hash and status into build #216
Comments
I'm happy to provide a workspace status command to emit useful Git data, but until we emit buildstamp artifacts, it's moot. |
I don't know what buildstamp artifact is about, but as far as I can tell based on my test, the code is in place to translate stable-status.txt and volatile-status.txt to language specific files(header for C, properties for Java), so what's missing now is just the right option to allow users to provide a wrapper script to generate scm status and then let BazelWorkspaceStatusAction write it to the status file. |
right. What is needed is adding a @OverRide to BazelWorkspaceStatusAction. The function should create a command line ("new BaseSpawn.Local" to run in SpawnActionContext), perhaps to a script under tools/buildstamp/ . The workspace directory can be get gotten from
inside BazelWorkspaceModule, and passed to the WorkspaceStatusAction. The data that is written directly now, should be passed as data to the shell script. The script should probably run "git status" and "git describe" to describe the state of the tree. |
Thanks for the pointers. Any suggestion regarding how to expose these information to skylark? They can probably access bazel-out/{stable,volatile}-status.txt directly. But I'm not sure whether that's the preferred approach. |
script(controled by workspace_status_command option, default to tools/buildstamp/get_workspace_status) to emit addtional workspace information to stable-status.txt. This should address #216. -- Change-Id: Iffb06482489f0d55393e27b0764e6e127fedbc20 Reviewed-on: https://bazel-review.git.corp.google.com/#/c/1550 MOS_MIGRATED_REVID=97678871
The commit message says workspace_status_command defaults to tools/buildstamp/get_workspace_status. However,
What am I missing? |
The documentation is incorrect - we currently use code to set the default You can check with: That should print the workspace status command that is actually run. On Sat, Feb 20, 2016 at 5:39 AM, guoshimin [email protected] wrote:
|
The supposed default doesn't seem to work. I have this genrule target:
Basically it prints the content of When I don't specify
When I specify --workspace_status_command manually, it works as expected:
This is my bazel version:
Am I doing something wrong? |
It looks like a bug to me. I'm also surprised it doesn't print the status On Mon, Feb 22, 2016 at 7:53 PM, guoshimin [email protected] wrote:
|
I went ahead and filed an issue: #964 |
I think we just hit a case in Envoy where we want this (@mattklein123). We have a Bazel project A that consumes another Bazel project B as a |
@ulfjack can we get this reopened? We're not seeing any reasonable way (short of resorting to a |
Isn't there a build stamping mechanism? I remember there was a blog post
about it. Might be old news to you.
…On Wed, 26 Apr 2017 at 16:57 htuch ***@***.***> wrote:
@ulfjack <https://github.com/ulfjack> can we get this reopened? We're not
seeing any reasonable way (short of resorting to a repository_rule and
sticking the git SHA in an environment variable pre-build) to embed the git
SHA1 in C++ source with Bazel 0.4.5? See envoyproxy/envoy#841
<envoyproxy/envoy#841>.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#216 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABUIF-N3jbzINMb63T_8NZ6ulYRPsRFrks5rz01JgaJpZM4Et9A6>
.
|
As I look into this, it seems we have the mechanisms, but no documentation on how to use it in the Build Encylopedia. Can we get some official docs on this? It's a huge time sink to have to reinvent things that are not properly documented. E.g. there is https://groups.google.com/forum/#!topic/bazel-discuss/hqyMFjEpJgM. |
@michelleirvine, who's on a mission to improve the docs. Michelle, I wrote a thing about stamping here, but the docs are a bit light on it. |
Thanks @kchodorow. There's also https://groups.google.com/forum/m/#!topic/bazel-discuss/9kqLmOq_m_U which describes how to tie this into the C++ as a source artifact. |
For the record, the steps described by Brian Silverman in https://groups.google.com/forum/m/#!topic/bazel-discuss/9kqLmOq_m_U seem to work, but there's nothing in the public docs that would lead a developer to believe that. For example I've created #2893 to track, we can continue the discussion there. |
Here is my solution, at least for python: https://gist.github.com/jayeye/14c91816d10d5b899e1baaaaa9ba4848 |
@jayeye, but that doesn't update the commit stamp when the
|
It would be helpful to support incorporation of the git hash and some parsed from (perhaps client-specified) of the git status into the build.
See https://groups.google.com/forum/#!topic/bazel-discuss/_VVkuYz0BnU for discussion.
The text was updated successfully, but these errors were encountered: