cypress-io/commit-info

Add fallback environment variables

bahmutov opened this issue · 11 comments

For really weird environments (like Docker containers WITHOUT git), we can have fallback environment variables we can check if git calls fail. For example we could polyfill failed keys with these environment variables

branch: COMMIT_INFO_BRANCH
message: COMMIT_INFO_MESSAGE
email: COMMIT_INFO_EMAIL
author: COMMIT_INFO_AUTHOR
sha: COMMIT_INFO_SHA
remote: COMMIT_INFO_REMOTE

then anyone who is spawning a container can set these environment variables themselves and get useful info

It took me time to know that Cypress is expecting .git folder to be there to get all git related info, because when I tried it for the first time (without docker-compose), I was able to see commit author and message in the dashboard, but once I integrated it with docker-compose I wasn't able.

I would suggest to add this information clearly as part of the documentation, and I'd be happy to be able to pass them as environment variables (for security reasons)

and I wouldn't say weird environment though :D

hehe, yeah, weird is a strong word, but this is a good feature I think.

@mshaaban088 This is a great idea to add to the documentation.

I created a new issue in our docs to document collecting git info here: cypress-io/cypress-documentation#1176. Our documentation is open source and contributions are welcome. 😄

@bahmutov ;)
@jennifer-shehane sure thing. Added to my todo list

Version 2.1.0 has been published to NPM. The full release note can be found at commit-info/releases/tag/v2.1.0.

Tip: safely upgrade dependency @cypress/commit-info in your project using next-update

@bahmutov @cypress/commit-info is not a direct dependency of cypress, and next-update says nothing new is available. That means I cannot use this feature unless @packages/server upgraded @cypress/commit-info to the new version. Did I get it right?

@bahmutov thanks for the fast response.
Do you have ETA, or?

Got it.
Thanks again