Reviewable / appengine-remove-action

Action to remove versions of deployed App Engine apps over the set limit
3 stars 2 forks source link

Broken for versions > 2.1.2 #15

Closed luismolina13 closed 1 year ago

luismolina13 commented 1 year ago

When using the following configuration it fails to delete the versions:

      - name: 'Remove old versions'
        uses: Reviewable/appengine-remove-action@v3.0.0
        with:
          limit: 10
          apply_limit_after_days: 14
          service_name: api
pkaminski commented 1 year ago

It works fine for us, though it looks like if you just deployed a version GCP doesn't immediately include it in the list, so you end up with one more version than specified.

Can you show the logs from a run of the action?

luismolina13 commented 1 year ago

I also tried to look at the changes since that version but nothing stuck out 🤔 . This is what we see in the logs, it seems like it finds the versions it is supposed to delete but then it skips the deletion part.

Run Reviewable/appengine-remove-action@v3.0.0
  with:
    limit: 10
    apply_limit_after_days: 14
    service_name: ***
  env:
    NODE_AUTH_TOKEN: ***
    NPM_CONFIG_USERCONFIG: /home/runner/work/_temp/.npmrc
    CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE: /home/runner/work/***/***/gha-creds-414d92b04d9798fa.json
    GOOGLE_APPLICATION_CREDENTIALS: /home/runner/work/***/***/gha-creds-414d92b04d9798fa.json
    GOOGLE_GHA_CREDS_PATH: /home/runner/work/***/***/gha-creds-414d92b04d9798fa.json
    CLOUDSDK_CORE_PROJECT: ***
    CLOUDSDK_PROJECT: ***
    GCLOUD_PROJECT: ***
    GCP_PROJECT: ***
    GOOGLE_CLOUD_PROJECT: ***
    CLOUDSDK_METRICS_ENVIRONMENT: github-actions-setup-gcloud
    CLOUDSDK_METRICS_ENVIRONMENT_VERSION: 1.1.0
Successfully authenticated
/opt/hostedtoolcache/gcloud/418.0.0/x64/bin/gcloud app versions list --filter traffic_split=0 --format value(id) --sort-by last_deployed_time --filter version.createTime.date('%Y-%m-%d', Z)<'2023-02-02' --service ***
v42e464d
v66cece4
vebfb96c
pkaminski commented 1 year ago

Hmm, that looks like it's working as expected. You specified a limit of 10 versions and the action only found 3 that are older than 14 days, so there's nothing to delete.

luismolina13 commented 1 year ago

Oh I see, I completely misunderstood what the limit flag did then. I thought it was meant to keep any versions that are within the 14 days capped at a limit of 10 and delete all beyond the time window.

This makes sense. Thanks for clarifying and thanks for maintaining!

pkaminski commented 1 year ago

No worries, the combination of these semantics is tricky and could've been interpreted any number of ways. Cheers.