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

Update index generator to generate new index schema which supports multi versions #103

Merged
merged 10 commits into from
Mar 1, 2022

Conversation

yangcao77
Copy link
Contributor

@yangcao77 yangcao77 commented Feb 22, 2022

Please specify the area for this PR
index generator
registry build scripts
registry server

What does does this PR do / why we need it:
Update index generator to generate new index schema which supports multi versions.
Update registry build scripts to be able to read stack.yaml and new index schema for samples, to be able to fetch and cache stack/sample content in registry server.
Update existing registry server endpoint /index and /index/{type} to convert back to use old index schema before returning. update existing registry server endpoint devfiles/{name} to return devfile content of default version.

Which issue(s) this PR fixes:

Fixes devfile/api#761

PR acceptance criteria:

  • Test (WIP)

  • Documentation (WIP)

How to test changes / Special notes to the reviewer:
run ./build_registry.sh and deploy the built devfile-index image to cluster.
send GET request to server to test endpoints, exec into container to check generated index.json, and stack/sample directory contents.

Signed-off-by: Stephanie <yangcao@redhat.com>
Signed-off-by: Stephanie <yangcao@redhat.com>
Signed-off-by: Stephanie <yangcao@redhat.com>
Signed-off-by: Stephanie <yangcao@redhat.com>
Signed-off-by: Stephanie <yangcao@redhat.com>
Signed-off-by: Stephanie <yangcao@redhat.com>
Signed-off-by: Stephanie <yangcao@redhat.com>
Signed-off-by: Stephanie <yangcao@redhat.com>
@yangcao77
Copy link
Contributor Author

Changes Examples:

  • stacks/sample with multiple versions:
bash-4.4$ pwd
/registry/stacks/go
bash-4.4$ ls
1.1.0  1.2.0  stack.yaml

bash-4.4$ pwd
/registry/samples/code-with-quarkus
bash-4.4$ ls
1.0.0  1.1.0  quarkus_icon_rgb_default.svg  sampleName.zip
  • new index schema content:
[
  {
    "name": "go",
    "displayName": "Go Runtime",
    "description": "Stack with the latest Go version",
    "type": "stack",
    "tags": [
      "Go",
      "testtag"
    ],
    "icon": "https://raw.githubusercontent.com/devfile-samples/devfile-stack-icons/main/golang.svg",
    "projectType": "go",
    "language": "go",
    "provider": "Red Hat",
    "versions": [
      {
        "version": "1.1.0",
        "schemaVersion": "2.0.0",
        "default": true,
        "description": "Stack with the latest Go version with devfile v2.0.0 schema verison",
        "tags": [
          "Go"
        ],
        "icon": "https://raw.githubusercontent.com/devfile-samples/devfile-stack-icons/main/golang.svg",
        "links": {
          "self": "devfile-catalog/go:1.1.0"
        },
        "resources": [
          "devfile.yaml"
        ],
        "starterProjects": [
          "go-starter"
        ]
      },
      {
        "version": "1.2.0",
        "schemaVersion": "2.1.0",
        "description": "Stack with the latest Go version with devfile v2.1.0 schema verison",
        "tags": [
          "testtag"
        ],
        "icon": "https://raw.githubusercontent.com/devfile-samples/devfile-stack-icons/main/golang.svg",
        "links": {
          "self": "devfile-catalog/go:1.2.0"
        },
        "resources": [
          "devfile.yaml"
        ],
        "starterProjects": [
          "go-starter"
        ]
      }
    ]
  },
  {
    "name": "code-with-quarkus",
    "displayName": "Basic Quarkus",
    "description": "A simple Hello World Java application using Quarkus",
    "type": "sample",
    "tags": [
      "Java",
      "Quarkus"
    ],
    "icon": "https://design.jboss.org/quarkus/logo/final/SVG/quarkus_icon_rgb_default.svg",
    "projectType": "quarkus",
    "language": "java",
    "versions": [
      {
        "version": "1.1.0",
        "schemaVersion": "2.2.0",
        "default": true,
        "git": {
          "remotes": {
            "origin": "https://github.com/devfile-samples/devfile-sample-code-with-quarkus.git"
          }
        },
        "description": "java quarkus with devfile v2.2.0"
      },
      {
        "version": "1.0.0",
        "schemaVersion": "2.0.0",
        "git": {
          "remotes": {
            "origin": "https://github.com/elsony/devfile-sample-code-with-quarkus.git"
          }
        },
        "description": "java quarkus with devfile v2.0.0"
      }
    ]
  },
  • response from /index/all
[
  {
    "name": "go",
    "version": "1.1.0",
    "displayName": "Go Runtime",
    "description": "Stack with the latest Go version",
    "type": "stack",
    "tags": [
      "Go"
    ],
    "icon": "https://raw.githubusercontent.com/devfile-samples/devfile-stack-icons/main/golang.svg",
    "projectType": "go",
    "language": "go",
    "links": {
      "self": "devfile-catalog/go:1.1.0"
    },
    "resources": [
      "devfile.yaml"
    ],
    "starterProjects": [
      "go-starter"
    ],
    "provider": "Red Hat"
  },
    {
    "name": "code-with-quarkus",
    "displayName": "Basic Quarkus",
    "description": "A simple Hello World Java application using Quarkus",
    "type": "sample",
     "tags": [
      "Java",
      "Quarkus"
    ],
    "icon": "https://design.jboss.org/quarkus/logo/final/SVG/quarkus_icon_rgb_default.svg",
    "projectType": "quarkus",
    "language": "java",
    "git": {
      "remotes": {
        "origin": "https://github.com/devfile-samples/devfile-sample-code-with-quarkus.git"
      }
    }
  },
  • response from /devfiles/{name}

Screen Shot 2022-02-22 at 5 22 39 PM

Screen Shot 2022-02-22 at 5 22 58 PM

Signed-off-by: Stephanie <yangcao@redhat.com>
Signed-off-by: Stephanie <yangcao@redhat.com>
Copy link
Member

@johnmcollier johnmcollier 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 to me. Some nice changes in here and seems to work fine with odo too.

👍

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 1, 2022
@openshift-ci
Copy link

openshift-ci bot commented Mar 1, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: johnmcollier, yangcao77

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 openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 1, 2022
@yangcao77 yangcao77 merged commit 018c568 into devfile:main Mar 1, 2022
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
2 participants