-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cloud Build requires bucket object to have "zip" extension #729
Comments
An additional problem happens when you use Ideally, it should be possible to augment the way Pulumi deducts the |
I can backup both of these points from my experience |
Jesus, thank you. I spent hours on this :) |
It looks like we addressed the zip part in the documentation. However is the second part of the FileAsset still a problem? I wrote a small test app, would yall try this and let me know if it works so that I can update the documentation: import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
import * as fs from "fs";
import * as crypto from "crypto";
const customServiceAccount = new gcp.serviceaccount.Account("custom_service_account", {
accountId: "my-account",
displayName: "Custom Service Account",
});
const gaeApi = new gcp.projects.IAMMember("gae_api", {
project: customServiceAccount.project,
role: "roles/compute.networkUser",
member: pulumi.interpolate`serviceAccount:${customServiceAccount.email}`,
});
const storageViewer = new gcp.projects.IAMMember("storage_viewer", {
project: customServiceAccount.project,
role: "roles/storage.objectViewer",
member: pulumi.interpolate`serviceAccount:${customServiceAccount.email}`,
});
const bucket = new gcp.storage.Bucket("appengine-static-content", {
location: "US",
});
// Read the file content
const filePath = "./test-fixtures/hello-world.zip";
const fileContent = fs.readFileSync(filePath, "utf-8");
// Generate SHA-256 hash of the file content
const hash = crypto.createHash('sha256').update(fileContent).digest('hex');
const object = new gcp.storage.BucketObject("object", {
name: "hello-world.zip",
bucket: bucket.name,
source: new pulumi.asset.FileAsset(filePath),
metadata: {
"content-hash": hash
}
});
const myappDefault = new gcp.appengine.StandardAppVersion("myapp_default", {
versionId: `v${hash.substring(0, 25)}`,
service: "default",
runtime: "nodejs20",
entrypoint: {
shell: "node ./app.js",
},
deployment: {
zip: {
sourceUrl: pulumi.interpolate`https://storage.googleapis.com/${bucket.name}/${object.name}`,
},
},
envVariables: {
port: "8080",
},
automaticScaling: {
maxConcurrentRequests: 10,
minIdleInstances: 1,
maxIdleInstances: 3,
minPendingLatency: "1s",
maxPendingLatency: "5s",
standardSchedulerSettings: {
targetCpuUtilization: 0.5,
targetThroughputUtilization: 0.75,
minInstances: 2,
maxInstances: 10,
},
},
deleteServiceOnDestroy: true,
serviceAccount: customServiceAccount.email,
});
const myappV1 = new gcp.appengine.StandardAppVersion("myapp_v1", {
versionId: `v${hash.substring(0, 25)}`,
service: "myapp",
runtime: "nodejs20",
entrypoint: {
shell: "node ./app.js",
},
deployment: {
zip: {
sourceUrl: pulumi.interpolate`https://storage.googleapis.com/${bucket.name}/${object.name}`,
},
},
envVariables: {
port: "8080",
},
automaticScaling: {
maxConcurrentRequests: 10,
minIdleInstances: 1,
maxIdleInstances: 3,
minPendingLatency: "1s",
maxPendingLatency: "5s",
standardSchedulerSettings: {
targetCpuUtilization: 0.5,
targetThroughputUtilization: 0.75,
minInstances: 2,
maxInstances: 10,
},
},
deleteServiceOnDestroy: true,
serviceAccount: customServiceAccount.email,
}, { dependsOn: [myappDefault] }); |
File: themes/default/content/registry/packages/gcp/api-docs/appengine/standardappversion/_index.md
I've been facing a problem building a ZIP archive with Cloud Build for deploying
gcp.appengine.StandardAppVersion
. The closed issue in the Terraform GitHub explains the problem I've experienced and provides the solution.Current code example in Pulumi bears the issue. In order to fix it, the small adjustment must be applied to the code sample:
Here's an excerpt of the the Cloud Build failing build log:
The text was updated successfully, but these errors were encountered: