Skip to content

add google cloud build envs#1031

Merged
trunk-io[bot] merged 1 commit intomainfrom
dylan/add-support-for-google-cloud-build
Feb 5, 2026
Merged

add google cloud build envs#1031
trunk-io[bot] merged 1 commit intomainfrom
dylan/add-support-for-google-cloud-build

Conversation

@dfrankland
Copy link
Member

@dfrankland dfrankland commented Feb 5, 2026

Took some diffing to figure this one out
https://docs.cloud.google.com/build/docs/configuring-builds/substitute-variable-values

Also, these are not automatically provided. We'll have to guide users to passing the necessary env vars 😬

Google Cloud Build setup is very involved, so I haven't attempted at setting this up myself.

@trunk-io
Copy link

trunk-io bot commented Feb 5, 2026

😎 Merged directly without going through the merge queue, as the queue was empty and the PR was up to date with the target branch - details.

@dfrankland dfrankland force-pushed the dylan/add-support-for-google-cloud-build branch from b9d0d06 to 57923f5 Compare February 5, 2026 05:45
@codecov-commenter
Copy link

codecov-commenter commented Feb 5, 2026

Codecov Report

❌ Patch coverage is 91.30435% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.67%. Comparing base (55a2cf8) to head (1d1d689).

Files with missing lines Patch % Lines
context/src/env/parser.rs 91.30% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1031      +/-   ##
==========================================
+ Coverage   81.39%   81.67%   +0.27%     
==========================================
  Files          69       69              
  Lines       14547    14566      +19     
==========================================
+ Hits        11841    11897      +56     
+ Misses       2706     2669      -37     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@trunk-staging-io
Copy link

trunk-staging-io bot commented Feb 5, 2026

Static BadgeStatic BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@dfrankland dfrankland force-pushed the dylan/add-support-for-google-cloud-build branch from 57923f5 to 1d1d689 Compare February 5, 2026 06:21
Comment on lines +122 to +125
(CIPlatform::GoogleCloudBuild, CIPlatform::JenkinsPipeline)
| (CIPlatform::JenkinsPipeline, CIPlatform::GoogleCloudBuild) => {
CIPlatform::GoogleCloudBuild
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Because either Jekins or Google Cloud Build may provide BUILD_ID we need to prioritize Google Cloud Build if we detect it

Copy link
Contributor

Choose a reason for hiding this comment

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

IIUC the CIPlatform will only be anything other than Unknown if the current env var we're interrogating / trying to prioritize off of is a ci_platform_env_key (based on the CIPlatform::from() here) - which only Jenkins's ci_platform_env_key is BUILD_ID. So perhaps this isn't explicitly needed? Or I'm misinterpreting

Copy link
Member Author

Choose a reason for hiding this comment

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

The problem is that we don't guarantee the order of env vars we receive. So we could get BUILD_ID before TRIGGER_NAME. If we get both, then we need to decide which one to use: in the case of Jenkins and Google Cloud Build, Google Cloud Build can have BUILD_ID, but Jenkins will not have TRIGGER_NAME, so it's easy to prioritize Google Cloud Build

Copy link
Member Author

@dfrankland dfrankland Feb 5, 2026

Choose a reason for hiding this comment

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

Also, my test would fail without this 😝

Comment on lines +44 to +45
/// https://docs.cloud.google.com/build/docs/configuring-builds/substitute-variable-values
pub const GOOGLE_CLOUD_BUILD: &str = "TRIGGER_NAME";
Copy link
Member Author

Choose a reason for hiding this comment

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

Google Cloud Build doesn't have any built-in, default provided env vars. This seemed like the most unique and one that is always available (since this is how you trigger a build)

@trunk-io
Copy link

trunk-io bot commented Feb 5, 2026

Static BadgeStatic BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

Comment on lines +122 to +125
(CIPlatform::GoogleCloudBuild, CIPlatform::JenkinsPipeline)
| (CIPlatform::JenkinsPipeline, CIPlatform::GoogleCloudBuild) => {
CIPlatform::GoogleCloudBuild
}
Copy link
Contributor

Choose a reason for hiding this comment

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

IIUC the CIPlatform will only be anything other than Unknown if the current env var we're interrogating / trying to prioritize off of is a ci_platform_env_key (based on the CIPlatform::from() here) - which only Jenkins's ci_platform_env_key is BUILD_ID. So perhaps this isn't explicitly needed? Or I'm misinterpreting

@trunk-io trunk-io bot merged commit 90c3482 into main Feb 5, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants