Skip to content

Conversation

svenefftinge
Copy link
Contributor

@svenefftinge svenefftinge commented Feb 7, 2023

Description

This PR introduces a long-running migration and small service that manages and executes it.

This relies on new workspaces getting an organizationId see #16261

Related Issue(s)

See #16177

How to test

Release Notes

NONE

Documentation

Build Options:

  • /werft with-github-actions
    Experimental feature to run the build with GitHub Actions (and not in Werft).
  • leeway-no-cache
    leeway-target=components:all
  • /werft no-test
    Run Leeway with --dont-test
  • /werft publish-to-npm

Preview Environment Options:

  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-gce-vm
    If enabled this will create the environment on GCE infra
  • /werft with-integration-tests=all
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh

@svenefftinge svenefftinge changed the base branch from main to se/workspace-gets-orgid February 7, 2023 14:50
@roboquat roboquat added size/L and removed size/XL labels Feb 7, 2023
@svenefftinge svenefftinge force-pushed the se/migration-orgid-ws branch from 8255076 to 9751876 Compare February 8, 2023 16:07
@roboquat roboquat added size/XL and removed size/L labels Feb 8, 2023
@svenefftinge svenefftinge changed the title Se/migration-orgid-ws [db] long running migration for filling the organizationid in workspaces Feb 8, 2023
@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-se-migration-orgid-ws.2 because the annotations in the pull request description changed
(with .werft/ from main)

@svenefftinge
Copy link
Contributor Author

svenefftinge commented Feb 9, 2023

/werft run with-clean-slate-deployment

👍 started the job as gitpod-build-se-migration-orgid-ws.3
(with .werft/ from main)

@svenefftinge
Copy link
Contributor Author

/hold

@svenefftinge svenefftinge marked this pull request as ready for review February 9, 2023 09:32
@svenefftinge svenefftinge requested a review from a team February 9, 2023 09:32
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Feb 9, 2023
@svenefftinge svenefftinge force-pushed the se/workspace-gets-orgid branch 2 times, most recently from d3b0ed9 to 4de3f40 Compare February 9, 2023 12:11
@svenefftinge svenefftinge force-pushed the se/migration-orgid-ws branch from 9751876 to 4bf7d78 Compare February 9, 2023 12:14
Base automatically changed from se/workspace-gets-orgid to main February 9, 2023 14:55
@roboquat roboquat added size/XXL and removed size/XL labels Feb 9, 2023
@svenefftinge svenefftinge force-pushed the se/migration-orgid-ws branch from 4bf7d78 to da771a6 Compare February 9, 2023 15:40
@roboquat roboquat added size/XL and removed size/XXL labels Feb 9, 2023
Comment on lines +61 to +77
log.info(`Running long running migration '${migration.getName()}' ...`);
const now = new Date();
try {
const completed = await migration.runMigrationBatch();
log.info(
`Long running migration ${migration.getName()} took ${new Date().getTime() - now.getTime()}ms`,
{ completed },
);
migrationMetaData.completed = completed;
} catch (e) {
log.error(`Long running migration ${migration.getName()} failed`, e);
}
allCompleted = allCompleted && migrationMetaData.completed;
migrationMetaData.lastRun = new Date();
await repo.save(migrationMetaData);
}
return allCompleted;
Copy link
Member

Choose a reason for hiding this comment

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

As a follow-up, it would be nice to export a metric if the batch+job failed, or succeeded such that we can check, or setup alerting for these. This would be in particular useful for Dedicated, where we don't have access to logs.

@svenefftinge
Copy link
Contributor Author

/unhold

@roboquat roboquat merged commit df16e84 into main Feb 10, 2023
@roboquat roboquat deleted the se/migration-orgid-ws branch February 10, 2023 08:35
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: webapp Meta team change is running in production deployed Change is completely running in production release-note-none size/XL team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants