0

I've been given a nodejs API server project that was deployed to gcloud, but I have no idea what "version" is deployed there. That is to say I need to determine if a specific git branch has been deployed to a specific environment.

The version in package.json was not regularly updated.

I tried this:

$ gcloud app versions describe 20220324t175829 --service default --project myproject

I got the version by listing the versions on gcloud and using the last deployed. I see hashes for each file deployed, but those aren't git commit hashes as far as I can tell.

Is there a way to determine this?

Aaron
  • 3,249
  • 4
  • 35
  • 51
  • Have you gone through this [stackoverflow](https://stackoverflow.com/questions/2706797/finding-what-branch-a-git-commit-came-from)? – Sathi Aiswarya May 27 '22 at 07:30
  • I don't think those shas are git commit shas, they are related to gcloud deployments – Aaron May 27 '22 at 08:11
  • 2
    A gcloud deployment need not be anything that was ever *in* a Git repository, and in general it will contain at least one thing that was never in Git. It therefore doesn't have a Git hash ID of its own. *If* the thing being deployed has a version-dump operation, use that; *if* that dumps a Git version, use that in turn to find the Git version. But otherwise there's no general solution. – torek May 27 '22 at 08:37
  • That makes sense. I think that's the answer. If you make it the answer I will mark it as such. – Aaron May 27 '22 at 13:28

1 Answers1

2

As @torek mentioned gcloud deployment need not be anything that was ever in a Git repository, and in general it will contain at least one thing that was never in Git. It therefore doesn't have a Git hash ID of its own. If the thing being deployed has a version-dump operation, use that; if that dumps a Git version, use that in turn to find the Git version. But otherwise there's no general solution.

Sathi Aiswarya
  • 2,068
  • 2
  • 11