Skip to content

Commit e6ab39b

Browse files
s/PulumiProject/ProjectName
1 parent 05537a5 commit e6ab39b

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

src/pkg/cli/client/byoc/aws/byoc.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ func (b *ByocAws) environment() map[string]string {
316316
"DEFANG_ORG": b.TenantID,
317317
"DOMAIN": b.ProjectDomain,
318318
"PRIVATE_DOMAIN": b.PrivateDomain,
319-
"PROJECT": b.PulumiProject, // may be empty
319+
"PROJECT": b.ProjectName, // may be empty
320320
"PULUMI_BACKEND_URL": fmt.Sprintf(`s3://%s?region=%s&awssdk=v2`, b.bucketName(), region),
321321
"PULUMI_CONFIG_PASSPHRASE": pkg.Getenv("PULUMI_CONFIG_PASSPHRASE", "asdf"), // TODO: make customizable
322322
"STACK": b.PulumiStack,
@@ -356,8 +356,8 @@ func (b *ByocAws) Delete(ctx context.Context, req *defangv1.DeleteRequest) (*def
356356

357357
// stackDir returns a stack-qualified path, like the Pulumi TS function `stackDir`
358358
func (b *ByocAws) stackDir(name string) string {
359-
ensure(b.PulumiProject != "", "pulumiProject not set")
360-
return fmt.Sprintf("/%s/%s/%s/%s", byoc.DefangPrefix, b.PulumiProject, b.PulumiStack, name) // same as shared/common.ts
359+
ensure(b.ProjectName != "", "pulumiProject not set")
360+
return fmt.Sprintf("/%s/%s/%s/%s", byoc.DefangPrefix, b.ProjectName, b.PulumiStack, name) // same as shared/common.ts
361361
}
362362

363363
func (b *ByocAws) GetServices(ctx context.Context) (*defangv1.ListServicesResponse, error) {
@@ -376,8 +376,8 @@ func (b *ByocAws) GetServices(ctx context.Context) (*defangv1.ListServicesRespon
376376

377377
s3Client := s3.NewFromConfig(cfg)
378378
// Path to the state file, Defined at: https://github.com/DefangLabs/defang-mvp/blob/main/pulumi/cd/byoc/aws/index.ts#L89
379-
ensure(b.PulumiProject != "", "pulumiProject not set")
380-
path := fmt.Sprintf("projects/%s/%s/project.pb", b.PulumiProject, b.PulumiStack)
379+
ensure(b.ProjectName != "", "ProjectName not set")
380+
path := fmt.Sprintf("projects/%s/%s/project.pb", b.ProjectName, b.PulumiStack)
381381

382382
term.Debug("Getting services from bucket:", bucketName, path)
383383
getObjectOutput, err := s3Client.GetObject(ctx, &s3.GetObjectInput{
@@ -518,11 +518,11 @@ func (b *ByocAws) update(ctx context.Context, service *defangv1.Service) (*defan
518518
return nil, fmt.Errorf("missing config %q", missing) // retryable CodeFailedPrecondition
519519
}
520520

521-
ensure(b.PulumiProject != "", "pulumiProject not set")
521+
ensure(b.ProjectName != "", "ProjectName not set")
522522
si := &defangv1.ServiceInfo{
523523
Service: service,
524-
Project: b.PulumiProject, // was: tenant
525-
Etag: pkg.RandomID(), // TODO: could be hash for dedup/idempotency
524+
Project: b.ProjectName, // was: tenant
525+
Etag: pkg.RandomID(), // TODO: could be hash for dedup/idempotency
526526
}
527527

528528
hasHost := false
@@ -636,10 +636,10 @@ func (b *ByocAws) getPrivateFqdn(fqn qualifiedName) string {
636636
}
637637

638638
func (b *ByocAws) getProjectDomain(zone string) string {
639-
if b.PulumiProject == "" {
639+
if b.ProjectName == "" {
640640
return "" // no project name => no custom domain
641641
}
642-
projectLabel := byoc.DnsSafeLabel(b.PulumiProject)
642+
projectLabel := byoc.DnsSafeLabel(b.ProjectName)
643643
if projectLabel == byoc.DnsSafeLabel(b.TenantID) {
644644
return byoc.DnsSafe(zone) // the zone will already have the tenant ID
645645
}

src/pkg/cli/client/byoc/baseclient.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ type ByocBaseClient struct {
4949
PrivateLbIps []string // TODO: use API to get these
5050
PrivateNatIps []string // TODO: use API to get these
5151
ProjectDomain string
52-
PulumiProject string
52+
ProjectName string
5353
PulumiStack string
5454
Quota quota.Quotas
5555
SetupDone bool
@@ -62,10 +62,10 @@ type ByocBaseClient struct {
6262

6363
func NewByocBaseClient(ctx context.Context, grpcClient client.GrpcClient, tenantID types.TenantID, bl BootstrapLister) *ByocBaseClient {
6464
b := &ByocBaseClient{
65-
GrpcClient: grpcClient,
66-
TenantID: string(tenantID),
67-
PulumiProject: "", // To be overwritten by LoadProject
68-
PulumiStack: "beta", // TODO: make customizable
65+
GrpcClient: grpcClient,
66+
TenantID: string(tenantID),
67+
ProjectName: "", // To be overwritten by LoadProject
68+
PulumiStack: "beta", // TODO: make customizable
6969
Quota: quota.Quotas{
7070
// These serve mostly to pevent fat-finger errors in the CLI or Compose files
7171
ServiceQuotas: quota.ServiceQuotas{
@@ -88,7 +88,7 @@ func NewByocBaseClient(ctx context.Context, grpcClient client.GrpcClient, tenant
8888
return nil, err
8989
}
9090
b.PrivateDomain = DnsSafeLabel(proj.Name) + ".internal"
91-
b.PulumiProject = proj.Name
91+
b.ProjectName = proj.Name
9292
return proj, nil
9393
})
9494
return b
@@ -111,7 +111,7 @@ func (b *ByocBaseClient) LoadProjectName(ctx context.Context) (string, error) {
111111

112112
proj, err := b.loadProjOnce()
113113
if err == nil {
114-
b.PulumiProject = proj.Name
114+
b.ProjectName = proj.Name
115115
return proj.Name, nil
116116
}
117117
if !errors.Is(err, types.ErrComposeFileNotFound) {
@@ -132,7 +132,7 @@ func (b *ByocBaseClient) LoadProjectName(ctx context.Context) (string, error) {
132132
}
133133
if len(projectNames) == 1 {
134134
term.Debug("Using default project: ", projectNames[0])
135-
b.PulumiProject = projectNames[0]
135+
b.ProjectName = projectNames[0]
136136
return projectNames[0], nil
137137
}
138138

@@ -142,7 +142,7 @@ func (b *ByocBaseClient) LoadProjectName(ctx context.Context) (string, error) {
142142
return "", fmt.Errorf("project %q specified by COMPOSE_PROJECT_NAME not found", projectName)
143143
}
144144
term.Debug("Using project from COMPOSE_PROJECT_NAME environment variable:", projectNames[0])
145-
b.PulumiProject = projectName
145+
b.ProjectName = projectName
146146
return projectName, nil
147147
}
148148

src/pkg/cli/client/byoc/do/byoc.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ func (b *ByocDo) environment() map[string]string {
235235
"DEFANG_ORG": b.TenantID,
236236
"DOMAIN": b.ProjectDomain,
237237
"PRIVATE_DOMAIN": b.PrivateDomain,
238-
"PROJECT": b.PulumiProject,
238+
"PROJECT": b.ProjectName,
239239
"PULUMI_BACKEND_URL": fmt.Sprintf(`s3://%s.digitaloceanspaces.com/%s`, region, b.driver.BucketName), // TODO: add a way to override bucket
240240
"PULUMI_CONFIG_PASSPHRASE": pkg.Getenv("PULUMI_CONFIG_PASSPHRASE", "asdf"), // TODO: make customizable
241241
"STACK": b.PulumiStack,
@@ -251,7 +251,7 @@ func (b *ByocDo) update(ctx context.Context, service *defangv1.Service) (*defang
251251

252252
si := &defangv1.ServiceInfo{
253253
Service: service,
254-
Project: b.PulumiProject,
254+
Project: b.ProjectName,
255255
Etag: pkg.RandomID(),
256256
}
257257

0 commit comments

Comments
 (0)