appveyor / website

AppVeyor CI public website.
https://www.appveyor.com
MIT License
106 stars 298 forks source link

Automatically remove Docker id BYOC once they are offline for > 1 day #712

Open HariSekhon opened 4 years ago

HariSekhon commented 4 years ago

Hi,

Dockerized AppVeyor BYOC instances accumulate on the page after being deleted:

https://ci.appveyor.com/build-clouds

It might be worth automatically removing docker id named hosts from this page automatically if they are offline for say 1 day.

Screenshot 2020-03-18 at 4 07 55 PM

Thanks

Hari

FeodorFitsner commented 4 years ago

Are those instances like disposable?

HariSekhon commented 4 years ago

@FeodorFitsner yes they're docker containers, so once they're gone, they're gone.

FeodorFitsner commented 4 years ago

Why would you need to constantly add/remove Docker clouds anyway? As it's not a common scenario you can just do a scheduled script deleting those clouds via AppVeyor API.

HariSekhon commented 4 years ago

I think if using Docker this is actually a very standard pattern.

If you run BYOC in Kubernetes or Docker these are going to be replaced with new containers with different auto-generated names over time naturally so you will accumulate lots of dead byoc references.

HariSekhon commented 4 years ago

I'm about to write a script for the AppVeyor API as a quick workaround as suggested, but cannot find much documentation for this:

https://www.appveyor.com/docs/api/

Is deleting old BYOC clouds documented anywhere?

I was gonna do a query, filter on offline and remove those so that it doesn't remove the currently active one...

HariSekhon commented 4 years ago

Documentation seems a bit thin, found this unofficial API doc:

https://kevinoid.github.io/appveyor-swagger/bootprint/

but even on there I can't see an endpoint to query and delete BYOC clouds.

FeodorFitsner commented 4 years ago

the best way to see an API call is in "Network" tab of your browser. UI uses the same API.

...still why would you need to run AppVeyor in a new container every time? You are supposed to install AppVeyor Host Agent to Docker host and host agent will be creating a new container for every build.

HariSekhon commented 4 years ago

Oh I see, you expect it installed in base and then it calls docker, so the agent id is always that of the underlying host... I had used it inside Docker itself as a temporary agent as other CI systems.

Will have a look at dumping the UI from the web browser, but it would be good to have an officially documented API.

HariSekhon commented 4 years ago

Just wrote a quick script to do this, it worked to clean up my account, thanks!

FeodorFitsner commented 4 years ago

We will documented, sure. We are currently migrating to .NET Core so there will be some changes.

This is more info about running Docker builds with AppVeyor: https://www.appveyor.com/docs/server/#docker-1