Skip to content
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

Provide latest git commit SHA as an environmental variable #14

Closed
qnm opened this issue Jun 20, 2019 · 7 comments
Closed

Provide latest git commit SHA as an environmental variable #14

qnm opened this issue Jun 20, 2019 · 7 comments

Comments

@qnm
Copy link

qnm commented Jun 20, 2019

Is your feature request related to a problem? Please describe.
Configuration of Rollbar requires a version string (e.g. latest git commit SHA) to correctly identify source maps.

Describe the solution you'd like
I'd like a method to access the latest git commit SHA and include it in our codebase.

Describe alternatives you've considered
Can't think of another way to achieve this bar manual version bumps.

@evanderkoogh
Copy link

Hey @qnm. Thanks for this.

One of the things we wanted to do with Linc and FABs is to get a directly traceable output from version control and to rebuild/redeploy as little as possible.

One of those things is that we don't rebuild for every commit if we can detect that the tree_id of the repository is the same.

And we can pass in the tree_id in an environment variable with little hassle, but that would mean that the hash of the FAB would change on any change in the repository, even if that change never makes it into the bundle (for say a change in the README, or a test).

If you need a unique value whenever your JS changes, I would propose something like a hook in @fab/compile where you can write a script that could hash your JS file directory and make a change to a file somewhere else.

What do you think @geelen?

@evanderkoogh
Copy link

evanderkoogh commented Jun 21, 2019

@qnm I have added an environment variable calledGIT_TREE_ID to the linc:setup and build:fab steps.

So you can use that for now if you want. It will just mean it will push out a change to product on every change to your repo, not just on every change to production code.

Glen and I will have a proper chat next week on how to properly solve your problem.

@qnm
Copy link
Author

qnm commented Jun 24, 2019

Thanks @evanderkoogh. I've added a env command to the script that runs as part of build:fab and I'm not seeing the GIT_TREE_ID value there.

Happy to provide input to any solution you come up with. The versioning value used by Rollbar does not have to correlate with git; git just happens to provide a useful proxy value for version!

@evanderkoogh
Copy link

Hmm.. that is interesting? Let me have a check. I may have only released it to our own builds, not released it publicly. Will double-check tonight.

And yeah I got Rollbar doesn't need to correspond with Git. The ideal solution AFAICT is a hook in fab-compile/fab-static that allows you to tweak something small like this. In this instance a checksum of the client-side javascript would be the best right?

@evanderkoogh
Copy link

Well @qnm, I am not saying I only released it internally, but I am also not saying I didn't only release it internally ;)

Can you try the GIT_TREE_ID thing again?

@evanderkoogh
Copy link

Closing this issue after creating one in the fab repository because we can solve it better over there.

@qnm
Copy link
Author

qnm commented Jun 25, 2019

Well @qnm, I am not saying I only released it internally, but I am also not saying I didn't only release it internally ;)

Can you try the GIT_TREE_ID thing again?

Looks like it's working now. Thanks Erwin!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants