Skip to content

Conversation

@reakaleek
Copy link
Member

@reakaleek reakaleek commented Sep 16, 2024

The project-id is actually not relevant and is not used by the internal google-github-actions/auth action if the workload_identity_provider input is provided.

This option may be removed in a future release.

@reakaleek reakaleek requested a review from v1v September 16, 2024 09:45
@reakaleek reakaleek self-assigned this Sep 16, 2024
@reakaleek reakaleek added the changelog:chore When you add a change that is not user-facing label Sep 16, 2024
Copy link
Member

@v1v v1v left a comment

Choose a reason for hiding this comment

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

I'm a bit confused, I can see https://github.com/google-github-actions/auth#usage

Does it mean the usage example is not correct? Can you elaborate this please?

@reakaleek
Copy link
Member Author

reakaleek commented Sep 16, 2024

I'm a bit confused, I can see https://github.com/google-github-actions/auth#usage

Does it mean the usage example is not correct? Can you elaborate this please?

I actually had the same assumption and I think this is the reason why I added both inputs originially.

But if you look at our current usages. e.g.

we are not using the project-id. The default value of project-id is elastic-observability, which would actually be wrong in those cases.

I think, when the input workload_identity_provider is provided, it infers the project ID from the resource path.

@reakaleek
Copy link
Member Author

reakaleek commented Sep 16, 2024

IMO, for a future release,

maybe we can create a mapping of aliases to make it more readable

const aliases = {
  'elastic-observability': '1234',
  'elastic-observability-ci': '5678',
  'elastic-cdn': '91011'
}

so that the usage becomes something like this

      - uses: elastic/oblt-actions/google/[email protected]
        with:
          alias: 'elastic-observability'

@reakaleek reakaleek requested a review from v1v September 16, 2024 10:22
@v1v
Copy link
Member

v1v commented Sep 16, 2024

I think, when the input workload_identity_provider is provided, it infers the project ID from the resource path.

Shall we raise a GH issue to the upstream project?

@reakaleek
Copy link
Member Author

I think, when the input workload_identity_provider is provided, it infers the project ID from the resource path.

Shall we raise a GH issue to the upstream project?

From my understand setting the project ID still has a use

https://github.com/google-github-actions/auth/blob/c8788cc4c52eba6566baf085281fec298f1a1146/src/main.ts#L203

CLI tools or actions after the auth action benefit from the exported environment variables.

In our case it seems like it worked regardless.

@v1v
Copy link
Member

v1v commented Sep 16, 2024

I think, when the input workload_identity_provider is provided, it infers the project ID from the resource path.

I still need clarification. https://github.com/google-github-actions/auth/blob/c8788cc4c52eba6566baf085281fec298f1a1146/src/utils.ts#L67-L91 is the function to get the projectID, and the project_id input has higher precedence than credentials_json and service_account. It does nothing about workload_identity_provider.

I don't understand how workload_identity_provider infers the project-id and why we don' need project-id :/

@reakaleek
Copy link
Member Author

I think, when the input workload_identity_provider is provided, it infers the project ID from the resource path.

I still need clarification. https://github.com/google-github-actions/auth/blob/c8788cc4c52eba6566baf085281fec298f1a1146/src/utils.ts#L67-L91 is the function to get the projectID, and the project_id input has higher precedence than credentials_json and service_account. It does nothing about workload_identity_provider.

I don't understand how workload_identity_provider infers the project-id and why we don' need project-id :/

The workload_identity_provider path includes the project number.

image

@v1v
Copy link
Member

v1v commented Sep 16, 2024

The workload_identity_provider path includes the project number.

Correct me if I'm wrong, so I think if it's not honoured then we might need to report that to the upstream, otherwise, I cannot understand what's the reason for letting using it while it's not honoured.

@reakaleek
Copy link
Member Author

reakaleek commented Sep 17, 2024

The workload_identity_provider path includes the project number.

