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

Commit info #1897

Closed
ricardopolo opened this Issue Feb 17, 2016 · 7 comments

Comments

Projects
None yet
3 participants
@ricardopolo

ricardopolo commented Feb 17, 2016

We would like to allow our developers to see which version of the Website are running. We used to do that creating a build.txt filde that contains that info.

If we use Appveyor we create the file and use enviroments variable with that information.

Code like thise do the trick:

$fileName = "build.txt"
"BUILD VERSION: $env:APPVEYOR_BUILD_VERSION" >> $fileName
"COMMIT SHA: $env:APPVEYOR_REPO_COMMIT" >> $fileName
"COMMIT TIMESTAMP: $env:APPVEYOR_REPO_COMMIT_TIMESTAMP" >> $fileName
"COMMIT MESSAGE: $env:APPVEYOR_REPO_COMMIT_MESSAGE" >> $fileName
"COMMIT AUTHOR: $env:APPVEYOR_REPO_COMMIT_AUTHOR" >> $fileName
"COMMIT AUTHOR EMAIL: $env:APPVEYOR_REPO_COMMIT_AUTHOR_EMAIL" >> $fileName

So do you have that kind of environment variables or are there any other recommended way to allow our devs view which version of the site is running when using kudu for deployment?

Thanks

@suwatch

This comment has been minimized.

Show comment
Hide comment
@suwatch

suwatch Feb 17, 2016

Member

After the deployment is completed, we stored the last successful deployment commit id in active file. You can access it thru <scm>/vfs/site/deployments/active. Details of that commit is stored in <scm>/vfs/site/deployments/<commit>/status.xml. Does this help?

Member

suwatch commented Feb 17, 2016

After the deployment is completed, we stored the last successful deployment commit id in active file. You can access it thru <scm>/vfs/site/deployments/active. Details of that commit is stored in <scm>/vfs/site/deployments/<commit>/status.xml. Does this help?

@davidebbo

This comment has been minimized.

Show comment
Hide comment
@davidebbo

davidebbo Feb 17, 2016

Member

The commit ID is directly available in the environment variable SCM_COMMIT_ID.

Member

davidebbo commented Feb 17, 2016

The commit ID is directly available in the environment variable SCM_COMMIT_ID.

@ricardopolo

This comment has been minimized.

Show comment
Hide comment
@ricardopolo

ricardopolo Feb 18, 2016

Looks like in variable enviroments there are little information, like there is not info about the author etc.

So the info in the XML looks very good. What kinds of permissions will need the developers to access to that file? I would like to my devs look the current deployed file but dont allow then manage our website (or change the deployment slots, etc)

Thanks!

ricardopolo commented Feb 18, 2016

Looks like in variable enviroments there are little information, like there is not info about the author etc.

So the info in the XML looks very good. What kinds of permissions will need the developers to access to that file? I would like to my devs look the current deployed file but dont allow then manage our website (or change the deployment slots, etc)

Thanks!

@ricardopolo

This comment has been minimized.

Show comment
Hide comment
@ricardopolo

ricardopolo Feb 18, 2016

@suwatch do you know if the status.xml exists during the execution of the deployment script, so I can copy it to the root of my website?

ricardopolo commented Feb 18, 2016

@suwatch do you know if the status.xml exists during the execution of the deployment script, so I can copy it to the root of my website?

@ricardopolo

This comment has been minimized.

Show comment
Hide comment
@ricardopolo

ricardopolo Feb 18, 2016

@suwatch do you know if the status.xml exists during the execution of the deployment script, so I can copy it to the root of my website?

ricardopolo commented Feb 18, 2016

@suwatch do you know if the status.xml exists during the execution of the deployment script, so I can copy it to the root of my website?

@suwatch

This comment has been minimized.

Show comment
Hide comment
@suwatch

suwatch Feb 18, 2016

Member

yes. since you will do within deployment script, you have a few options.

  • Per @davidebbo above, you could run git show --stat %SCM_COMMIT_ID% > build.txt in deployment script.
  • You could also copy the status.xml as you mentioned. The tricky part is you will need to use %SCM_COMMIT_ID% to locate the right folder under deployments (it is not active yet). The status will have meta-data about git commit. The state will be pending (as we are still deploying), however.
Member

suwatch commented Feb 18, 2016

yes. since you will do within deployment script, you have a few options.

  • Per @davidebbo above, you could run git show --stat %SCM_COMMIT_ID% > build.txt in deployment script.
  • You could also copy the status.xml as you mentioned. The tricky part is you will need to use %SCM_COMMIT_ID% to locate the right folder under deployments (it is not active yet). The status will have meta-data about git commit. The state will be pending (as we are still deploying), however.
@ricardopolo

This comment has been minimized.

Show comment
Hide comment
@ricardopolo

ricardopolo Feb 18, 2016

Thank yo so much @suwatch

I ended with

call :ExecuteCmd git show %SCM_COMMIT_ID% --pretty=fuller --quiet > %DEPLOYMENT_TEMP%\build.txt
IF !ERRORLEVEL! NEQ 0 goto error

In my deploy script.
And I get a file like this

commit b0e543228e8daccdd5e0e23f7e273e8478ec9bcc
Author:     Ricardo Polo <ricardo.polo@tulpep.com>
AuthorDate: Wed Feb 17 22:25:35 2016 -0500
Commit:     Ricardo Polo <ricardo.polo@tulpep.com>
CommitDate: Wed Feb 17 22:25:35 2016 -0500

    Commit info fuller

ricardopolo commented Feb 18, 2016

Thank yo so much @suwatch

I ended with

call :ExecuteCmd git show %SCM_COMMIT_ID% --pretty=fuller --quiet > %DEPLOYMENT_TEMP%\build.txt
IF !ERRORLEVEL! NEQ 0 goto error

In my deploy script.
And I get a file like this

commit b0e543228e8daccdd5e0e23f7e273e8478ec9bcc
Author:     Ricardo Polo <ricardo.polo@tulpep.com>
AuthorDate: Wed Feb 17 22:25:35 2016 -0500
Commit:     Ricardo Polo <ricardo.polo@tulpep.com>
CommitDate: Wed Feb 17 22:25:35 2016 -0500

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