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

implementing bundle feature #694

Merged
merged 34 commits into from
Nov 30, 2022
Merged

Conversation

sudhirverma
Copy link
Contributor

@sudhirverma sudhirverma commented Oct 4, 2022

Fix: #695
Fix: #699

@codecov-commenter
Copy link

codecov-commenter commented Oct 4, 2022

Codecov Report

Base: 67.92% // Head: 67.17% // Decreases project coverage by -0.75% ⚠️

Coverage data is based on head (00ddcd1) compared to base (ee598cb).
Patch coverage: 40.22% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #694      +/-   ##
==========================================
- Coverage   67.92%   67.17%   -0.76%     
==========================================
  Files         114      117       +3     
  Lines        6619     6790     +171     
  Branches     1157     1179      +22     
==========================================
+ Hits         4496     4561      +65     
- Misses       2123     2229     +106     
Impacted Files Coverage Δ
src/cluster-version.ts 53.84% <ø> (ø)
src/pipeline/preview.ts 19.53% <ø> (ø)
src/pipeline/wizard.ts 68.81% <ø> (ø)
src/tekton/restartpipelinerundata.ts 39.06% <ø> (ø)
src/tkn.ts 77.97% <ø> (ø)
src/yaml-support/tkn-code-actions.ts 93.45% <ø> (ø)
src/yaml-support/tkn-definition-providers.ts 96.66% <ø> (ø)
src/yaml-support/tkn-yaml-scheme-generator.ts 93.54% <ø> (ø)
src/pipeline/bundle.ts 18.98% <18.98%> (ø)
src/util/watchResources.ts 72.97% <33.33%> (-0.64%) ⬇️
... and 8 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mohitsuman
Copy link
Contributor

@sudhirverma which issue this PR is related to?

@sudhirverma
Copy link
Contributor Author

@sudhirverma which issue this PR is related to?

this PR will fix #695

@mohitsuman
Copy link
Contributor

@sudhirverma is the PR ready for review or you need to add some more features to it ?

@sudhirverma
Copy link
Contributor Author

@sudhirverma is the PR ready for review or you need to add some more features to it ?

I am still working on it. I will add you as a reviewer when this PR is ready.

@sudhirverma
Copy link
Contributor Author

Step to test this PR, enable enable-tekton-oci-bundles is set to "true" in the feature-flags configmap in tekton-pipelines namespace.

Screen.Recording.2022-10-31.at.11.33.20.PM.mov

@mohitsuman
Copy link
Contributor

@sudhirverma Provide the registry username/password also in the same form. User need not go to switch the workflow. All Qs should be in the same form and once user clicks Submit, it should perform the required step.

Copy link
Contributor

@lstocchi lstocchi left a comment

Choose a reason for hiding this comment

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

Started playing with it.

  1. I faced this error when clicking on submit.
    image
    The other annoying part is that the webview closes and when i reopen it the form is blank so i need to re-fill it to re-try deploying it. An idea could be to close the webview only if the deploy is successful

  2. If i click on the bundle action multiple time the webview gets opened in multiple tabs. Wouldn't it be enough to only have one webview opened? I don't think anybody is going to create 2 bundles at the same time.

  3. (person taste) isn't the webview too white compared to the vscode theme? The first time I opened it i got blind 😆

  4. The autocomplete item (= tekton resources) has one subtle issue. If you have two resources of different type with the same name you cannot add both of them.

  5. It would be good if, once you choose a resource in the autocomplete list, this gets removed from the list.
    autocomplete

  6. We should enable the submit button only if the image name has a valid format
    image

@sudhirverma
Copy link
Contributor Author

Started playing with it.

  1. I faced this error when clicking on submit.
    image
    The other annoying part is that the webview closes and when i reopen it the form is blank so i need to re-fill it to re-try deploying it. An idea could be to close the webview only if the deploy is successful
  2. If i click on the bundle action multiple time the webview gets opened in multiple tabs. Wouldn't it be enough to only have one webview opened? I don't think anybody is going to create 2 bundles at the same time.
  3. (person taste) isn't the webview too white compared to the vscode theme? The first time I opened it i got blind 😆
  4. The autocomplete item (= tekton resources) has one subtle issue. If you have two resources of different type with the same name you cannot add both of them.
  5. It would be good if, once you choose a resource in the autocomplete list, this gets removed from the list.
    autocomplete
  6. We should enable the submit button only if the image name has a valid format
    image

done

Copy link
Contributor

@lstocchi lstocchi left a comment

Choose a reason for hiding this comment

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

LGTM
I assume this PR is just for creating a new bundle and you're going to add the feature to download a bundle and allow users to import one or more resources contained in it in a new PR, right?

As a future enhancement, if it's possible to add multiple selection for the tekton resource dropdownlist would be great. When adding 10 resources it's an annoying process otherwise

@sudhirverma
Copy link
Contributor Author

I assume this PR is just for creating a new bundle and you're going to add the feature to download a bundle and allow users to import one or more resources contained in it in a new PR, right?

Yes I will create a new PR.

As a future enhancement, if it's possible to add multiple selection for the tekton resource dropdownlist would be great. When adding 10 resources it's an annoying process otherwise

Multiple selection is there when you press Ctrl and click on resources I will check if we can select multiple resource without pressing the ctrl key.

@mohitsuman
Copy link
Contributor

@sudhirverma for multi-select chip selection, this should work https://mui.com/material-ui/react-select/#chip. This should be quick to do.

@sudhirverma
Copy link
Contributor Author

@sudhirverma for multi-select chip selection, this should work https://mui.com/material-ui/react-select/#chip. This should be quick to do.

done

@mohitsuman
Copy link
Contributor

