Skip to content

Commit

Permalink
Fix broken application name override
Browse files Browse the repository at this point in the history
Fixes #17
  • Loading branch information
arnarg committed Oct 13, 2024
1 parent b8abf95 commit 6e20193
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 3 deletions.
4 changes: 2 additions & 2 deletions modules/applications/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ in {
};
namespace = mkOption {
type = types.str;
default = name;
default = config.name;
description = "Namespace to deploy application into (defaults to name).";
};
createNamespace = mkOption {
Expand Down Expand Up @@ -255,7 +255,7 @@ in {
output = {
path = mkOption {
type = types.str;
default = name;
default = config.name;
description = ''
Name of the folder that contains all rendered resources for the application. Relative to the root of the repository.
'';
Expand Down
2 changes: 1 addition & 1 deletion modules/nixidy.nix
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ in {
lib.attrsets.mapAttrs (
n: app: {
metadata = {
name = n;
inherit (app) name;
annotations =
if app.annotations != {}
then app.annotations
Expand Down
1 change: 1 addition & 0 deletions tests/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
./compare-options.nix
./create-namespace.nix
./yamls.nix
./override-name.nix
./helm/no-values.nix
./helm/with-values.nix
./helm/transformer.nix
Expand Down
37 changes: 37 additions & 0 deletions tests/override-name.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{config, ...}: let
apps = config.applications;
in {
applications.test1 = {
name = "test1override";
};

test = {
name = "application name override";
description = "Check that application name override works as expected.";
assertions = [
{
description = "Output path should use override name.";

expression = apps.test1.output.path;

expected = "test1override";
}

{
description = "Namespace without override should use override name.";

expression = apps.test1.namespace;

expected = "test1override";
}

{
description = "Generated Argo CD applicaiton should use override name.";

expression = apps.apps.resources.applications.test1.metadata.name;

expected = "test1override";
}
];
};
}

0 comments on commit 6e20193

Please sign in to comment.