hercules-ci / hercules-ci-effects

Expressions to change the world (just a tiny bit)
Apache License 2.0
16 stars 10 forks source link

Add push-cache-effect #165

Open zmrocze opened 8 months ago

zmrocze commented 8 months ago

Motivation

We want to push some paths to either the cachix or attic cache, additionaly to the cache configured for herculesCI. We discussed it recently on mlabs slack. If you guys would be interested here's a module doing that to be used like below:

populate-cache-effect = {
      enable = true;
      caches = {
        mlabs-attic = {
          type = "attic";
          secretName = "cardano-nix-attic-token";
          branches = ["master"];
          packages = [test-drv];
        };
        mlabs-cachix = {
          type = "cachix";
          secretName = "karol-cachix-token";
          branches = ["master" "push-to-attic"];
          packages = [test-drv];
        };
      };
    };

it's a flake-parts module producing effects under herculesCI.onPush.default.outputs.effects.populate-cache-effect option.

Questions

It works. But I don't understand the structure of this repository, so I'd like to ask first how to incorporate that into the codebase:

Maintainer checklist

zmrocze commented 8 months ago

Hi @roberth,

it works as witnessed on this demo repository.

I've moved the pr again, sorry. That is the previous, there was a discussion, I tried to act on all points and believe they're fixed. Go ahead and review if you can please!

brainrake commented 5 months ago

needs documentation

brainrake commented 5 months ago

i would separate the two effects since the abstraction is too complicated, there are significant differences, and there is still repetition.

brainrake commented 5 months ago

I'd also add mkCachixPushEffect and mkAtticPushEffect functions.

zmrocze commented 4 months ago

@brainrake what if instead type would take a list, i.e.: types = ["attic" "cachix"]? How it is currently I agree that the effect should be split into two effects.