Skip to content
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

FAH bugfixes #6754

Merged
merged 2 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bugfixes to internal utilities (#6754)
4 changes: 2 additions & 2 deletions src/commands/apphosting-builds-create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ export const command = new Command("apphosting:builds:create <backendId>")
const buildId =
(options.buildId as string) ||
(await apphosting.getNextRolloutId(projectId, location, backendId));
const branch = options.branch as string;
const branch = (options.branch as string | undefined) ?? "main";
Copy link
Contributor

Choose a reason for hiding this comment

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

A really neat improvement to this would be to see if they have a RolloutPolicy and pull the "default" branch from there. But that can come later.

Copy link
Member Author

Choose a reason for hiding this comment

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

File a bug and assign it to me. I agree that would be much better, but IIRC rollouts is still an "internal tool" that hasn't gone through API review.


const op = await apphosting.createBuild(projectId, location, backendId, buildId, {
source: {
codebase: {
branch: "main",
branch,
},
},
});
Expand Down
2 changes: 1 addition & 1 deletion src/gcp/apphosting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@
done: boolean;
// oneof result
error?: Status;
response?: any;

Check warning on line 264 in src/gcp/apphosting.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
// end oneof result
}

Expand Down Expand Up @@ -463,7 +463,7 @@
// correct.
const trafficCopy = { ...traffic };
if ("rolloutPolicy" in traffic) {
trafficCopy.rolloutPolicy = {} as any;

Check warning on line 466 in src/gcp/apphosting.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value

Check warning on line 466 in src/gcp/apphosting.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
}
const fieldMasks = proto.fieldMasks(trafficCopy);
const queryParams = {
Expand Down Expand Up @@ -512,14 +512,14 @@
/**
* Ensure that Frameworks API is enabled on the project.
*/
export async function ensureApiEnabled(options: any): Promise<void> {

Check warning on line 515 in src/gcp/apphosting.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
const projectId = needProjectId(options);

Check warning on line 516 in src/gcp/apphosting.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe argument of type `any` assigned to a parameter of type `{ projectId?: string | undefined; project?: string | undefined; rc?: RC | undefined; }`
return await ensure(projectId, API_HOST, "frameworks", true);
}

/**
* Generates the next build ID to fit with the naming scheme of the backend API.
* @param counter Overrides the counter to use, avoiding an API call.

Check warning on line 522 in src/gcp/apphosting.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Expected @param names to be "projectId, location, backendId, counter". Got "counter"
*/
export async function getNextRolloutId(
projectId: string,
Expand All @@ -531,7 +531,7 @@
const year = date.getUTCFullYear();
// Note: month is 0 based in JS
const month = String(date.getUTCMonth() + 1).padStart(2, "0");
const day = String(date.getUTCDay()).padStart(2, "0");
const day = String(date.getUTCDate()).padStart(2, "0");

if (counter) {
return `build-${year}-${month}-${day}-${String(counter).padStart(3, "0")}`;
Expand Down
2 changes: 1 addition & 1 deletion src/test/gcp/apphosting.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe("apphosting", () => {
function idPrefix(date: Date): string {
const year = date.getUTCFullYear();
const month = String(date.getUTCMonth() + 1).padStart(2, "0");
const day = String(date.getUTCDay()).padStart(2, "0");
const day = String(date.getUTCDate()).padStart(2, "0");
return `build-${year}-${month}-${day}`;
}

Expand Down
Loading