Correct me if I'm wrong, so I think if it's not honoured then we might need to report that to the upstream, otherwise, I cannot understand what's the reason for letting using it while it's not honoured.

According to the README.md, project_id is not required to achieve Workload Identity Federation.

https://github.com/google-github-actions/auth?tab=readme-ov-file#inputs-workload-identity-federation

The only required attribute is workload_identity_provider.

P.S.

I can still ask, but from my understanding, it's a convenience option to export the project ID as an environment variable for other Google-related actions or tools.

@v1v
Copy link
Member

v1v commented Sep 17, 2024

I can still ask, but from my understanding, it's a convenience option to export the project ID as an environment variable for other Google-related actions or tools.

But if they don't match, will the exported variable be project_id rather than the project-id in workload_identity_provider?

In my view, it's not clear why https://github.com/google-github-actions/auth#usage shows a project_id.

@reakaleek
Copy link
Member Author

I can still ask, but from my understanding, it's a convenience option to export the project ID as an environment variable for other Google-related actions or tools.

But if they don't match, will the exported variable be project_id rather than the project-id in workload_identity_provider?

In my view, it's not clear why https://github.com/google-github-actions/auth#usage shows a project_id.

Fair enough. Sorry, for being stubborn. I will create an issue shortly.. but what does it mean for this PR?

@v1v
Copy link
Member

v1v commented Sep 17, 2024

Fair enough. Sorry, for being stubborn. I will create an issue shortly.. but what does it mean for this PR?

No worries at all.

Let me review it now

@reakaleek
Copy link
Member Author

Fair enough. Sorry, for being stubborn. I will create an issue shortly.. but what does it mean for this PR?

No worries at all.

Let me review it now

google-github-actions/auth#442

@reakaleek reakaleek enabled auto-merge (squash) September 17, 2024 11:10
@reakaleek reakaleek merged commit 0eb08f0 into main Sep 17, 2024
@reakaleek reakaleek deleted the feature/deprecate-project-id-google-auth branch September 17, 2024 11:10
@reakaleek reakaleek mentioned this pull request Sep 17, 2024
v1v added a commit to v1v/oblt-actions that referenced this pull request Oct 7, 2024
…ibana

* upstream/main: (51 commits)
  deps: Bump oblt-cli version to 7.6.2 (elastic#139)
  feat: undeploy-my-kibana (elastic#140)
  build(deps): bump the github-actions group across 2 directories with 2 updates (elastic#141)
  build(deps): bump the github-actions group across 6 directories with 1 update (elastic#138)
  chore: deps(oblt-cli): Bump oblt-cli version to 7.5.24 (elastic#137)
  feat: support wait for maven central (elastic#133)
  feat: migrate is-member-elastic-org (elastic#135)
  deps: Bump oblt-cli version to 7.5.22 (elastic#131)
  deps(updatecli): bump all policies (elastic#130)
  ci: use GitHub app for ephemeral tokens (elastic#129)
  Deprecate the `project-id` input in `google/auth` action. (elastic#124)
  deps(updatecli): bump all policies (elastic#122)
  chore: deps(oblt-cli): Bump oblt-cli version to 7.5.21 (elastic#121)
  build(deps): bump the github-actions group across 11 directories with 4 updates (elastic#125)
  github-action: use ephemeral tokens with the required permissions (elastic#113)
  feat(github): validate-comment (elastic#120)
  feat(pre-commit): migrate from apm-pipeline-library (elastic#119)
  deps(updatecli): bump all policies (elastic#117)
  feat(await-maven-artifact): migrate from https://github.com/elastic/apm-pipeline-library (elastic#118)
  Add `test-report` action (elastic#114)
  ...
@v1v
Copy link
Member

v1v commented Oct 21, 2025

I see something interesting here:

image

I wonder if we need to keep this as deprecated in this case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog:chore When you add a change that is not user-facing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants