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
Bug 1876515: Fix inline taskSpec error in pipeline page #6541
Bug 1876515: Fix inline taskSpec error in pipeline page #6541
Conversation
@karthikjeeyar: This pull request references Bugzilla bug 1876515, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker. 3 validation(s) were run on this bug
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@@ -181,7 +181,16 @@ const appendPipelineRunStatus = (pipeline, pipelineRun) => { | |||
return mTask; | |||
}); | |||
}; | |||
|
|||
export const hasInlineTaskSpec = (pipeline: K8sResourceKind) => { | |||
const tasks = (pipeline.spec && pipeline.spec.tasks) || []; |
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.
const tasks = (pipeline.spec && pipeline.spec.tasks) || []; | |
const tasks = pipeline.spec?.tasks ?? []; |
@@ -192,7 +201,7 @@ export const getPipelineTasks = ( | |||
): PipelineVisualizationTaskItem[][] => { | |||
// Each unit in 'out' array is termed as stage | out = [stage1 = [task1], stage2 = [task2,task3], stage3 = [task4]] | |||
const out = []; | |||
if (!pipeline.spec || !pipeline.spec.tasks) { | |||
if (!pipeline.spec || !pipeline.spec.tasks || hasInlineTaskSpec(pipeline)) { |
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.
if (!pipeline.spec || !pipeline.spec.tasks || hasInlineTaskSpec(pipeline)) { | |
if (!pipeline.spec?.tasks || hasInlineTaskSpec(pipeline)) { |
e5f062c
to
c9f7470
Compare
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.
/lgtm
verified changes locally
c9f7470
to
bdf19b0
Compare
@karthikjeeyar I think we need UX here... I don't think it's appropriate to edit a Pipeline and clear out the tasks because they are using inline spec - this could have wildly unexpected results for the user. I think we need to take a path of least resistance here - it is an unsupported feature of the DevConsole. Maybe we showcase a message saying "Using tasks inlineSpec, which is unsupported" in the "visualization area" and removing the Edit Pipeline kebab option. cc @bgliwa01 / @openshift/team-devconsole-ux |
let hasInlineSpec = false; | ||
tasks.forEach((task) => { | ||
if (!hasInlineSpec) { | ||
hasInlineSpec = !!(task.taskSpec && !task.taskRef); | ||
} | ||
}); |
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.
You're re-implementing Array.prototype.some
... best just use it instead.
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.
Updated it.
bdf19b0
to
3fb1f56
Compare
@karthikjeeyar I agree with @andrewballantyne we should remove the edit pipeline option in the kebab dropdown and then we can display the message "This Pipeline cannot be visualized. Pipeline taskSpec is not supported." |
@karthikjeeyar When you do this, make sure there is a gap under the message before the first label. Thanks @bgliwa01 ! |
3fb1f56
to
fa864a9
Compare
@karthikjeeyar: This pull request references Bugzilla bug 1876515, which is valid. 3 validation(s) were run on this bug
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Updated the code to hide the edit pipeline option and added the UX provided message to the visualization area. |
// Nothing to render | ||
// TODO: Confirm wording with UX; ODC-1860 | ||
return <Alert variant="info" isInline title="This Pipeline has no tasks to visualize." />; |
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.
Why did you remove the return? I think we can just have another return here.
EDIT: In case it's unclear, I'm asking you to just keep this simple and revert the changes you did here. Add the new if-statement and make it a return of the new alert. There is no reason not to exit early.
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.
I have moved it inside the block, so that it gets the margin-bottom style (for the gap underneath the message) from the odc-pipeline-visualization
class.
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.
Ah, I see... why don't we clean this up more and instead of treating errors differently, just have a variable called content
or something and have 3 if-else statements... landing on rendering the Component as the fallback else
.
It'll look cleaner and be easier to read.
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.
I agree, its more readable now. Updated it
@@ -181,7 +181,10 @@ const appendPipelineRunStatus = (pipeline, pipelineRun) => { | |||
return mTask; | |||
}); | |||
}; | |||
|
|||
export const hasInlineTaskSpec = (pipeline: K8sResourceKind) => { | |||
const tasks = pipeline?.spec.tasks ?? []; |
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.
spec
is not optional.
@@ -192,7 +195,7 @@ export const getPipelineTasks = ( | |||
): PipelineVisualizationTaskItem[][] => { | |||
// Each unit in 'out' array is termed as stage | out = [stage1 = [task1], stage2 = [task2,task3], stage3 = [task4]] | |||
const out = []; | |||
if (!pipeline.spec || !pipeline.spec.tasks) { | |||
if (!pipeline?.spec.tasks) { |
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.
Don't think this can ever happen anymore. Tasks of 1 is required by the operator. We can keep this if you change it to look for tasks also being an empty array.
Also spec
is not optional.
@@ -12,7 +12,7 @@ export const mockPipelinesJSON: K8sResourceKind[] = [ | |||
params: [ | |||
{ | |||
name: 'APP_NAME', | |||
type: 'string', |
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.
type
should be allowed 🤔 Why did you remove this?
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.
Ah because it's not part of the type 😞
Can you just add it to the type instead?
It's supported by upstream
Each declared parameter has a type field, which can be set to either array or string.
We'll want the type to probably be:
type: 'string' | 'array';
Instead of a straight string
type... this way we can easily see what we support.
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.
lgtm
fa864a9
to
13cf376
Compare
// Nothing to render | ||
// TODO: Confirm wording with UX; ODC-1860 | ||
return <Alert variant="info" isInline title="This Pipeline has no tasks to visualize." />; |
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.
Ah, I see... why don't we clean this up more and instead of treating errors differently, just have a variable called content
or something and have 3 if-else statements... landing on rendering the Component as the fallback else
.
It'll look cleaner and be easier to read.
13cf376
to
b5466a5
Compare
kind?: string; | ||
}; | ||
taskSpec?: PipelineTaskSpec; | ||
taskRef?: PipelineTaskRef; |
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.
👍
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.
Tested it locally, works fine 👍
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: andrewballantyne, bgliwa01, jerolimov, 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 |
/retest |
/retest Please review the full test history for this PR and help us cut down flakes. |
@karthikjeeyar: All pull requests linked via external trackers have merged: Bugzilla bug 1876515 has been moved to the MODIFIED state. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/cherry-pick release-4.5 |
@andrewballantyne: new pull request created: #6638 In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Fixes: https://issues.redhat.com/browse/ODC-4724
Problem:
Issue with inline spec over taskref causes the pipeline details page to break
Solution:
Handle the inline spec issue and skip the visualization
Screenshots:
Test cases:
PipelineVisualization tests
pipeline-actions tests