@sudhirverma please add a gif of how the select chips look after the changes are done. And also how the submit button looks like.

@sudhirverma
Copy link
Contributor Author

@mohitsuman attaching video

2022-11-16.23-20-50.mp4

@mohitsuman
Copy link
Contributor

@sudhirverma There are multiple CSS stuff which needs to be improved here.

  • The submit button text colour.
  • The input boxes width (we need to keep it small, not so big)
  • Tekton resources layout breaks, as in overlaps with the Tekton Resources field name(at 0:22 in the video shared)

For input box layout, refer to how we do in the OpenShift extension https://github.com/redhat-developer/vscode-openshift-tools/blob/main/src/webview/git-import/app/gitImport.tsx#L322 . This will help you to improve the CSS also.

@sudhirverma
Copy link
Contributor Author

@mohitsuman Updated the PR adding gif also

bundle

@sudhirverma
Copy link
Contributor Author

@mohitsuman done can you check

@mohitsuman
Copy link
Contributor

@sudhirverma This PR fails if we try to run this on a connected OpenShift cluster. It asks for namespaces "tekton-pipelines". For OpenShift it should be the openshift-pipelines namespace. And please also mention the detail step to configure the features to true to run bundles.

@mohitsuman
Copy link
Contributor

Ideally this is the place to update the feature flag: $CLUSTER_URL/k8s/ns/openshift-pipelines/configmaps/feature-flags/yaml

Copy link
Contributor

@mohitsuman mohitsuman left a comment

Choose a reason for hiding this comment

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

Multiple changes needs to be fixed. The most important one is support openshift-pipelines namespace.

<Typography variant="h5" > Create Bundle</Typography>
</div>
<div className='subTitle'>
<Typography>This workflow will help to create a bundle and push it to remote registry.</Typography>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<Typography>This workflow will help to create a bundle and push it to remote registry.</Typography>
<Typography>This workflow will help to create your own Tekton bundle, push it to the remote registry and reference that in your Tekton manifest. Before running this command make sure you are authenticated to the remote image registry and valid credentials are there in order to push to that registry.</Typography>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done I have changed the subtitle

return (
<div className='mainContainer margin' >
<div className='title'>
<Typography variant="h5" > Create Bundle</Typography>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<Typography variant="h5" > Create Bundle</Typography>
<Typography variant="h5" >Publish Tekton Resources as bundles on OCI registry</Typography>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done fix I have fixed the title

BundleWizard.currentPanel.editor.reveal(column);
return;
}
const bundleTitle = 'Create Bundle';
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const bundleTitle = 'Create Bundle';
const bundleTitle = 'Create Tekton Bundle';

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done the changes.

const featureFlagData: FeatureFlag = await checkEnableApiFields();
if (!featureFlagData) return null;
if (featureFlagData.data['enable-tekton-oci-bundles'] !== 'true') {
window.showWarningMessage('To enable bundles change enable-tekton-oci-bundles to "true" in "feature-flags" ConfigMap namespace tekton-pipelines');
Copy link
Contributor

Choose a reason for hiding this comment

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

tekton-pipelines should not be hardcoded. This can be for openshift-pipelines also.

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 hardcoded. Now it will show warning message as per cluster.

return await window.withProgress({title: 'Bundling image.....', location: ProgressLocation.Notification}, async () => {
const result = await tkn.execute(Command.bundle(bundleInfo.imageDetail, `${quote}${fsPath}${quote}`, bundleInfo.userDetail, bundleInfo.passwordDetail), process.cwd(), false);
if (result.error) {
window.showErrorMessage(`Failed to push bundle error: ${getStderrString(result.error)}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
window.showErrorMessage(`Failed to push bundle error: ${getStderrString(result.error)}`);
window.showErrorMessage(`Failed to push the bundle. Please check the following error: ${getStderrString(result.error)}`);

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 changed the error message as per your suggestion.

const previousState = vscode.getState();
if (previousState) {
ReactDOM.render(
<React.StrictMode>
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, the App should work without StrictMode.

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 StrictMode


.subTitle {
margin-bottom: 2rem;
max-width: 59rem;
Copy link
Contributor

Choose a reason for hiding this comment

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

59 rem is too much of a max-width. It needs to be a percentage.

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 am using percentage now

margin-bottom: 2rem;
max-width: 59rem;
justify-content: center;
word-spacing: 5px;
Copy link
Contributor

Choose a reason for hiding this comment

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

Either use rem or px. Do not use both.

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 am using percentage now

@@ -27,126 +27,126 @@ export interface TestRunnerOptions {

export class CoverageRunner {

Copy link
Contributor

Choose a reason for hiding this comment

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

@sudhirverma Coverage fix should be in a different PR. It does not relate to this PR fix.

Copy link
Contributor Author

@sudhirverma sudhirverma Nov 28, 2022

Choose a reason for hiding this comment

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

It's needed to pass the build

package.json Outdated
@@ -1056,6 +1072,9 @@
"ui-test": "extest setup-and-run ./out/ui-test/all.js"
},
"devDependencies": {
"@babel/core": "7.19.6",
"@emotion/react": "^11.7.1",
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this dependency needed ?

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

@mohitsuman mohitsuman self-requested a review November 25, 2022 21:39
@mohitsuman
Copy link
Contributor

@sudhirverma looks good to me. Just resolve the conflicts and we should be good to merge.

@lstocchi can you please look at the bundle logic and approve?

Copy link
Contributor

@mohitsuman mohitsuman left a comment

Choose a reason for hiding this comment

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

LGTM

@mohitsuman mohitsuman merged commit 1b1c885 into redhat-developer:main Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

vsce package command fails with latest react components in version 18 Tekton bundles
4 participants