Use 'buildkit' as default scope (#516)

This PR updates the schema to use the correct default value for `scope`
in the GHA caching options. This should be effectively a no-op.


From: https://docs.docker.com/build/cache/backends/gha/

<img width="892" alt="image"
src="https://github.com/user-attachments/assets/690cde79-e30e-4085-81fd-1c9dc1c6d7e9"
/>


Closes #496
This commit is contained in:
Eron Wright
2025-04-09 14:01:21 -07:00
committed by GitHub
parent 706136a454
commit 780fe97f99
13 changed files with 28 additions and 53 deletions

View File

@@ -54,7 +54,7 @@ namespace Pulumi.DockerBuild.Inputs
public CacheFromGitHubActionsArgs()
{
Scope = Utilities.GetEnv("buildkit") ?? "";
Scope = "buildkit";
Token = Utilities.GetEnv("ACTIONS_RUNTIME_TOKEN") ?? "";
Url = Utilities.GetEnv("ACTIONS_CACHE_URL") ?? "";
}

View File

@@ -68,7 +68,7 @@ namespace Pulumi.DockerBuild.Inputs
{
IgnoreError = false;
Mode = Pulumi.DockerBuild.CacheMode.Min;
Scope = Utilities.GetEnv("buildkit") ?? "";
Scope = "buildkit";
Token = Utilities.GetEnv("ACTIONS_RUNTIME_TOKEN") ?? "";
Url = Utilities.GetEnv("ACTIONS_CACHE_URL") ?? "";
}

View File

@@ -862,10 +862,8 @@ func (val *CacheFromGitHubActions) Defaults() *CacheFromGitHubActions {
}
tmp := *val
if tmp.Scope == nil {
if d := internal.GetEnvOrDefault("", nil, "buildkit"); d != nil {
scope_ := d.(string)
tmp.Scope = &scope_
}
scope_ := "buildkit"
tmp.Scope = &scope_
}
if tmp.Token == nil {
if d := internal.GetEnvOrDefault("", nil, "ACTIONS_RUNTIME_TOKEN"); d != nil {
@@ -921,9 +919,7 @@ func (val *CacheFromGitHubActionsArgs) Defaults() *CacheFromGitHubActionsArgs {
}
tmp := *val
if tmp.Scope == nil {
if d := internal.GetEnvOrDefault("", nil, "buildkit"); d != nil {
tmp.Scope = pulumi.StringPtr(d.(string))
}
tmp.Scope = pulumi.StringPtr("buildkit")
}
if tmp.Token == nil {
if d := internal.GetEnvOrDefault("", nil, "ACTIONS_RUNTIME_TOKEN"); d != nil {
@@ -2405,10 +2401,8 @@ func (val *CacheToGitHubActions) Defaults() *CacheToGitHubActions {
tmp.Mode = &mode_
}
if tmp.Scope == nil {
if d := internal.GetEnvOrDefault("", nil, "buildkit"); d != nil {
scope_ := d.(string)
tmp.Scope = &scope_
}
scope_ := "buildkit"
tmp.Scope = &scope_
}
if tmp.Token == nil {
if d := internal.GetEnvOrDefault("", nil, "ACTIONS_RUNTIME_TOKEN"); d != nil {
@@ -2474,9 +2468,7 @@ func (val *CacheToGitHubActionsArgs) Defaults() *CacheToGitHubActionsArgs {
tmp.Mode = CacheMode("min")
}
if tmp.Scope == nil {
if d := internal.GetEnvOrDefault("", nil, "buildkit"); d != nil {
tmp.Scope = pulumi.StringPtr(d.(string))
}
tmp.Scope = pulumi.StringPtr("buildkit")
}
if tmp.Token == nil {
if d := internal.GetEnvOrDefault("", nil, "ACTIONS_RUNTIME_TOKEN"); d != nil {

View File

@@ -421,10 +421,8 @@ func (val *CacheFromGitHubActions) Defaults() *CacheFromGitHubActions {
}
tmp := *val
if tmp.Scope == nil {
if d := internal.GetEnvOrDefault("", nil, "buildkit"); d != nil {
scope_ := d.(string)
tmp.Scope = &scope_
}
scope_ := "buildkit"
tmp.Scope = &scope_
}
if tmp.Token == nil {
if d := internal.GetEnvOrDefault("", nil, "ACTIONS_RUNTIME_TOKEN"); d != nil {
@@ -469,9 +467,7 @@ func (val *CacheFromGitHubActionsArgs) Defaults() *CacheFromGitHubActionsArgs {
}
tmp := *val
if tmp.Scope == nil {
if d := internal.GetEnvOrDefault("", nil, "buildkit"); d != nil {
tmp.Scope = pulumix.Ptr(d.(string))
}
tmp.Scope = pulumix.Ptr("buildkit")
}
if tmp.Token == nil {
if d := internal.GetEnvOrDefault("", nil, "ACTIONS_RUNTIME_TOKEN"); d != nil {
@@ -1178,10 +1174,8 @@ func (val *CacheToGitHubActions) Defaults() *CacheToGitHubActions {
tmp.Mode = &mode_
}
if tmp.Scope == nil {
if d := internal.GetEnvOrDefault("", nil, "buildkit"); d != nil {
scope_ := d.(string)
tmp.Scope = &scope_
}
scope_ := "buildkit"
tmp.Scope = &scope_
}
if tmp.Token == nil {
if d := internal.GetEnvOrDefault("", nil, "ACTIONS_RUNTIME_TOKEN"); d != nil {
@@ -1236,9 +1230,7 @@ func (val *CacheToGitHubActionsArgs) Defaults() *CacheToGitHubActionsArgs {
tmp.Mode = pulumix.Ptr(CacheMode("min"))
}
if tmp.Scope == nil {
if d := internal.GetEnvOrDefault("", nil, "buildkit"); d != nil {
tmp.Scope = pulumix.Ptr(d.(string))
}
tmp.Scope = pulumix.Ptr("buildkit")
}
if tmp.Token == nil {
if d := internal.GetEnvOrDefault("", nil, "ACTIONS_RUNTIME_TOKEN"); d != nil {

View File

@@ -199,7 +199,7 @@ public final class CacheFromGitHubActionsArgs extends com.pulumi.resources.Resou
}
public CacheFromGitHubActionsArgs build() {
$.scope = Codegen.stringProp("scope").output().arg($.scope).env("buildkit").def("").getNullable();
$.scope = Codegen.stringProp("scope").output().arg($.scope).def("buildkit").getNullable();
$.token = Codegen.stringProp("token").secret().arg($.token).env("ACTIONS_RUNTIME_TOKEN").def("").getNullable();
$.url = Codegen.stringProp("url").output().arg($.url).env("ACTIONS_CACHE_URL").def("").getNullable();
return $;

View File

@@ -277,7 +277,7 @@ public final class CacheToGitHubActionsArgs extends com.pulumi.resources.Resourc
public CacheToGitHubActionsArgs build() {
$.ignoreError = Codegen.booleanProp("ignoreError").output().arg($.ignoreError).def(false).getNullable();
$.mode = Codegen.objectProp("mode", CacheMode.class).output().arg($.mode).def(CacheMode.Min).getNullable();
$.scope = Codegen.stringProp("scope").output().arg($.scope).env("buildkit").def("").getNullable();
$.scope = Codegen.stringProp("scope").output().arg($.scope).def("buildkit").getNullable();
$.token = Codegen.stringProp("token").secret().arg($.token).env("ACTIONS_RUNTIME_TOKEN").def("").getNullable();
$.url = Codegen.stringProp("url").output().arg($.url).env("ACTIONS_CACHE_URL").def("").getNullable();
return $;

View File

@@ -136,7 +136,7 @@ export interface CacheFromGitHubActionsArgs {
export function cacheFromGitHubActionsArgsProvideDefaults(val: CacheFromGitHubActionsArgs): CacheFromGitHubActionsArgs {
return {
...val,
scope: (val.scope) ?? (utilities.getEnv("buildkit") || ""),
scope: (val.scope) ?? "buildkit",
token: (val.token) ?? (utilities.getEnv("ACTIONS_RUNTIME_TOKEN") || ""),
url: (val.url) ?? (utilities.getEnv("ACTIONS_CACHE_URL") || ""),
};
@@ -345,7 +345,7 @@ export function cacheToGitHubActionsArgsProvideDefaults(val: CacheToGitHubAction
...val,
ignoreError: (val.ignoreError) ?? false,
mode: (val.mode) ?? "min",
scope: (val.scope) ?? (utilities.getEnv("buildkit") || ""),
scope: (val.scope) ?? "buildkit",
token: (val.token) ?? (utilities.getEnv("ACTIONS_RUNTIME_TOKEN") || ""),
url: (val.url) ?? (utilities.getEnv("ACTIONS_CACHE_URL") || ""),
};

View File

@@ -136,7 +136,7 @@ export interface CacheFromGitHubActions {
export function cacheFromGitHubActionsProvideDefaults(val: CacheFromGitHubActions): CacheFromGitHubActions {
return {
...val,
scope: (val.scope) ?? (utilities.getEnv("buildkit") || ""),
scope: (val.scope) ?? "buildkit",
token: (val.token) ?? (utilities.getEnv("ACTIONS_RUNTIME_TOKEN") || ""),
url: (val.url) ?? (utilities.getEnv("ACTIONS_CACHE_URL") || ""),
};
@@ -345,7 +345,7 @@ export function cacheToGitHubActionsProvideDefaults(val: CacheToGitHubActions):
...val,
ignoreError: (val.ignoreError) ?? false,
mode: (val.mode) ?? "min",
scope: (val.scope) ?? (utilities.getEnv("buildkit") || ""),
scope: (val.scope) ?? "buildkit",
token: (val.token) ?? (utilities.getEnv("ACTIONS_RUNTIME_TOKEN") || ""),
url: (val.url) ?? (utilities.getEnv("ACTIONS_CACHE_URL") || ""),
};

View File

@@ -332,7 +332,7 @@ class CacheFromGitHubActionsArgs:
environment variable to your jobs.
"""
if scope is None:
scope = (_utilities.get_env('buildkit') or '')
scope = 'buildkit'
if scope is not None:
pulumi.set(__self__, "scope", scope)
if token is None:
@@ -1048,7 +1048,7 @@ class CacheToGitHubActionsArgs:
if mode is not None:
pulumi.set(__self__, "mode", mode)
if scope is None:
scope = (_utilities.get_env('buildkit') or '')
scope = 'buildkit'
if scope is not None:
pulumi.set(__self__, "scope", scope)
if token is None:

View File

@@ -315,7 +315,7 @@ class CacheFromGitHubActions(dict):
environment variable to your jobs.
"""
if scope is None:
scope = (_utilities.get_env('buildkit') or '')
scope = 'buildkit'
if scope is not None:
pulumi.set(__self__, "scope", scope)
if token is None:
@@ -835,7 +835,7 @@ class CacheToGitHubActions(dict):
if mode is not None:
pulumi.set(__self__, "mode", mode)
if scope is None:
scope = (_utilities.get_env('buildkit') or '')
scope = 'buildkit'
if scope is not None:
pulumi.set(__self__, "scope", scope)
if token is None: