Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CLI tags, allow comma delisted tags, add test #1695

Merged
merged 2 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,16 @@ 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) => {
const tags: string[] = [];
rawTags.forEach(rawTag =>
rawTag?.split(",").forEach(tag => {
tags.push(tag);
})
);
return tags;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return rawTags.map(tags => tags.split(",")).flat();

}
}
};

Expand Down Expand Up @@ -469,6 +478,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
Loading