Skip to content

Conversation

@stephencompall-DA
Copy link
Contributor

@stephencompall-DA stephencompall-DA commented Jun 16, 2025

Also adds more logging so we can be sure what service account we're dealing with.

From an idea by @isegall-da as to how to avoid getting stuck with the default infra node pool SA and its scopes problems for -pub-replicate-slots on devnet/generally via pulumi operator.

Pull Request Checklist

Cluster Testing

  • If a cluster test is required, comment /cluster_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.
  • If a hard-migration test is required (from the latest release), comment /hdm_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.

PR Guidelines

  • Include any change that might be observable by our partners or affect their deployment in the release notes.
  • Specify fixed issues with Fixes #n, and mention issues worked on using #n
  • Include a screenshot for frontend-related PRs - see README or use your favorite screenshot tool

Merge Guidelines

  • Make the git commit message look sensible when squash-merging on GitHub (most likely: just copy your PR description).

Signed-off-by: Stephen Compall <stephen.compall@digitalasset.com>
@stephencompall-DA stephencompall-DA force-pushed the s11/explicit-login-for-gcp-pub-rep-slots-script branch from 1c00f2c to f84b283 Compare June 16, 2025 22:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the CloudSQL import process by leveraging GOOGLE_*_CREDENTIALS for authentication and adds additional logging for better traceability of service account usage.

  • Introduces logic to use GOOGLE_APPLICATION_CREDENTIALS or GOOGLE_CREDENTIALS if present
  • Adds logging for authentication steps and displays the current gcloud login
  • Enhances logging around temporary bucket creation, SQL upload, CloudSQL import, and cleanup

gcloud auth activate-service-account --key-file="$GOOGLE_APPLICATION_CREDENTIALS"
elif [ -n "$GOOGLE_CREDENTIALS" ]; then
echo "Using GOOGLE_CREDENTIALS for authentication"
echo "$GOOGLE_CREDENTIALS" | gcloud auth activate-service-account --key-file=-
Copy link

Copilot AI Jun 16, 2025

Choose a reason for hiding this comment

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

Using echo to pipe GOOGLE_CREDENTIALS may risk exposing sensitive information to stdout or logs. Consider securely passing the credentials (e.g., through a temporary file with appropriate permissions) to reduce potential security exposure.

Suggested change
echo "$GOOGLE_CREDENTIALS" | gcloud auth activate-service-account --key-file=-
TEMP_CREDENTIALS_FILE="$(mktemp)"
echo "$GOOGLE_CREDENTIALS" > "$TEMP_CREDENTIALS_FILE"
chmod 600 "$TEMP_CREDENTIALS_FILE"
gcloud auth activate-service-account --key-file="$TEMP_CREDENTIALS_FILE"
rm -f "$TEMP_CREDENTIALS_FILE"

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@isegall-da isegall-da left a comment

Choose a reason for hiding this comment

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

🤞 thanks

Signed-off-by: Stephen Compall <stephen.compall@digitalasset.com>
@stephencompall-DA stephencompall-DA marked this pull request as ready for review June 16, 2025 22:44
@stephencompall-DA stephencompall-DA enabled auto-merge (squash) June 16, 2025 22:55
@stephencompall-DA stephencompall-DA merged commit a10fd2c into main Jun 16, 2025
116 of 118 checks passed
@stephencompall-DA stephencompall-DA deleted the s11/explicit-login-for-gcp-pub-rep-slots-script branch June 16, 2025 23:49
stephencompall-DA added a commit that referenced this pull request Jun 16, 2025
Backport of #1136

Signed-off-by: Stephen Compall <stephen.compall@digitalasset.com>
stephencompall-DA added a commit that referenced this pull request Jun 17, 2025
Signed-off-by: Stephen Compall <stephen.compall@digitalasset.com>
stephencompall-DA added a commit that referenced this pull request Jun 18, 2025
* split off script

* support create/delete, invoke script from pulumi

* incorporate #1136 gcloud login/logging changes

* set -u and better quoting

---------

Signed-off-by: Stephen Compall <stephen.compall@digitalasset.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants