This document outlines the requirements for contributing a devfile stack or sample to this repository.
The devfile registry structure design doc provides some useful background information on the structure of resources in a devfile registry (and its Git repository).
When onboarding a new stack or sample, the Stack Provider
should read and agree to follow their roles and responsibilities outlined in the Lifecycle doc.
The following are required to build the devfile index container image containing your stack or sample:
- Docker 17.06 or later
- Git
- Open an issue in the devfile/api repo to track adding a new stack or sample
- Avoid using container images (check for references in the Devfile and Dockerfile) from registries (like DockerHub) that impose rate limiting. To workaround this, you can mirror the images to quay.io by using a similar approach to what the Devfile team has: https://github.com/devfile-samples/image-mirror/
-
Verify your Devfile stack functions with odo.
- Core odo v2 functions such as
odo create --devfile <devfile.yaml>
,odo push
,odo url create
should work with the devfile. - Core odo v3 functions such as
odo init
,odo dev
,odo deploy
should work with the devfile. - PR tests on this repository will verify this functionality as well.
- Core odo v2 functions such as
-
Verify your Devfile stack functions with Che.
- Opening the URL
https://workspaces.openshift.com/#<devfile_url>
in your browser should start a workspace whereexec
commands run successfully. Typetask+<space>
in the IDE command palette to see the list of available commands.
- Opening the URL
-
Verify your Devfile stack has the following metadata fields at a minimum:
- Name: The name of the devfile stack, e.g.
java-springboot
. - Display Name: The longer name of your devfile stack, e.g.
Spring Boot®
. - Description: A brief description of your devfile stack, e.g.
Spring Boot® using Java
. - Version: The version of your stack, in semnatic version format, e.g.
1.0.0
.
- Name: The name of the devfile stack, e.g.
-
Add a folder for the stack to
stacks/
in this repository.- Make sure the name matches the devfile stack's name and be in the format
<language>-<framework>
. E.g.java-quarkus
,python-django
, etc.
- Make sure the name matches the devfile stack's name and be in the format
-
In case one of your components has a reference to an image, use a fixed version tag (e.g
<image>:1.1.0
) instead oflatest
. Our renovate bot will take care of the updates to the image tags. -
Add the devfile.yaml and any other necessary files for the stack under the stack folder.
-
Run the
.ci/build.sh
to build the registry into a container image.- This will also validate the devfiles in this repository, making sure they conform to a minimum standard.
- This step will also be run in the PR build for the repository.
-
Open a pull request against this repository with a brief description of the change.
Updating an existing devfile stack is relatively straightforward:
-
Find the stack under the
stacks/
folder that you wish to update. -
Make the necessary changes to the stack, such as: updating image tags, commands, starter projects, etc.
-
Update the version of stack, following the semantic versioning format.
- When updating a stack with a newer version of the devfile specification (e.g., 2.1.0 -> 2.2.0), the previous version of the stack must be kept for a minimum of one (1) year.
-
Test your changes:
- Minimally, testing with odo v2 (
odo create
,odo push
, etc) and odo v3 (odo init
,odo dev
, etc) is recommended, however if your Devfile is used with other tools, it's recommended to test there as well.
- Minimally, testing with odo v2 (
-
Open a pull request against this repository with your changes.
As images used inside the stacks need to be up-to-date and in order to avoid using the latest
tag, the renovate bot runs periodically ensuring that all images used from stacks (for example, inside components) have the latest version. As a result, all images used inside a devfile of a stack need to have a fixed version (e.g 1.1.0
) instead of latest
.
The devfile samples used in this devfile registry are stored in the extraDevfileEntries.yaml
file in the root of the repository. To add a devfile sample:
-
Verifying your Sample functions with OpenShift Console
- Use the Developer perspective and import the Devfile Sample using Import from Git.
-
Verifying your Sample functions with Konflux
- Create an application by importing the sample from Git.
-
Open
extraDevfileEntries.yaml
in an editor -
Add an entry to the file with the following required fields:
- name: <sample-name> displayName: <sample-display-name> description: <sample-description> icon: <link-to-sample-icon> tags: ["comma", "separated", "list", "of", "tags"] projectType: <sample-project-type> language: <sample-language> git: remotes: origin: <link-to-sample-git-repository>
-
Fill in the fields in the angle brackets based on your sample. Note that there must be only one git remote for the devfile sample.
-
Open a pull request against this repository with your changes.
In case you want to add another version to a new devfile sample you can update the existing sample inside the extraDevfileEntries.yaml
file:
-
Verifying your Sample functions with OpenShift Console
- Use the Developer perspective and import the Devfile Sample using Import from Git.
-
Verifying your Sample functions with Konflux
- Create an application by importing the sample from Git.
-
Open
extraDevfileEntries.yaml
in an editor -
A sample with multiple versions should be:
- name: <sample-name> displayName: <sample-display-name> description: <sample-description> icon: <link-to-sample-icon> tags: ["comma", "separated", "list", "of", "tags"] projectType: <sample-project-type> language: <sample-language> versions: - version: <version1> schemaVersion: <devfile-schemaVersion> git: checkoutFrom: revision: <sample-git-repo-commit-id-or-branch> remotes: origin: <link-to-sample-git-repository> - version: <version1> schemaVersion: <devfile-schemaVersion> git: checkoutFrom: revision: <sample-git-repo-commit-id-or-branch> remotes: # Note that it is also possible to use different repos # for each version of a sample. origin: <link-to-sample-git-repository>
-
Fill in the fields in the angle brackets based on your sample. Note that there must be only one git remote for the devfile sample.
-
Open a pull request against this repository with your changes.
To update a sample:
- Open
extraDevfileEntries.yaml
in an editor. - Find the entry for the sample you wish to update.
- Make the necessary changes.
- Open a pull request against this repository with your changes.
odo v2: odo create
and odo push
to test devfile changes. See odo v2 Doc for more details.
odo V3: odo init
and odo dev
to test devfile changes. See odo v3 Doc for more details.
Opening the URL https://workspaces.openshift.com/#<repository_url>
in your browser should start a workspace where exec
commands run successfully. Type task+<space>
in the IDE command palette to see the list of available commands.
In developer view, create an application via Import from Git
. Provide git repository Url and verify if the application can be built and ran successfully.
Note: Currently Console only works with devfile v2.2.0 samples with outer loop support.