cncf-tags / green-reviews-tooling

Project Repository for the WG Green Reviews which is part of the CNCF TAG Environmental Sustainability
https://github.com/cncf/tag-env-sustainability/tree/main/working-groups/green-reviews
Apache License 2.0
22 stars 12 forks source link

[Action] Tracking the energy consumption of GitHub Actions Pipelines #55

Open by-d-sign opened 4 months ago

by-d-sign commented 4 months ago

Pipelines are not only a great tool for automating tedious tasks, they are also probably a mayor energy consumer. Optimizing them could be worthwhile, however their actual energy demand is currently neither visible nor well researched.

Eco-CI is an approach to measure/estimate the energy consumption of a GitHub Actions Pipeline. This could be a great tool to raise awareness and a first step towards optimization.

ArneTR commented 4 months ago

Thanks for mentioning our tooling @by-d-sign !

We are very happy to make a PR for a project of your choice. We wil integrate it on a fork and then generate some data so you have an idea how it looks like.

Which project shall it be? @nikimanoledaki @by-d-sign :)

leonardpahlke commented 4 months ago

Sounds like a great subject for a blog post @by-d-sign @ArneTR 😉 https://github.com/cncf/tag-env-sustainability/issues/new?assignees=&labels=blog&projects=&template=blog.md&title=%5BBLOG%5D+%3Cblog-title%3E

leonardpahlke commented 4 months ago

cc @savitharaghunathan

AntonioDiTuri commented 4 months ago

As we agreed during the WG regular meeting this is out of scope for the current milestone, thanks for adding the issue. We will circle back with a proposed action time after the KubeCon when we will have time to organize and prioritize issue for the next milestone. Info about the milestones are currently in the readme

ArneTR commented 4 months ago

I made a demo of how this would look for one of the workflows from Falco. I picked the only one that had a cron, as this shows the most simple integration:

Additonal: @by-d-sign Eco-CI can also handle matrix/parallel Github Actions out of the box. Since you brought this up as a question in one of the last community meetings :)

ArneTR commented 2 months ago

Hey folks,

I hope you had a great KubeCon.

We have recently added some features to our Eco-CI tooling. Now it shows also the location of the running machine which then enables to include grid intensity as well as total CO2e emitted.

You can see it in this sample PR that we have made on a fork from the Falco repository.

Aggregation and timeline data is provided here: https://metrics.green-coding.io/ci.html?repo=green-coding-solutions/falco&branch=2/merge&workflow=87453986

Hope this ping is interesting for you :)

@ribalba: Looping you in

leonardpahlke commented 2 months ago

@nikimanoledaki @AntonioDiTuri ^

ArneTR commented 1 month ago

Hey folks,

after I month I thought I give this a gentle ping. Any update if you fancy to integrate Eco-CI into any projects?

We are super happy to help and provide a PR. Integration effort should be minimal.

We recently also approached other open source projects and can provide ready tested PRs. Example : https://github.com/NMF-earth/nmf-app/pull/393

While doing so very often also some direct optimizations come into view. Example where we did this with NMF: https://github.com/NMF-earth/nmf-app/pull/395

nikimanoledaki commented 1 month ago

Hi @ArneTR! A PR is very much welcome.

If you get stuck:

We are working on some Github Action pipelines as part of two proposals being written right now. One is open for a review, for an idea of how we'll be using GA pipelines: https://github.com/cncf-tags/green-reviews-tooling/pull/88 - also feel free to review if you'd like!

Looking forward to reviewing your PR 👍 😊

ArneTR commented 1 month ago

Hey @nikimanoledaki

what I would need is a point which repo you find most suitable. You have quite many in the CNCF :)

In the history of this Issue I already pointed to a sample integration for Falco (See here) Which was however a very small pipeline and just for demo purposes.

So a pointer would be nice for a repo:

I will make a PR then and tag you there

wbeckler commented 1 month ago

Would you consider submitting this to https://github.com/opensearch-project/OpenSearch/ ? It's a beefy build that takes a long time and runs a lot.

ArneTR commented 1 month ago

Would you consider submitting this to https://github.com/opensearch-project/OpenSearch/ ? It's a beefy build that takes a long time and runs a lot.

Hey @wbeckler, sure! Which of the pipelines do you have in mind? Project has quite many apparently :)

ArneTR commented 2 weeks ago

Hey @nikimanoledaki @leonardpahlke @wbeckler @by-d-sign

Since I get no reply on my last message I thought I go ahead and just pick the biggest workflow and make a sample integration there.

Here is the PR: https://github.com/opensearch-project/OpenSearch/pull/14450

I also tagged you there.

The implementation features the newest Eco-CI with minimal overhead (https://github.com/green-coding-solutions/eco-ci-energy-estimation/releases/tag/v4.0-rc3) but I refrained from integrating stuff like PR-Comments as this would require workflow permissions changes and I wanted to keep it slim.

Happy for your feedback!