Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eco-CI - Estimating the cost of CI pipelines #736

Conversation

ArneTR
Copy link
Contributor

@ArneTR ArneTR commented May 22, 2024

Types of changes

  • Enhancement (project structure, spelling, grammar, formatting)
  • Bug fix (non-breaking change which fixes an issue)
  • [x ] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • [ x] All new and existing tests passed.

A description of the changes proposed in the Pull Request

This pull requests is a bit out of the ordinary ... I guess :)

I work for an open source company called Green Coding Solutions in Germany and we started with the mission to increase awareness and actionability around digital CO2 emissions.

We have recently created an open source CI/CD plugin called Eco-CI.

It integrates into the Github Actions pipeline and estimates the energy and CO2 consumption of the pipeline by utilizing a Machine Learning model trained on real server energy data from SPECpower

The tool creates awareness of the energy cost and carbon emissions of CI/CD pipelines and empoweres developers to create action for more sustainability.
It can separate steps of the pipeline and create detailed drill-downs which step has increased / decreased in carbon emissions and provider great insights into pipeline performance in general.

In this PR I have made a sample integration into the .github/workflows/nodejs-ci.yml pipeline.

The PR is also for the Open Source WG meeting with @seanmcilroy29 that we are invited in on Thursday to have some example discuss.

I hope this PR and the information that Eco-CI provides is interesting for you and I am super interested in your feedback on it.

Changelog

  • Added Eco-CI into the .github/workflows/nodejs-ci.yml pipeline
  • Activated the send-data: true flag. This will send data to be used as historical data view on https://metrics.green-coding.io/ci-index.html . If this is not desired it must be set to false.

Demo

@ribalba @MichelleGruene

@jmcook1186
Copy link
Contributor

Hi @ArneTR thanks for this PR and sorry for the slow response.
In principle I'm happy to bring this in as I'm intrigued to see how your system works, but going to assign to @narekhovhannisyan to review first to check it won't break anything related to our CI/CD.
(Also, we won't be able to merge unless you resolve the DCO requirement by adding a DCO commit).

@ArneTR
Copy link
Contributor Author

ArneTR commented Jun 21, 2024

Hey @jmcook1186 ,

  • I force pushed the PR and squashed all unsigned commits into one DCO conforming signed one. Sorry about that
  • Thanks for the kind words and that you like it. We also presented our tool to the Standards WG and it is currently there also under review for a SCI use case. Just some background info ...
  • Maybe to lighten the work on validating for your pipeline: We ran the pipeline in our forked repo and there it showed no issues: https://github.com/green-coding-solutions/if/actions also all steps are using continue-on-error to be double safe.

@jmcook1186
Copy link
Contributor

@narekhovhannisyan quick reminder to review and approve if you are happy

@jmcook1186
Copy link
Contributor

Hi @ArneTR - curious whether the energy/carbon data you predict using EcoCI is exposed via an API? If so, we would love to have a system where your app is part of our CI/CD but we can also query the estimates using an IF plugin to give a neat way to include our CI/CD in estimates of our project's overall impact.

@jmcook1186 jmcook1186 self-requested a review July 8, 2024 10:23
@ArneTR
Copy link
Contributor Author

ArneTR commented Jul 8, 2024

Hi @ArneTR - curious whether the energy/carbon data you predict using EcoCI is exposed via an API? If so, we would love to have a system where your app is part of our CI/CD but we can also query the estimates using an IF plugin to give a neat way to include our CI/CD in estimates of our project's overall impact.

There are two ways:

  • You can use the underlying model - Cloud Energy which can effectivley be used anywhere where Python runs. I also had a discussion with @jawache about the idea of bringing it to IF but we didn't have the time to catch up on this

  • The alternative, if you are already sending the data to our free API endpoint (by setting the send-data: true switch as done in this PR) you will be able to use our API to retrieve the data.
    Since the data shows here: https://metrics.green-coding.io/ci-index.html the corresponding API to query the results is here: https://api.green-coding.io/docs . The endpoint would be GET /v1/ci/measurements

@narekhovhannisyan narekhovhannisyan merged commit f332aa5 into Green-Software-Foundation:main Jul 8, 2024
1 check passed
@ArneTR
Copy link
Contributor Author

ArneTR commented Jul 10, 2024

Thanks for the merge.

For the sake of completeness:

Super happy for any feedback as soon as you have aquired some data!

@jmcook1186
Copy link
Contributor

Thanks @ArneTR , this is very cool. I've looked at the dashboard data and it's very useful - much kudos to your team!

I'm really keen to have an IF plugin that hits the API so that the environmental costs of the CI/CD can be included in a broader LCA for the project. I haven't been able to make a successful request yet, even just using curl, so I must be making some basic syntax error, but I haven't been able to sit and dig in properly yet. If I keep having problems maybe I could connect with one of your team for some support?

@ArneTR
Copy link
Contributor Author

ArneTR commented Jul 11, 2024

@ArneTR
Copy link
Contributor Author

ArneTR commented Jul 11, 2024

please note that the "branch" and "workflow" parameter changes for every branch and PR that is targeted

@jmcook1186
Copy link
Contributor

got it - thanks a lot!

This was referenced Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants