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

"Application Imports" management page - initial implementation #88

Merged
merged 66 commits into from
Jul 15, 2022

Conversation

mturley
Copy link
Contributor

@mturley mturley commented Jun 23, 2022

Implements https://issues.redhat.com/projects/MTRHO/issues/MTRHO-11

Replacement for #76 to re-target main from my fork. Thanks so much for your work on this @seanforyou23, I'll get it over the finish line now 😄

This PR adds a new page to the console called "Application Imports" (for now; all of this terminology is temporary). This page provides:

  • A minimal summary of the Pipelines and PipelineRuns created by our import wizard, grouped into tabs if the wizard has been used more than once.
  • A minimal history of the PipelineRuns of the selected group, with trivial status and links to the PipelineRun page for more detailed status.
  • Buttons to more easily start a Stage or a Cutover, which will either remove the pending status on a PipelineRun or generate a new PipelineRun if no pending one exists for that action.
  • A top-level Delete action (in a kebab menu) that will delete all the Pipelines and PipelineRuns in the selected group, by deleting the Cutover Pipeline (all other resources have ownerReferences to the cutover pipeline of their group).

Under the hood, this PR introduces a new concept called "Pipeline groups" which does not necessarily need to be exposed to the user. A "pipeline group", or a single "application import", is made up of all of the Pipelines and PipelineRuns that were generated by one usage of the import wizard. A group will always have one cutover pipeline (the primary resource), and may have 0 or 1 stage pipelines, and at least 1 PipelineRun for each pipeline. The following annotations are attached to every Pipeline and PipelineRun generated by the wizard, to facilitate this:

  • crane-ui-plugin.konveyor.io/action, with value either 'stage' or 'cutover'
  • crane-ui-plugin.konveyor.io/group, with a string value provided by the user as a name for this group of pipelines. The same string is also used as a prefix for the names of all Pipelines and PipelineRuns in the group.

The useWatchCranePipelineGroups hook at src/api/queries/pipelines.ts assembles these groups from socket-watched arrays of all Pipelines and PipelineRuns in the namespace. Each of them is returned as a CranePipelineGroup object which have conveniently indexed properties, and this is the single object passed around all the components of this page.

export interface CranePipelineGroup {
  name: string;
  pipelines: {
    stage: CranePipeline | null;
    cutover: CranePipeline;
  };
  pipelineRuns: {
    stage: CranePipelineRun[];
    cutover: CranePipelineRun[];
    all: CranePipelineRun[];
    nonPending: CranePipelineRun[];
    latestNonPending: CranePipelineRun | null;
  };
}

You can also see here that the CranePipeline and CranePipelineRun types have been added. These are just supersets of the PipelineKind and PipelineRunKind types with our new action and group annotations on them for typechecking and autocomplete purposes.

The page requires a project/namespace to be selected before reaching it (eventually we will be able to streamline this like the Add page and Pipelines pages do in the developer console, but that requires new features in the plugin SDK. See openshift/console#11823). If you reach the page without a selected project it will direct you to the Projects page.

If you reach the page before reaching the wizard, an EmptyState screen will direct you to the wizard. There is also a "start a new import" button in the corner to more easily reach the wizard later.

This PR duplicates a small amount of code from the Console Pipelines UI, the pipelineRunStatus function in the src/reused/pipelines-plugin/src/utils/pipeline-filter-reducer.ts file (source copied from https://github.com/openshift/console/blob/master/frontend/packages/pipelines-plugin/src/utils/pipeline-filter-reducer.ts). This allows us to determine the status of a PipelineRun to show in our UI, and like the pipeline visualization and types we have also duplicated in src/reused/* we should be sure to keep it up to date and eventually see if we can remove it and consume this code directly from the console some other way.

This PR does not include some additional enhancements including updating secrets and small polish items like confirmation dialogs. I'll open issues for those shortly.

Screens

Empty state when the wizard has not been used yet
Screen Shot 2022-07-14 at 2 02 57 PM

No tabs present when there is only one pipeline group (stage and cutover buttons are visible because this one is a stateful migration with PVCs selected)
Screen Shot 2022-07-14 at 2 03 32 PM

Tabs shown when there are more than one group (no stage button visible because this one is a stateless migration with no PVCs)
Screen Shot 2022-07-14 at 2 04 03 PM

History after running some Stage / Cutover PipelineRuns (failing in my test case, but status will match status shown on PipelineRuns page)
Screen Shot 2022-07-14 at 4 33 57 PM

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 23, 2022
@openshift-ci
Copy link

openshift-ci bot commented Jun 23, 2022

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 23, 2022
@mturley mturley mentioned this pull request Jun 23, 2022
@mturley mturley changed the title Pipeline management page [WIP] Pipeline management page - initial implementation Jul 14, 2022
@mturley mturley changed the title Pipeline management page - initial implementation "Application Imports" management page - initial implementation Jul 14, 2022
@mturley mturley marked this pull request as ready for review July 14, 2022 18:15
@mturley mturley requested a review from a team July 14, 2022 18:15
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 14, 2022
@openshift-ci openshift-ci bot requested a review from jmontleon July 14, 2022 18:15
@mturley mturley requested a review from ibolton336 July 14, 2022 18:15
@mturley
Copy link
Contributor Author

mturley commented Jul 14, 2022

/retest

Copy link
Contributor

@ibolton336 ibolton336 left a comment

Choose a reason for hiding this comment

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

LGTM - Great work Mike!

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jul 15, 2022
@openshift-ci
Copy link

openshift-ci bot commented Jul 15, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ibolton336, mturley

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot merged commit 1c13eda into migtools:main Jul 15, 2022
@mturley mturley deleted the console-imports-page branch July 15, 2022 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants