Skip to content

Add Impersonate Service Account argument#2015

Open
wintermi wants to merge 50 commits intodataform-co:mainfrom
Conundrm:main
Open

Add Impersonate Service Account argument#2015
wintermi wants to merge 50 commits intodataform-co:mainfrom
Conundrm:main

Conversation

@wintermi
Copy link

This PR adds an --impersonate-service-account argument to the run and test commands, along with the required changes to allow for the impersonation of service accounts without the need to change ADC or call gcloud

This would resolve issue #2000 and would be an alternative to solution than PR #2001

Impersonation could then be achieved by executing:

dataform run --impersonate-service-account=<sSERVICE_ACCT_EMAIL>

…st' commands and the required changes to allow for the impersonation of service accounts without the need to change ADC
@wintermi wintermi requested a review from a team as a code owner September 11, 2025 06:43
@wintermi wintermi requested review from Ceridan and removed request for a team September 11, 2025 06:43
@google-cla
Copy link

google-cla bot commented Sep 11, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@camilleAmaury
Copy link

+1, this would enable to use impersonation in CI rather than giving the rights directly to the CI service account.
There is no way to workaround that currently.

@kolina
Copy link
Contributor

kolina commented Nov 11, 2025

/gcbrun

@Ceridan Ceridan requested review from kolina and removed request for Ceridan November 13, 2025 09:15
@kolina
Copy link
Contributor

kolina commented Nov 13, 2025

Sorry for the late review. A couple of things:

  • Integration tests are failing, can you take a look at fixing them? Now we have a guide of running them locally
  • Let's resolve conflicts

