-
Notifications
You must be signed in to change notification settings - Fork 201
Add Impersonate Service Account argument #2015
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
Open
wintermi
wants to merge
10
commits into
dataform-co:main
Choose a base branch
from
Conundrm:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+254
−34
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
cf3881c
Add the '--impersonate-service-account' argument to the 'run' and 'te…
wintermi 8c2e093
Make changes as requested
wintermi 35a0e62
Make changes as requested
wintermi a96b601
Make changes as requested
wintermi 2086be4
Add the '--impersonate-service-account' argument to the 'run' and 'te…
wintermi 3b6cd51
Make changes as requested
wintermi 26b6528
Make changes as requested
wintermi 868c5a3
fix(cli): remove parse-duration dependency
wintermi 25c4480
refactor(cli): dedupe bigquery impersonation scopes
wintermi 3891fdb
refactor(cli): rewrite duration parser and add packaging build script
wintermi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #!/bin/bash | ||
| set -e | ||
|
|
||
| yarn install | ||
|
|
||
| bazel build //packages/@dataform/cli:bin | ||
|
|
||
| bazel run packages/@dataform/cli:package.pack | ||
| bazel run packages/@dataform/core:package.pack | ||
|
|
||
| mv dataform-cli-3.0.59.tgz ../hephaestus-worker-base/dataform/dataform-cli-3.0.59.tgz | ||
| mv dataform-core-3.0.59.tgz ../hephaestus-worker-base/dataform/dataform-core-3.0.59.tgz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,6 @@ | ||
| import * as chokidar from "chokidar"; | ||
| import * as fs from "fs"; | ||
| import * as glob from "glob"; | ||
| import parseDuration from "parse-duration"; | ||
| import * as path from "path"; | ||
| import yargs from "yargs"; | ||
|
|
||
|
|
@@ -28,6 +27,7 @@ import { | |
| actuallyResolve, | ||
| assertPathExists, | ||
| compiledGraphHasErrors, | ||
| parseCliDuration, | ||
| promptForIcebergConfig, | ||
| } from "df/cli/util"; | ||
| import { createYargsCli, INamedOption } from "df/cli/yargswrapper"; | ||
|
|
@@ -174,7 +174,7 @@ const timeoutOption: INamedOption<yargs.Options> = { | |
| type: "string", | ||
| default: null, | ||
| coerce: (rawTimeoutString: string | null) => | ||
| rawTimeoutString ? parseDuration(rawTimeoutString) : null | ||
| rawTimeoutString ? parseCliDuration(rawTimeoutString) : null | ||
| } | ||
| }; | ||
|
|
||
|
|
@@ -207,6 +207,13 @@ const bigqueryJobLabelsOption: INamedOption<yargs.Options> = { | |
| } | ||
| }; | ||
|
|
||
| const impersonateServiceAccountOption: INamedOption<yargs.Options> = { | ||
| name: "impersonate-service-account", | ||
| option: { | ||
| describe: "Service account email to impersonate during authentication.", | ||
| type: "string" | ||
| } | ||
| }; | ||
| const quietCompileOption: INamedOption<yargs.Options> = { | ||
| name: "quiet", | ||
| option: { | ||
|
|
@@ -503,7 +510,13 @@ export function runCli() { | |
| format: `test [${projectDirMustExistOption.name}]`, | ||
| description: "Run the dataform project's unit tests.", | ||
| positionalOptions: [projectDirMustExistOption], | ||
| options: [credentialsOption, timeoutOption, jsonOutputOption, ...ProjectConfigOptions.allYargsOptions], | ||
| options: [ | ||
| credentialsOption, | ||
| impersonateServiceAccountOption, | ||
| timeoutOption, | ||
| jsonOutputOption, | ||
| ...ProjectConfigOptions.allYargsOptions | ||
| ], | ||
| processFn: async argv => { | ||
| if (!argv[jsonOutputOption.name]) { | ||
| print("Compiling...\n"); | ||
|
|
@@ -523,6 +536,10 @@ export function runCli() { | |
| const readCredentials = credentials.read( | ||
| getCredentialsPath(argv[projectDirOption.name], argv[credentialsOption.name]) | ||
| ); | ||
| if (argv[impersonateServiceAccountOption.name]) { | ||
| (readCredentials as any).impersonateServiceAccount = | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we extend |
||
| argv[impersonateServiceAccountOption.name]; | ||
| } | ||
|
|
||
| if (!compiledGraph.tests.length) { | ||
| printError("No unit tests found."); | ||
|
|
@@ -574,10 +591,10 @@ export function runCli() { | |
| }, | ||
| actionsOption, | ||
| credentialsOption, | ||
| impersonateServiceAccountOption, | ||
| fullRefreshOption, | ||
| includeDepsOption, | ||
| includeDependentsOption, | ||
| credentialsOption, | ||
| jsonOutputOption, | ||
| timeoutOption, | ||
| tagsOption, | ||
|
|
@@ -610,6 +627,10 @@ export function runCli() { | |
| const readCredentials = credentials.read( | ||
| getCredentialsPath(argv[projectDirOption.name], argv[credentialsOption.name]) | ||
| ); | ||
| if (argv[impersonateServiceAccountOption.name]) { | ||
| (readCredentials as any).impersonateServiceAccount = | ||
| argv[impersonateServiceAccountOption.name]; | ||
| } | ||
|
|
||
| const dbadapter = new BigQueryDbAdapter(readCredentials); | ||
| const executionGraph = await build( | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.