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 commit id available as an environment variable #1336

Closed
MatthewSteeples opened this Issue Sep 17, 2014 · 7 comments

Comments

Projects
None yet
3 participants
@MatthewSteeples
Copy link

MatthewSteeples commented Sep 17, 2014

Would it be possible to include the commit id that the server built as an environment variable or app config?

Currently it's possible to find out the deployment system but not any further details of it. We'd like to be able to display on a page which version the site is running on. I understand it wouldn't be relevant for all source systems / scenarios, but I think it's useful for those that it is relevant for.

@davidebbo

This comment has been minimized.

Copy link
Member

davidebbo commented Sep 17, 2014

Relates to #1212.

This is already available as SCM_COMMIT_ID (see here). Can you give that a try?

@davidebbo davidebbo closed this Sep 17, 2014

@MatthewSteeples

This comment has been minimized.

Copy link

MatthewSteeples commented Sep 17, 2014

I saw that issue and one other relating to this, but it doesn't appear on /Env in the Kudu portal so I assumed that it hadn't been put in for after the deploy. I'll try reading that variable name in a test deploy.

@davidebbo

This comment has been minimized.

Copy link
Member

davidebbo commented Sep 17, 2014

/Env/ only shows the global environment. But this one is very specific to one deployment, and it only available to the deployment script (and its child processes).

@MatthewSteeples

This comment has been minimized.

Copy link

MatthewSteeples commented Sep 17, 2014

Ah that makes sense then. I'm trying to get it at runtime of the site to display on a page. Is a reason this isn't enabled? Am I going to be better off putting it in the msbuild task to embed it somewhere?

@davidebbo

This comment has been minimized.

Copy link
Member

davidebbo commented Sep 17, 2014

Two approaches:

  1. During deployment, read this env and write the commit id to some file under your app's code (e.g. App_Data) that your runtime can read
  2. Directly go after %home%\site\deployments\active which has the commit id

I suspect 2. is easier, though technically. it makes assumptions about the Kudu file structures that theoretically could change (but probably won't).

@MatthewSteeples

This comment has been minimized.

Copy link

MatthewSteeples commented Sep 17, 2014

We already have a task in MSBuild that does 1. but reads it using Git (from the MSBuild Community Tasks) so I'll modify this to read the environment variable instead. Thanks for your help.

@kamranayub

This comment has been minimized.

Copy link

kamranayub commented Nov 2, 2014

FWIW it would be convenient to have this as a simple app setting or env variable. AppHarbor did this (appharbor.commit_id) and it was easy to display it at runtime... I'm not a huge fan of hiding it in deployment scripts. Just my two cents 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment