bobheadxi / deployments

🔖 GitHub Action for working painlessly with deployment statuses
https://github.com/marketplace/actions/github-deployments
MIT License
385 stars 64 forks source link

Default behaviour for auto_inactive doesn't work as expected #92

Closed NickGraham101 closed 2 years ago

NickGraham101 commented 2 years ago

After upgrading from v0.6.2 to v1 we encountered a rate limiting issue with the default settings of, I've discussed this further here.

We attempted to resolve this by changing override to false and relying on the default setting of true for auto_inactive however this was only partially successful. We no longer get rate limited because there are no API calls being made to update the inactive deployments. However the status of the previous deployments are not getting updated, I believe this is because all deployments are now created with transient_environment: true.

As per the docs:

When you set the state of a deployment to success, then all prior non-transient, non-production environment deployments in the same repository with the same environment name will become inactive.

I created a simple pipeline here which shows the multiple active deployments here.

Is it possible to make transient_environment a configurable value again?

hudovisk commented 2 years ago

Sharing the problem we are facing here:

Error: unexpected error encountered: HttpError: Validation Failed: {"resource":"DeploymentStatus","code":"custom","message":"This deployment has reached the maximum number of statuses."} - see logs for more information

I believe this is due to how override works, it is fetching for all deployments of a given environment and updating its status:

: found 100 existing deployments for env
: setting deployment (***************) state to "inactive"
..... (100 more lines)

I think the solution @NickGraham101 mentioned would work for our use case also.

nilampatel-engineer commented 2 years ago

what is the solution, could you please share? as I m also facing similar issue

CumpsD commented 2 years ago

We are hitting this This deployment has reached the maximum number of statuses. error too. Had to disable this action for now.

groundfloorwebb commented 2 years ago

Thanks for the suggestion @NickGraham101 , I was hitting the same issues and disabling override on my finish actions appears to have done the trick. You saved my a whole pile of confusion, appreciate it.

@nilampatel-engineer here's what my solution looked like in the end, i hope this clarifies things for you.

      - name: update deployment status
        uses: bobheadxi/deployments@main
        if: always()
        with:
          step: finish
          token: ${{ secrets.GITHUB_TOKEN }}
          status: ${{ job.status }}
          deployment_id: ${{ steps.deployment.outputs.deployment_id }}
          env: ${{ steps.classify.outputs.environment_key }}
          env_url: "https://${{ steps.GET_TF_OUTPUT.outputs.DOMAIN }}"
          desc: "Pull request env update"
          override: false

Just to be clear the fix was adding override: false.

kroehre commented 2 years ago

I'm also seeing this issue. override: false stops the errors but all previous deployments remain active. It seems as though the action tries to mark all past deployments inactive, including the many that are already inactive.

bobheadxi commented 2 years ago

Hey everyone, unfortunately, I haven't been able to take a look at this and probably won't have the bandwidth to actively maintain this project for the time being. If someone finds a good way forward I would appreciate a PR!

If anyone is open to helping me maintain this project I'd be super grateful and happy to chat, please reach out to me via twitter, email, or https://github.com/bobheadxi/deployments/discussions/103! 🙏

vhatsura commented 2 years ago

fixed with #104