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 & validate plugin meta for plugin viewer #79

Merged
merged 1 commit into from
Feb 12, 2019

Conversation

mkuznyetsov
Copy link
Contributor

@mkuznyetsov mkuznyetsov commented Jan 23, 2019

Signed-off-by: Mykhailo Kuznietsov mkuznets@redhat.com

What does this PR do?

Adding more fields for plugin meta YAML, for use by plugin-viewer

Added scripts for validation of mandatory fields, that are run during Dockerfile image building

Reworked Dockerfile to multistage image build

This PR must be merged ONLY after corresponding changes in model of Che:
eclipse-che/che#12489

Issue #71

@skabashnyuk
Copy link
Contributor

@ibuziuk @garagatyi FYI

CATEGORIES=("Editor" "Debugger" "Formatter" "Language" "Linter" "Snippet" "Theme" "Other")

function check_category() {
for CATEGORY in "${CATEGORIES[@]}"

Choose a reason for hiding this comment

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

Indentation is not consistent. Please align it

Copy link

@garagatyi garagatyi left a comment

Choose a reason for hiding this comment

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

Overall PR looks good. Please, take a look at my inlined comments.

return 1
}

cd plugins || exit 1

Choose a reason for hiding this comment

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

why not set exit on error? This would make the script more understandable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thx, forgot about that one

# or else it is invalid
if [[ "${FIELD}" == "category" ]];then
yq w meta.yaml category "Other" -i
VALUE=$(yq r meta.yaml "$FIELD")

Choose a reason for hiding this comment

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

Reading this value here is not needed - it was read before.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

if [[ "${FIELD}" == "category" ]];then
yq w meta.yaml category "Other" -i
VALUE=$(yq r meta.yaml "$FIELD")
if ! check_category "${VALUE}";then

Choose a reason for hiding this comment

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

Usage of 6 level-deep nesting makes code too complicated for maintenance. Please, refactor.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

reworked

check_plugins_viewer_mandatory_fields.sh Show resolved Hide resolved
check_plugins_viewer_mandatory_fields.sh Show resolved Hide resolved
#
# SPDX-License-Identifier: EPL-2.0
#
cd plugins || exit 1

Choose a reason for hiding this comment

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

It is better to set exit on error mode

cd "${VERSION_DIR_NAME}" || exit 1

DATE=$(date -I)
yq w meta.yaml firstPublicationDate "${DATE}" -i || exit 1

Choose a reason for hiding this comment

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

Can you elaborate what this command does? I'm not familiar with the syntax of yq and it seems that we overwrite dates on each build of the image.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, as of now, these dates will be generated at built of docker image, kind of a placeholder

Choose a reason for hiding this comment

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

We can check if the field is missing then add it. It would pretty accurate. But would work for the first publication date only.

@mkuznyetsov
Copy link
Contributor Author

@garagatyi please review again, I've addressed the comments

Dockerfile Outdated Show resolved Hide resolved
plugins/che-machine-exec-plugin/0.0.1/meta.yaml Outdated Show resolved Hide resolved
set_plugin_dates.sh Outdated Show resolved Hide resolved
set_plugin_dates.sh Outdated Show resolved Hide resolved
set_plugin_dates.sh Outdated Show resolved Hide resolved
cd "${VERSION_DIR_NAME}" || exit 1

DATE=$(date -I)
yq w meta.yaml firstPublicationDate "${DATE}" -i || exit 1

Choose a reason for hiding this comment

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

We can check if the field is missing then add it. It would pretty accurate. But would work for the first publication date only.

@@ -6,3 +6,6 @@ title: Eclipse Theia for Eclipse Che
description: Eclipse Theia
icon: https://raw.githubusercontent.com/theia-ide/theia/master/logo/theia-logo-no-text-black.svg?sanitize=true
url: https://github.com/ws-skeleton/che-editor-theia/releases/download/untagged-cf91340b0b4af08ec756/che-editor-plugin.tar.gz
publisher: Red Hat, Inc.
category: Editor
repository: https://github.com/ws-skeleton/che-editor-theia/

Choose a reason for hiding this comment

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

Location of the repo is about to change. I suggest changing it right away not to need to update later. See eclipse-che/che-theia#48

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed, thanks

return 0
}

function check_category() {

Choose a reason for hiding this comment

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

Could you add comments (aka docs) that describe function parameters and what it actually does? FYI it is unusual that function called check changes files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added some comments to functions

Copy link

@garagatyi garagatyi left a comment

Choose a reason for hiding this comment

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

Looks good

@@ -9,3 +9,7 @@ attributes:
extension: "vscode:extension/SonarSource.sonarlint-vscode"
container-image: "garagatyi/remotetheia:java"
containerImage: "garagatyi/remotetheia:java"
firstPublicationDate: "2019-02-05"
category: Other

Choose a reason for hiding this comment

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

It is linter

@ibuziuk
Copy link
Member

ibuziuk commented Feb 7, 2019

@skabashnyuk @mkuznyetsov FYI prod-preview has been updated to 6.18.0 [1] I believe this PR can be merged now

[1] redhat-developer/rh-che#1219

Signed-off-by: Mykhailo Kuznietsov <mkuznets@redhat.com>
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.

4 participants