-
Notifications
You must be signed in to change notification settings - Fork 7
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
Clean up outdated applications (bootstrap-pull-request) #1189
Conversation
27427b2
to
d174cf5
Compare
const readContentOrNull = async (f: string): Promise<string | null> => | ||
await catchENOENT(async () => (await fs.readFile(f)).toString()) | ||
|
||
const catchENOENT = async <T>(f: () => Promise<T>): Promise<T | null> => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactoring to extract catch
.
|
||
const readContent = async (filename: string) => (await fs.readFile(filename)).toString() | ||
|
||
describe('copyServicesFromPrebuilt', () => { | ||
const createEmptyDirectory = async () => await fs.mkdtemp(path.join(os.tmpdir(), 'bootstrap-pull-request-')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactoring to extract the common function.
// deleteExistingApplications() deletes the existing applications, and then | ||
// copyServicesFromPrebuilt() recreates the applications. | ||
await deleteExistingApplications(inputs) | ||
await copyServicesFromPrebuilt(inputs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copyServicesFromPrebuilt
is the original function.
In this pull request, I have added deleteExistingApplications
.
Problem to solve
When a service has been removed from the prebuilt branch, it will remain in the existing namespace branches. It may waste the infrastructure cost.
For example,
How to solve
Clean up the outdated applications before copying the services.