clientConfig.authClient = new Impersonated({
sourceClient: authClient,
targetPrincipal: this.bigQueryCredentials.impersonateServiceAccount,
targetScopes: ['https://www.googleapis.com/auth/cloud-platform']
Copy link
Contributor

Choose a reason for hiding this comment

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

EXTRA_GOOGLE_SCOPES?

Copy link
Author

Choose a reason for hiding this comment

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

Not sure what you would like done here?

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean using EXTRA_GOOGLE_SCOPES here instead of hard-coding

@kolina
Copy link
Contributor

kolina commented Jan 2, 2026

@wintermi, in the current version tests are failing due to linter checks: output

You can check errors using this lint script.

Resolved conflicts:
- cli/index.ts: Kept both impersonate-service-account option (fork feature)
  and job-labels option (upstream feature)
- package.json: Updated glob to ^10.5.0, kept google-auth-library dependency
- yarn.lock: Regenerated with updated dependencies
@wintermi
Copy link
Author

wintermi commented Jan 5, 2026

Resynced the PR with the latest commit

@wintermi
Copy link
Author

wintermi commented Jan 5, 2026

@wintermi, in the current version tests are failing due to linter checks: output

You can check errors using this lint script.

Fixed the linter issues

@wintermi
Copy link
Author

wintermi commented Jan 5, 2026

@kolina ready for retesting, thanks

@wintermi wintermi requested a review from kolina January 7, 2026 05:35
@kolina
Copy link
Contributor

kolina commented Jan 7, 2026

/gcbrun

clientConfig.authClient = new Impersonated({
sourceClient: authClient,
targetPrincipal: this.bigQueryCredentials.impersonateServiceAccount,
targetScopes: ['https://www.googleapis.com/auth/cloud-platform']
Copy link
Contributor

Choose a reason for hiding this comment

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

I mean using EXTRA_GOOGLE_SCOPES here instead of hard-coding

}

private getClient(projectId?: string) {
private async getClient(projectId?: string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

In #2001 @ashish10alex added support for impersonating a service account through ADC. Will it be enough for your use case or you need an explicit option as well?

If the latter, can you please validate manually that it works?

fernst and others added 30 commits February 6, 2026 13:54
…empty (dataform-co#2082)

* Added logic to fail test compilation if test SQL or expected SQL are empty

* Addressed PR comments

* Fix pr comments
Bumps [vm2](https://github.com/patriksimek/vm2) from 3.9.19 to 3.10.2.
- [Release notes](https://github.com/patriksimek/vm2/releases)
- [Commits](patriksimek/vm2@3.9.19...v3.10.2)

---
updated-dependencies:
- dependency-name: vm2
  dependency-version: 3.10.2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [diff](https://github.com/kpdecker/jsdiff) from 4.0.2 to 8.0.3.
- [Changelog](https://github.com/kpdecker/jsdiff/blob/master/release-notes.md)
- [Commits](kpdecker/jsdiff@v4.0.2...v8.0.3)

---
updated-dependencies:
- dependency-name: diff
  dependency-version: 8.0.3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
JS API for JiT compilation actions definition (mutually exclusive with AoT properties) and JiT context/result typings.
Implementation of context objects accessible at JiT compilation stage for supported action types.

They expose access to adapter/data and context methods, equivalent to AoT context, but with a more restrictive selection of resolvable targets.
Add file_paths field to pass accessible file
paths at JiT compilation stage.
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.21 to 4.17.23.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.21...4.17.23)

---
updated-dependencies:
- dependency-name: lodash
  dependency-version: 4.17.23
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [diff](https://github.com/kpdecker/jsdiff) from 3.5.0 to 8.0.3.
- [Changelog](https://github.com/kpdecker/jsdiff/blob/master/release-notes.md)
- [Commits](kpdecker/jsdiff@v3.5.0...v8.0.3)

---
updated-dependencies:
- dependency-name: diff
  dependency-version: 8.0.3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* JiT Contexts - Add original request & simplify constructor

Simplify constructor by explicitly passing and exposing
the orignal compilation request (which already contains
most of required data).

* JiT compilation stage implementation

Implement JiT compilation stage in Core:
 - a new entry point jitCompiler(rpcCallback), which instantiates a
single compile method, performing a compilation against a supplied
RPC implementation.
 - table/operations/incremental table context(s) construction and
invocation of the JiT code.
* Support both 'yaml' and 'yml' file extensions

We can support both formats in Dataform. 

Native configurations are stored in YAML format, but other configurations eg. from extensions might use YML too.

* Support both 'yaml' and 'yml' file extensions

We can support both formats in Dataform.

Native configurations are stored in YAML format, but other configurations eg. from extensions might use YML too.

* Support both 'yaml' and 'yml' file extensions

We can support both formats in Dataform.

Native configurations are stored in YAML format, but other configurations eg. from extensions might use YML too.

* Reorganize imports in compilers_test.ts
dataform-co#2095)

Some extensions might use different configuration files, this will allow
them to proceed when workflow_settings.yaml is missing.
Bumps [webpack](https://github.com/webpack/webpack) from 5.94.0 to 5.104.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Changelog](https://github.com/webpack/webpack/blob/main/CHANGELOG.md)
- [Commits](webpack/webpack@v5.94.0...v5.104.1)

---
updated-dependencies:
- dependency-name: webpack
  dependency-version: 5.104.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [rollup](https://github.com/rollup/rollup) from 2.79.2 to 2.80.0.
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/v2.80.0/CHANGELOG.md)
- [Commits](rollup/rollup@v2.79.2...v2.80.0)

---
updated-dependencies:
- dependency-name: rollup
  dependency-version: 2.80.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [underscore](https://github.com/jashkenas/underscore) from 1.13.1 to 1.13.8.
- [Commits](jashkenas/underscore@1.13.1...1.13.8)

---
updated-dependencies:
- dependency-name: underscore
  dependency-version: 1.13.8
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…taform Core and identify bottlenecks (dataform-co#2100)

* feat: add --verbose argument to expose steps in stateless installation

* chore: make verbose and quiet flags mutually exclusive

* feat: use performance timing in node to avoid system clock issues

* chore: do not export print

* refactor: remove redundant double check

* chore: print should pipe to stderr
* feat: Add BigQuery reservation configuration for projects and individual actions.

* lint

Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>

* refactor: rename `bigqueryReservation` to `reservation` across configurations, protos, and related code

Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>

* docs: clarify BigQuery reservation fallback behavior in protos and CLI

Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>

* refactor: update default reservation test constant and expand project config assertions

Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>

* fix test reservation name

Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>

* added documentation for BigQuery reservation configuration

Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>

* fix project name

Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>

* fix reservation location

Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>

* Add reservation to a profile schema

Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>

* revert reservation attribute

Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>

* Note support status

---------

Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
…o#2106)

* refactor: split index_test.ts into specialized test files

* refactor: decompose monolithic cli/index_test.ts into modular components

- Extract shared test utilities into cli/index_test_base.ts

- Create dedicated test files for help, init, project, compile, and run commands

- Update cli/BUILD to reflect the new modular test structure
Instead of exposing a proto struct, returning (mostly) the same object
that got passed in the original key at definition.
- Enhance error coercion in common/errors/errors.ts
- Sync protos/execution.proto and protos/jit.proto with new fields
…st' commands and the required changes to allow for the impersonation of service accounts without the need to change ADC
Resolve conflicts in bigquery adapter imports and getClient method
(kept double-quote style and correct indentation), and remove
duplicate impersonateServiceAccountOption definition in CLI.

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.