Skip to content

Commit

Permalink
Merge pull request dataform-co#1695 from dataform-co/fix-cli-tags
Browse files Browse the repository at this point in the history
Fix CLI tags, allow comma delisted tags, add test
  • Loading branch information
Ekrekr committed Mar 26, 2024
2 parents 8c3c24d + 069c360 commit ee410bd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
4 changes: 3 additions & 1 deletion cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ const tagsOption: INamedOption<yargs.Options> = {
name: "tags",
option: {
describe: "A list of tags to filter the actions to run.",
type: "array"
type: "array",
coerce: (rawTags: string[] | null) => rawTags.map(tags => tags.split(",")).flat()
}
};

Expand Down Expand Up @@ -469,6 +470,7 @@ export function runCli() {
credentialsOption,
jsonOutputOption,
timeoutOption,
tagsOption,
...ProjectConfigOptions.allYargsOptions
],
processFn: async argv => {
Expand Down
11 changes: 7 additions & 4 deletions cli/index_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ defaultAssertionDataset: dataform_assertions
fs.writeFileSync(
filePath,
`
config { type: "table" }
config { type: "table", tags: ["someTag"] }
select 1 as \${dataform.projectConfig.vars.testVar2}
`
);
Expand Down Expand Up @@ -230,7 +230,8 @@ select 1 as \${dataform.projectConfig.vars.testVar2}
},
query: "\n\nselect 1 as testValue2\n",
disabled: false,
fileName: "definitions/example.sqlx"
fileName: "definitions/example.sqlx",
tags: ["someTag"]
}
],
projectConfig: {
Expand Down Expand Up @@ -267,7 +268,8 @@ select 1 as \${dataform.projectConfig.vars.testVar2}
"--dry-run",
"--json",
"--vars=testVar1=testValue1,testVar2=testValue2",
"--default-location=europe"
"--default-location=europe",
"--tags=someTag,someOtherTag"
])
);

Expand Down Expand Up @@ -306,7 +308,8 @@ select 1 as \${dataform.projectConfig.vars.testVar2}
}
},
runConfig: {
fullRefresh: false
fullRefresh: false,
tags: ["someTag", "someOtherTag"]
},
warehouseState: {}
});
Expand Down
2 changes: 1 addition & 1 deletion docs/configs-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<a name="dataform-ActionConfig"></a>

### ActionConfig
Action config defines the configuration properties of actions.
Action config defines the contents of `actions.yaml` configuration files.


| Field | Type | Label | Description |
Expand Down
2 changes: 1 addition & 1 deletion protos/configs.proto
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ message ActionConfigs {
repeated ActionConfig actions = 1;
}

// Action config defines the configuration properties of actions.
// Action config defines the contents of `actions.yaml` configuration files.
message ActionConfig {
// Target represents a unique action identifier.
message Target {
Expand Down

0 comments on commit ee410bd

Please sign in to comment.