prometheus / client_golang

Prometheus instrumentation library for Go applications
https://pkg.go.dev/github.com/prometheus/client_golang
Apache License 2.0
5.4k stars 1.18k forks source link

Locally reproducible CI/CD #1436

Open kakkoyun opened 9 months ago

kakkoyun commented 9 months ago

We want vendor-independent and locally reproducible CI/CD pipelines so that our contributors can ensure quality before opening the pull requests.

dvjsharma commented 9 months ago

Hi @kakkoyun, navigated here form the LFX portal. Since this is particularly about unit testing in specific environments, We can allow contributors to specify the Go version they want to use through environment variables and modify the CI/CD scripts to interpret these variables and set up the corresponding Go version for testing. We certainly will have to find a way to manage dependencies. Or how about using 3 different docker images for 3 test environments? What are your thoughts?

marcosnils commented 5 months ago

hey there! I'm coming from this X thread: https://twitter.com/ArthurSilvaSens/status/1791069622508179854. Seems like https://dagger.io could help here. @juliusv mentioned that the prom team tried to use Dagger in the past without success but a lot have changed since then and this particular problematic is exactly the problem Dagger tries to solve. Happy to take a look and collaborate on a PoC if you're interested :open_hands:

bwplotka commented 5 months ago

What exactly is not reproducible at the moment? Let's talk about specifics. I heard testing for certain Go version as a one thing.

kakkoyun commented 5 months ago

What exactly is not reproducible at the moment? Let's talk about specifics. I heard testing for certain Go version as a one thing.

I never claimed it's not reproducible. The idea is to be able to run anything we use in the CI locally https://github.com/prometheus/client_golang/tree/main/.github/workflows with the least amount of effort. Technically, we can have make actions for everything and it could be the single source of truth or we can go with something fancy like https://dagger.io

marcosnils commented 5 months ago

@bwplotka @kakkoyun happy to help putting together a PoC with Dagger so you can decide if it's worth or not. Taking a glimpse at one of your most executed GHA workflows here: https://github.com/prometheus/client_golang/blob/main/.github/workflows/go.yml#L60, looks like several targets from this Makefile here (https://github.com/prometheus/client_golang/blob/main/Makefile.common) could be daggerized to avoid users running into env specific issues.

LMK if there's interest and I can kick off a draft PR and we can discuss there maybe with more tangible examples on how this could work.

kakkoyun commented 5 months ago

@marcosnils Thanks 🤩 Why not? I would be happy to review.

marcosnils commented 5 months ago

@kakkoyun funny thing is that first thimg I did after cloning the repo is calling make build and I'm getting the following error:

130|marcos:Projects/client_golang (main) (⎈ |dagger-ci)$ make build
>> building binaries
/home/marcos/Projects/gopath/bin/promu build --prefix /home/marcos/Projects/client_golang 
Unable to read config file: .promu.yml
!! open .promu.yml: no such file or directory
make: *** [Makefile.common:204: common-build] Error 1

couldn't find an easy way to unblock myself. Any ideas where I should be getting that .promu.yml file from?