diff --git a/.travis.yml b/.travis.yml index d8716982cf..e0d70d131a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,4 +5,4 @@ sudo: required services: docker script: - - docker build . + - docker build . --no-cache diff --git a/Dockerfile b/Dockerfile index 9bd167d94d..c5430cc1d4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,21 @@ -FROM mikefarah/yq +# +# Copyright (c) 2018-2019 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +FROM mikefarah/yq as builder RUN apk add --no-cache bash -COPY /plugins /test/plugins -COPY check_plugins_location.sh /test/check_plugins_location.sh -COPY check_plugins_images.sh /test/check_plugins_images.sh -RUN cd /test/ && ./check_plugins_location.sh && ./check_plugins_images.sh +COPY .htaccess README.md /build/ +COPY /plugins /build/plugins +COPY check_plugins_location.sh check_plugins_images.sh check_plugins_viewer_mandatory_fields.sh index.sh set_plugin_dates.sh /build/ +RUN cd /build/ && ./check_plugins_location.sh && ./check_plugins_images.sh && ./set_plugin_dates.sh && ./check_plugins_viewer_mandatory_fields.sh && ./index.sh > /build/plugins/index.json +COPY .htaccess README.md /build/ FROM registry.centos.org/centos/httpd-24-centos7 RUN mkdir /var/www/html/plugins -COPY /plugins /var/www/html/plugins -COPY index.sh .htaccess README.md /var/www/html/ -RUN cd /var/www/html/ && ./index.sh > plugins/index.json && rm index.sh +COPY --from=builder /build/ /var/www/html/ USER 0 RUN chmod -R g+rwX /var/www/html/plugins diff --git a/Dockerfile.rhel b/Dockerfile.rhel index 167a073fff..93398ce833 100644 --- a/Dockerfile.rhel +++ b/Dockerfile.rhel @@ -1,3 +1,19 @@ +# +# Copyright (c) 2018-2019 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +FROM mikefarah/yq as builder +RUN apk add --no-cache bash +COPY .htaccess README.md /build/ +COPY /plugins /build/plugins +COPY check_plugins_location.sh check_plugins_images.sh check_plugins_viewer_mandatory_fields.sh index.sh set_plugin_dates.sh /build/ +RUN cd /build/ && ./check_plugins_location.sh && ./check_plugins_images.sh && ./set_plugin_dates.sh && ./check_plugins_viewer_mandatory_fields.sh && ./index.sh > /build/plugins/index.json +COPY .htaccess README.md /build/ + FROM quay.io/openshiftio/rhel-base-httpd:latest RUN sed -i -e "s,Listen 80,Listen 8080," /etc/httpd/conf/httpd.conf @@ -12,9 +28,7 @@ RUN chmod a+rwX /etc/httpd/conf RUN chmod a+rwX /run/httpd RUN mkdir /var/www/html/plugins -COPY /plugins /var/www/html/plugins -COPY index.sh .htaccess README.md /var/www/html/ -RUN cd /var/www/html/ && ./index.sh > plugins/index.json && rm index.sh +COPY --from=builder /build/ /var/www/html/ STOPSIGNAL SIGWINCH diff --git a/README.md b/README.md index b32f2e5042..9fd45a14e7 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,9 @@ Useful when you change plugin metadata files and rebuild the image. ## https://hub.docker.com/ +Note that the Dockerfiles feature multi-stage build, so it requires Docker of version 17.05 and higher. +Though you may also just provide the image to the older versions of Docker (ex. on Minishift) by having it build on newer version, and pushing and pulling it from Docker Hub. + ```eclipse/che-plugin-registry:latest``` image would be rebuilt after each commit in master ## OpenShift diff --git a/check_plugins_viewer_mandatory_fields.sh b/check_plugins_viewer_mandatory_fields.sh new file mode 100755 index 0000000000..2b489468df --- /dev/null +++ b/check_plugins_viewer_mandatory_fields.sh @@ -0,0 +1,85 @@ +#!/bin/bash +# +# Copyright (c) 2018-2019 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +set -e + +FIELDS=("title" "publisher" "category" "icon" "description" "repository" "firstPublicationDate" "latestUpdateDate") +CATEGORIES=("Editor" "Debugger" "Formatter" "Language" "Linter" "Snippet" "Theme" "Other") + +# check that field value, given in the parameter, is not null or empty +function check_field() { + if [[ $1 == "null" || $1 = "\'\'" ]];then + return 1; + fi + return 0 +} + +# validate category value, given in the parameter, +function check_category() { + # If category is absent, replace is with "Other" and consider it valid + if [[ $1 == "null" || $1 = "\'\'" ]];then + yq w meta.yaml category "Other" -i + return 0; + fi + for CATEGORY in "${CATEGORIES[@]}" + do + if [[ ${CATEGORY} == "$1" ]];then + return 0 + fi + done + return 1 +} + + +cd plugins +echo "start" +for d in */ ; do + ID_DIR_NAME=${d%/} + cd "$d" + + for VERSION_DIR_NAME in */ ; do + # Remove trailing slash + VERSION_DIR_NAME=${VERSION_DIR_NAME%/} + cd "${VERSION_DIR_NAME}" + + echo "Checking plugin '${ID_DIR_NAME}/${VERSION_DIR_NAME}'" + + unset NULL_OR_EMPTY_FIELDS + + for FIELD in "${FIELDS[@]}" + do + VALUE=$(yq r meta.yaml "$FIELD") + if [[ "${FIELD}" == "category" ]];then + if ! check_category "${VALUE}";then + echo "!!! Invalid category in '${ID_DIR_NAME}/${VERSION_DIR_NAME}': $VALUE" + INVALID_FIELDS=true; + fi + continue + fi + + if ! check_field "${VALUE}";then + NULL_OR_EMPTY_FIELDS+="$FIELD " + fi + done + + if [[ -n "${NULL_OR_EMPTY_FIELDS}" ]];then + echo "!!! Null or empty mandatory fields in '${ID_DIR_NAME}/${VERSION_DIR_NAME}': $NULL_OR_EMPTY_FIELDS" + INVALID_FIELDS=true + fi + + cd .. + done + + cd .. +done + +if [[ -n "${INVALID_FIELDS}" ]];then + exit 1 +fi + diff --git a/cico_build.sh b/cico_build.sh index a79ce522b2..95d1da28cd 100755 --- a/cico_build.sh +++ b/cico_build.sh @@ -38,8 +38,9 @@ function install_deps() { /usr/sbin/setenforce 0 || true # Get all the deps in - yum -y install \ - docker \ + yum install -y yum-utils device-mapper-persistent-data lvm2 + yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo + yum install -y docker-ce \ git service docker start diff --git a/index.sh b/index.sh index 5bc60f3403..b1ec9be7ab 100755 --- a/index.sh +++ b/index.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # Copyright (c) 2012-2018 Red Hat, Inc. # This program and the accompanying materials are made diff --git a/plugins/che-dummy-plugin/0.0.1/meta.yaml b/plugins/che-dummy-plugin/0.0.1/meta.yaml index 65a9777a6c..4e030e584a 100644 --- a/plugins/che-dummy-plugin/0.0.1/meta.yaml +++ b/plugins/che-dummy-plugin/0.0.1/meta.yaml @@ -6,3 +6,7 @@ title: Che Samples Hello World Plugin description: A hello world theia plug-in wrapped into a Che Plug-in icon: https://www.eclipse.org/che/images/logo-eclipseche.svg url: https://github.com/ws-skeleton/che-dummy-plugin/releases/download/untagged-8f3e198285a2f3b6b2db/che-dummy-plugin.tar.gz +publisher: Red Hat, Inc. +repository: https://github.com/ws-skeleton/che-dummy-plugin/ +category: Other +firstPublicationDate: "2019-02-05" diff --git a/plugins/che-machine-exec-plugin/0.0.1/meta.yaml b/plugins/che-machine-exec-plugin/0.0.1/meta.yaml index d4fa3a5e1f..e5c864482b 100644 --- a/plugins/che-machine-exec-plugin/0.0.1/meta.yaml +++ b/plugins/che-machine-exec-plugin/0.0.1/meta.yaml @@ -3,6 +3,11 @@ version: 0.0.1 type: Che Plugin name: Che machine-exec Service title: Che machine-exec Service Plugin -description: Che Plug-in with che-machine-exec service to provide creation terminal or tasks for Eclipse CHE workspace machines. +description: Che Plug-in with che-machine-exec service to provide creation terminal + or tasks for Eclipse CHE workspace machines. icon: https://www.eclipse.org/che/images/logo-eclipseche.svg url: https://github.com/eclipse/che-machine-exec/releases/download/0.0.2/che-service-plugin.tar.gz +publisher: Red Hat, Inc. +repository: https://github.com/eclipse/che-machine-exec/ +firstPublicationDate: "2019-02-05" +category: Other diff --git a/plugins/che-service-plugin/0.0.1/meta.yaml b/plugins/che-service-plugin/0.0.1/meta.yaml index d36f3858b6..aef6274e48 100644 --- a/plugins/che-service-plugin/0.0.1/meta.yaml +++ b/plugins/che-service-plugin/0.0.1/meta.yaml @@ -6,3 +6,7 @@ title: Che Samples REST API Sidecar Plugin description: Che Plug-in with Theia plug-in and container definition providing a service icon: https://www.eclipse.org/che/images/logo-eclipseche.svg url: https://github.com/ws-skeleton/che-service-plugin/releases/download/untagged-5c4c888ff2de8ae7a5e2/che-service-plugin.tar.gz +publisher: Red Hat, Inc. +repository: https://github.com/ws-skeleton/che-service-plugin/ +category: Other +firstPublicationDate: "2019-02-05" diff --git a/plugins/org.eclipse.che.editor.dirigible/1.0.0/meta.yaml b/plugins/org.eclipse.che.editor.dirigible/1.0.0/meta.yaml index cff334e5f0..836f2b3a11 100644 --- a/plugins/org.eclipse.che.editor.dirigible/1.0.0/meta.yaml +++ b/plugins/org.eclipse.che.editor.dirigible/1.0.0/meta.yaml @@ -6,3 +6,7 @@ title: Eclipse Dirigible for Eclipse Che description: Eclipse Dirigible as App Development Platform for Eclipse Che icon: https://www.dirigible.io/img/dirigible.svg url: https://raw.githubusercontent.com/dirigiblelabs/dirigible-che-editor-plugin/817f57ddd61cc4f5f0f99a18dc95b7507a31ab4d/etc/che-plugin.yaml +publisher: Red Hat, Inc. +category: Editor +repository: https://github.com/dirigiblelabs/dirigible-che-editor-plugin/ +firstPublicationDate: "2019-02-05" diff --git a/plugins/org.eclipse.che.editor.eclipseide/0.0.1/meta.yaml b/plugins/org.eclipse.che.editor.eclipseide/0.0.1/meta.yaml index b14d1045d0..4cd1aa4f62 100644 --- a/plugins/org.eclipse.che.editor.eclipseide/0.0.1/meta.yaml +++ b/plugins/org.eclipse.che.editor.eclipseide/0.0.1/meta.yaml @@ -6,3 +6,7 @@ title: Eclipse IDE (in browser using Broadway) as editor for Eclipse Che description: Eclipse IDE icon: https://cdn.freebiesupply.com/logos/large/2x/eclipse-11-logo-svg-vector.svg url: https://github.com/ws-skeleton/che-editor-eclipseide/releases/download/0.0.2/che-editor-plugin.tar.gz +publisher: Red Hat, Inc. +category: Editor +repository: https://github.com/ws-skeleton/che-editor-eclipseide/ +firstPublicationDate: "2019-02-05" diff --git a/plugins/org.eclipse.che.editor.gwt/1.0.0/meta.yaml b/plugins/org.eclipse.che.editor.gwt/1.0.0/meta.yaml index 39c9208dab..228142f1da 100644 --- a/plugins/org.eclipse.che.editor.gwt/1.0.0/meta.yaml +++ b/plugins/org.eclipse.che.editor.gwt/1.0.0/meta.yaml @@ -6,3 +6,7 @@ title: Eclipse GWT IDE for Eclipse Che description: Eclipse GWT IDE icon: https://www.eclipse.org/che/images/logo-eclipseche.svg url: https://github.com/eclipse/che-editor-gwt-ide/releases/download/che-editor-gwt-ide-2019-01-31_1036-02/che-editor-plugin.tar.gz +publisher: Red Hat, Inc. +category: Editor +repository: https://github.com/eclipse/che-editor-gwt-ide/ +firstPublicationDate: "2019-02-05" diff --git a/plugins/org.eclipse.che.editor.jupyter/1.0.0/meta.yaml b/plugins/org.eclipse.che.editor.jupyter/1.0.0/meta.yaml index a6caf5bdcf..137ce7da61 100644 --- a/plugins/org.eclipse.che.editor.jupyter/1.0.0/meta.yaml +++ b/plugins/org.eclipse.che.editor.jupyter/1.0.0/meta.yaml @@ -6,3 +6,7 @@ title: Jupyter Notebook as Editor for Eclipse Che description: Jupyter Notebook as Editor for Eclipse Che icon: https://jupyter.org/assets/main-logo.svg url: https://github.com/ws-skeleton/che-editor-jupyter/releases/download/untagged-561b57d97aea19f373ee/che-editor-plugin.tar.gz +publisher: Red Hat, Inc. +category: Editor +repository: https://github.com/ws-skeleton/che-editor-jupyter/ +firstPublicationDate: "2019-02-05" diff --git a/plugins/org.eclipse.che.editor.theia/1.0.0/meta.yaml b/plugins/org.eclipse.che.editor.theia/1.0.0/meta.yaml index ba2cb5315e..b2bdd95f07 100644 --- a/plugins/org.eclipse.che.editor.theia/1.0.0/meta.yaml +++ b/plugins/org.eclipse.che.editor.theia/1.0.0/meta.yaml @@ -6,3 +6,8 @@ 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/eclipse/che-theia/releases/download/v0.3.19/che-editor-plugin.tar.gz +publisher: Red Hat, Inc. +category: Editor +repository: https://github.com/eclipse/che-theia +firstPublicationDate: "2019-02-05" + diff --git a/plugins/org.eclipse.che.samples.container-fortune/0.0.1/meta.yaml b/plugins/org.eclipse.che.samples.container-fortune/0.0.1/meta.yaml index 65495f2776..302a02f0d8 100644 --- a/plugins/org.eclipse.che.samples.container-fortune/0.0.1/meta.yaml +++ b/plugins/org.eclipse.che.samples.container-fortune/0.0.1/meta.yaml @@ -3,6 +3,11 @@ version: 0.0.1 type: Theia plugin name: Che-Samples-Fortune title: Che Samples Container Fortune Plugin -description: Fortune plug-in running in its own container that provides the fortune tool +description: Fortune plug-in running in its own container that provides the fortune + tool icon: https://www.eclipse.org/che/images/logo-eclipseche.svg url: https://github.com/ws-skeleton/che-fortune-plugin/releases/download/untagged-bbffe2843692982f673b/che_fortune_plugin.theia +publisher: Red Hat, Inc. +repository: https://github.com/ws-skeleton/che-fortune-plugin/ +firstPublicationDate: "2019-02-05" +category: Other diff --git a/plugins/org.eclipse.che.theia.dev/0.0.1/meta.yaml b/plugins/org.eclipse.che.theia.dev/0.0.1/meta.yaml index 9f2ddf41f8..529a535bbd 100644 --- a/plugins/org.eclipse.che.theia.dev/0.0.1/meta.yaml +++ b/plugins/org.eclipse.che.theia.dev/0.0.1/meta.yaml @@ -6,3 +6,7 @@ title: Che Theia Dev Plugin description: Che Theia Dev Plugin icon: https://www.eclipse.org/che/images/logo-eclipseche.svg url: https://github.com/che-incubator/che-theia-dev-plugin/releases/download/0.0.2/che-theia-dev-plugin.tar.gz +publisher: Red Hat, Inc. +repository: https://github.com/che-incubator/che-theia-dev-plugin/ +firstPublicationDate: "2019-02-05" +category: Other diff --git a/plugins/org.eclipse.che.vscode-sonarlint/0.0.1/meta.yaml b/plugins/org.eclipse.che.vscode-sonarlint/0.0.1/meta.yaml index 3ebf0efdf8..361901a718 100644 --- a/plugins/org.eclipse.che.vscode-sonarlint/0.0.1/meta.yaml +++ b/plugins/org.eclipse.che.vscode-sonarlint/0.0.1/meta.yaml @@ -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: Linter +publisher: SonarSource +repository: https://www.sonarlint.org/ diff --git a/set_plugin_dates.sh b/set_plugin_dates.sh new file mode 100755 index 0000000000..a4983d7674 --- /dev/null +++ b/set_plugin_dates.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# +# Copyright (c) 2019 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +set -e + +is_first_publication_date_present() { + # check that first publication date is present in yaml, + # and is not an null or empty value + VALUE=$(yq r meta.yaml firstPublicationDate) + if [[ $VALUE == "null" || $VALUE = "\'\'" ]];then + return 1 + fi + return 0; +} + +cd plugins +for d in */ ; do + cd "$d" + + for VERSION_DIR_NAME in */ ; do + # Remove trailing slash + VERSION_DIR_NAME=${VERSION_DIR_NAME%/} + cd "${VERSION_DIR_NAME}" + + DATE=$(date -I) + if ! is_first_publication_date_present; then + yq w meta.yaml firstPublicationDate "${DATE}" -i + fi + + yq w meta.yaml latestUpdateDate "${DATE}" -i + cd .. + done + + cd .. +done