Skip to content

Trigger a webhook on deployment events #23

@scarisey

Description

@scarisey

Add the following option in NixOS module :

  services.pullix = {
    enable = true;
    hostname = "my_nas";
    pollIntervalSecs = 60;
    flakeRepo = {
      type = "GitHub";
      repo = "scarisey/nixos-dotfiles";
      prodSpec = {
        ref = "my_nas/prod";
      };
      testSpec = {
        ref = "my_nas/test";
      };
    };
    environmentFile = config.sops.secrets."my_nas/nix_config_pullix".path; #set a PAT env var here for this example
    verbose_logs = false;
    otelHttpEndpoint = "http://localhost:4318/v1/metrics";
    webhooks = {
     onTestSucceeded = {
       url = "https://api.github.com/repos/OWNER/REPO/actions/workflows/mon-workflow.yml/dispatches";
       headers = [
         "Authorization: Bearer <PAT>" #<ENV_VAR> should be the way to substitute an env var with pullix at runtime
         "Accept: application/vnd.github+json"
       ];
       data = """
         {"ref": "main", "inputs": {"environment": "prod"}}
       """;
     };
     onProdSucceeded = #...
     onTestFailed = #...
     onProdFailed = #...
    };
  };

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions