Search code examples
google-app-enginegoogle-cloud-platformgcloud

How Would I Retrieve All Git Commit SHA-1 Hashes Deployed to AppEngine Using the CLI?


The "Versions" page in the AppEngine section of the GCP console here displays a table containing all of the git commit SHA-1 hashes that have been deployed for a given AppEngine Service.

How would I display this list using the gcloud CLI?


Solution

  • You are able to generate the table you're looking for using the app group within the gcloud CLI.

    Here is an example table with some formatting and asc. sorting:

    gcloud app versions list \
    --format="table[box](last_deployed_time.datetime:label=DEPLOYED, version.id:label=GIT_COMMIT_HASH)" \
    --service=$GAE_SERVICE_NAME \
    --sort-by=DEPLOYED
    
    #=>
    
    ┌───────────────────────────┬──────────────────────────────────────────┐
    │          DEPLOYED         │             GIT_COMMIT_HASH              │
    ├───────────────────────────┼──────────────────────────────────────────┤
    │ 1970-01-01 00:00:00-00:00 │ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx │
    │           . . .           │                  . . .                   │
    │           . . .           │                  . . .                   │
    │           . . .           │                  . . .                   │
    │ 1970-01-01 00:00:01-00:00 │ yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy │
    └───────────────────────────┴──────────────────────────────────────────┘