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

add default workspace when auto starting pipeline from Add flow #7237

Merged

Conversation

karthikjeeyar
Copy link
Contributor

@karthikjeeyar karthikjeeyar commented Nov 17, 2020

Fixes:
https://issues.redhat.com/browse/ODC-5118

Analysis / Root cause:
As a user, when I'm getting my Pipeline Run auto-started off the add flow, I need a PVC volumeClaimTemplate otherwise my Pipeline Run doesn't successfully run.

Solution Description:

  1. Attach a default volumeClaimTemplate to the pipelineRun when auto starting a pipeline through the +Add flow with pipeline metadata label attached to it.
  2. Use the pipeline metadata label pre select the PVC in the Start pipeline modal and Add Trigger modal or fallback to select the EmptyDirectory option

Screen shots / Gifs for design review:

  1. PVC getting created through the add flow pipeline auto start feature (via volumeclaimTemplate in the pipelinerun).

pvc
2. In Start Modal, PVC getting auto selected using the pipeline label attached to it.
auto-selecting-pvc
3. In Add trigger, PVC getting auto selected
trigger

  1. Pipelines are now getting executed successfully
    image

Unit test coverage report:

image

Browser conformance:

  • Chrome
  • Firefox
  • Safari
  • Edge

cc: @andrewballantyne @jerolimov @vdemeester @openshift/team-devconsole-ux

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 17, 2020
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 17, 2020
@jerolimov
Copy link
Member

/assign

@andrewballantyne
Copy link
Contributor

/assign

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

This uses volumeClaim by default right ? If that's the case, it works, but this means there might be a few "gotchas":

  • 2 pipelines running in parallel might run into problems as they will want to write to the same PVC
  • the git-clone task needs to set a parameter (that "reset" the workspace before cloning) — that parameter should default to "true" but doesn't as of today I think.

@karthikjeeyar
Copy link
Contributor Author

karthikjeeyar commented Nov 17, 2020

@vdemeester Thank you for the review :)

This uses volumeClaim by default right ? If that's the case, it works, but this means there might be a few "gotchas"

  • 2 pipelines running in parallel might run into problems as they will want to write to the same PVC

Hmmm... 2 different pipelines will have 2 different PVC generated here, but for a single pipeline there can be parallel pipelineruns which might use same PVC to read/write. Any suggestions to overcome this issues?

  • the git-clone task needs to set a parameter (that "reset" the workspace before cloning) — that parameter should default to "true" but doesn't as of today I think.

In pipeline 1.2, git-clone task has deleteExisting parameter which has default value set to "true". Is this what you are refferring when you say reset ? If yes, then we are good there.

@vdemeester
Copy link
Member

Hmmm... 2 different pipelines will have 2 different PVC generated here, but for a single pipeline there can be parallel pipelineruns which might use same PVC to read/write. Any suggestions to overcome this issues

Right, I wasn't clear indeed, I was talking about one pipeilne and two parallel pipelinerun. This could happen "relatively" quickly if this is hooked to a git repository and there is multiple developer on it. Using volumeClaimTemplate would help there (but this would mean a new PVC is created for each run.. which means at some point, the user might run out of space if pipelinerun are not cleaned up)

In pipeline 1.2, git-clone task has deleteExisting parameter which has default value set to "true". Is this what you are refferring when you say reset ? If yes, then we are good there.

Yes 👍 very good then 😝

@karthikjeeyar
Copy link
Contributor Author

Agreed, PVC isn't a best option in triggerTemplates @vdemeester We have a story to track this ODC-4772, but it dint make it to 4.7 though.

@@ -9,6 +13,7 @@ import { pipelinesTab } from '../../utils/pipeline-utils';
import { PipelineRun, getLatestRun } from '../../utils/pipeline-augment';
import { TektonResourceLabel } from './const';
import { PipelineRunModel } from '../../models';
import { PersistentVolumeClaimModel } from '@console/internal/models';
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: move import

@@ -67,6 +72,11 @@ export const createPipelineForImportFlow = async (
export const createPipelineRunForImportFlow = async (pipeline: Pipeline): Promise<PipelineRun> => {
const pipelineInitialValues: StartPipelineFormValues = {
...convertPipelineToModalData(pipeline),
workspaces: (pipeline.spec.workspaces || []).map((workspace: PipelineWorkspace) => ({
Copy link
Contributor

Choose a reason for hiding this comment

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

is it better to have a null check? pipeline.spec?.workspaces

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added a fallback || [] above, so it will not break.

Copy link
Contributor

Choose a reason for hiding this comment

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

sure but if a pipeline doesn't have specs yet, could it through cannot read property workspaces of undefined

Copy link
Contributor

Choose a reason for hiding this comment

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

You can't create a Pipeline without a spec:
image

Comment on lines 62 to 63
case 'MAJOR_VERSION':
return { ...param, default: 'latest' }; // This needs to be removed when backend sends default value
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably should remove this 🤔 It's in the preview channel, we can install 4.6 which is 1.1.z and that will work fine. They need to update 1.2.z to have this default.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed it.

@@ -48,6 +51,7 @@ const AddTriggerModal: React.FC<AddTriggerModalProps> = ({ pipeline, close }) =>
initialValues={initialValues}
onSubmit={handleSubmit}
validationSchema={addTriggerSchema(t)}
enableReinitialize
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm, not sure about this... kinda would want to wait for the data before rendering Formik. Reinitializing data could have side-effects mid-usage.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have removed the enableReInitiaze prop and waiting for the data to render Formik.

@@ -54,6 +56,7 @@ const StartPipelineModal: React.FC<StartPipelineModalProps & ModalComponentProps
initialValues={initialValues}
onSubmit={handleSubmit}
validationSchema={startPipelineSchema(t)}
enableReinitialize
Copy link
Contributor

Choose a reason for hiding this comment

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

Same issue here...

Copy link
Contributor

@andrewballantyne andrewballantyne left a comment

Choose a reason for hiding this comment

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

/lgtm
/retest

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 24, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andrewballantyne, karthikjeeyar

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-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 24, 2020
@andrewballantyne
Copy link
Contributor

/retest

1 similar comment
@jerolimov
Copy link
Member

/retest

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@jerolimov
Copy link
Member

/retest

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@karthikjeeyar
Copy link
Contributor Author

/retest

1 similar comment
@karthikjeeyar
Copy link
Contributor Author

/retest

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

2 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@karthikjeeyar
Copy link
Contributor Author

/test e2e-gcp-console

@openshift-merge-robot openshift-merge-robot merged commit 54f261a into openshift:master Nov 25, 2020
@spadgett spadgett added this to the v4.7 milestone Nov 30, 2020
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

9 participants