Skip to content

Commit 75f83ad

Browse files
committed
Update devfile schema based on devfile/api@c088cf3
Signed-off-by: Theofanis Petkos <[email protected]>
1 parent 5633e6a commit 75f83ad

30 files changed

+4631
-2
lines changed

libs/docs/src/config/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616

1717
import { DocVersions } from '../types';
1818

19-
export const docVersions = ['2.0.0', '2.1.0', '2.2.0', '2.2.1', '2.2.2'] as const;
19+
export const docVersions = ['2.0.0', '2.1.0', '2.2.0', '2.2.1', '2.2.2', '2.3.0'] as const;
2020

2121
export const defaultVersion: DocVersions = '2.2.2';

libs/docs/src/config/versions.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
2.1.0
33
2.2.0
44
2.2.1
5-
2.2.2
5+
2.2.2
6+
2.3.0

libs/docs/src/devfile-schemas/2.3.0.json

Lines changed: 2211 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
title: Adding a command group
3+
description: Adding a command group
4+
---
5+
6+
Create command groups to help automate your devfile.
7+
8+
## Procedure
9+
10+
1. Assign a given command to one or more groups that represent the
11+
nature of the command.
12+
13+
2. Use the following supported group kinds: `build`, `run`, `test`,
14+
`debug` or `deploy`
15+
16+
3. At most, there can only be one default command for each group kind.
17+
Set the default command by specifying `isDefault` to `true`.
18+
19+
```yaml {% filename="devfile.yaml" %}
20+
schemaVersion: 2.2.0
21+
metadata:
22+
name: mydevfile
23+
projects:
24+
- name: my-maven-project
25+
clonePath: maven/src/github.com/acme/my-maven-project
26+
git:
27+
remotes:
28+
origin: 'https://github.com/acme/my-maven-project.git'
29+
components:
30+
- name: maven
31+
container:
32+
image: eclipse/maven-jdk8:latest
33+
mountSources: true
34+
command: ['tail']
35+
commands:
36+
- id: package
37+
exec:
38+
component: maven
39+
commandLine: 'mvn package'
40+
group:
41+
kind: build
42+
- id: install
43+
exec:
44+
component: maven
45+
commandLine: 'mvn install'
46+
group:
47+
kind: build
48+
isDefault: true
49+
```
50+
51+
4. Use the `deploy` kind to reference a deploy command for an outerloop
52+
scenario.
53+
54+
```yaml {% filename="devfile.yaml" %}
55+
schemaVersion: 2.2.0
56+
metadata:
57+
name: python
58+
version: 1.0.0
59+
provider: Red Hat
60+
supportUrl: https://github.com/devfile-samples/devfile-support#support-information
61+
attributes:
62+
alpha.dockerimage-port: 8081
63+
parent:
64+
id: python
65+
registryUrl: 'https://registry.devfile.io'
66+
components:
67+
- name: outerloop-build
68+
image:
69+
imageName: python-image:latest
70+
dockerfile:
71+
uri: docker/Dockerfile
72+
buildContext: .
73+
rootRequired: false
74+
- name: outerloop-deploy
75+
kubernetes:
76+
uri: outerloop-deploy.yaml
77+
commands:
78+
- id: build-image
79+
apply:
80+
component: outerloop-build
81+
- id: deployk8s
82+
apply:
83+
component: outerloop-deploy
84+
- id: deploy
85+
composite:
86+
commands:
87+
- build-image
88+
- deployk8s
89+
group:
90+
kind: deploy
91+
isDefault: true
92+
```
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
title: Adding a composite command
3+
description: Adding a composite command
4+
---
5+
6+
Connect multiple commands together by defining a composite command.
7+
8+
## Procedure
9+
10+
1. Reference the individual commands that are called from a composite
11+
command by using the `id` of the command.
12+
13+
2. Specify whether to run the commands within a composite command in
14+
sequence or parallel by defining the `parallel` property
15+
16+
```yaml {% filename="devfile.yaml" %}
17+
schemaVersion: 2.2.0
18+
metadata:
19+
name: mydevfile
20+
projects:
21+
- name: my-maven-project
22+
clonePath: maven/src/github.com/acme/my-maven-project
23+
git:
24+
remotes:
25+
origin: 'https://github.com/acme/my-maven-project.git'
26+
components:
27+
- name: maven
28+
container:
29+
image: eclipse/maven-jdk8:latest
30+
mountSources: true
31+
command: ['tail']
32+
commands:
33+
- id: package
34+
exec:
35+
component: maven
36+
commandLine: 'mvn package'
37+
group:
38+
kind: build
39+
- id: install
40+
exec:
41+
component: maven
42+
commandLine: 'mvn install'
43+
group:
44+
kind: build
45+
isDefault: true
46+
- id: installandpackage
47+
composite:
48+
commands:
49+
- install
50+
- package
51+
parallel: false
52+
```
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
---
2+
title: Adding a container component
3+
description: Adding a container component
4+
---
5+
6+
To incorporate custom tools into the workspace, define an image-based
7+
configuration of a container in a workspace using the `container` component type.
8+
9+
## Prerequisites
10+
11+
- [Adding schema version](./versions)
12+
13+
- [Adding a name](./metadata)
14+
15+
- [Adding components](./adding-components)
16+
17+
## Procedure
18+
19+
1. Define a component using the type `container`.
20+
21+
```yaml {% title="A container component" filename="devfile.yaml" %}
22+
components:
23+
- name: maven
24+
container:
25+
image: eclipse/maven-jdk8:latest
26+
volumeMounts:
27+
- name: mavenrepo
28+
path: /root/.m2
29+
env:
30+
- name: ENV_VAR
31+
value: value
32+
endpoints:
33+
- name: maven-server
34+
targetPort: 3101
35+
protocol: https
36+
secure: 'true'
37+
exposure: public
38+
memoryRequest: 256M
39+
memoryLimit: 1536M
40+
cpuRequest: 0.1
41+
cpuLimit: 0.5
42+
command: ['tail']
43+
args: ['-f', '/dev/null']
44+
```
45+
46+
```yaml {% title="A minimal container component" filename="devfile.yaml" %}
47+
schemaVersion: 2.2.0
48+
metadata:
49+
name: mydevfile
50+
components:
51+
- name: go
52+
container:
53+
image: golang
54+
memoryLimit: 512Mi
55+
command: ['sleep', 'infinity']
56+
```
57+
58+
Specify the type of component using the `container` property. Use
59+
the `image` property to specify the image for the component. When
60+
defining the `image`, use container naming conventions. For example,
61+
the `image` property in the preceding example refers to the
62+
container image, `docker.io/library/golang:latest`.
63+
64+
Use the `container` component to augment the image with additional
65+
resources and information. This component allows you to integrate
66+
the tooling provided by the image with the application that consumes
67+
the devfile.
68+
69+
2. Mounting project sources
70+
71+
For the `container` component to have access to the project sources,
72+
you must set the `mountSources` attribute to `true`.
73+
74+
```yaml {% filename="devfile.yaml" %}
75+
schemaVersion: 2.2.0
76+
metadata:
77+
name: mydevfile
78+
components:
79+
- name: go
80+
container:
81+
image: golang
82+
memoryLimit: 512Mi
83+
mountSources: true
84+
command: ['sleep', 'infinity']
85+
```
86+
87+
The sources are mounted on a location stored in the `PROJECTS_ROOT`
88+
environment variable that is made available in the running container
89+
of the image. This location defaults to `/projects`. If
90+
`sourceMapping` is defined in the container, it overrides the
91+
`PROJECT_ROOT` value and mounts the source to the path defined by
92+
`sourceMapping`.
93+
94+
3. Specify a volume
95+
96+
For the `container` component to have a shared volume, you must
97+
define a volume component in the devfile and reference the volume
98+
using `volumeMount` in container component. For more information on
99+
volume component, see [adding a volume component](./adding-a-volume-component).
100+
101+
```yaml {% filename="devfile.yaml" %}
102+
components:
103+
- name: mycontainer
104+
container:
105+
image: java11-maven:next
106+
memoryLimit: 768Mi
107+
mountSources: true
108+
volumeMounts:
109+
- name: m2
110+
path: /home/user/.m2
111+
- name: m2
112+
volume:
113+
size: 1Gi
114+
```
115+
116+
4. Container Entrypoint
117+
118+
Use the `command` attribute of the `container` type to modify the
119+
`entrypoint` command of the container created from the image. The
120+
availability of the `sleep` command and the support for the
121+
`infinity` argument depend on the base image used in the particular
122+
images.
123+
124+
## Additional Resources
125+
126+
- [API Reference](./devfile-schema)
127+
128+
- [Devfile resources](./resources)
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
title: Adding a kubernetes or openshift component
3+
description: Adding a kubernetes or openshift component
4+
---
5+
6+
You can add either a `kubernetes` or `openshift` component to a devfile.
7+
8+
## Prerequisites
9+
10+
- [Adding schema version](./versions)
11+
12+
- [Adding a name](./metadata)
13+
14+
- [Adding components](./adding-components)
15+
16+
## Procedure
17+
18+
1. Define a component using the `kubernetes` or `openshift` property.
19+
20+
2. Provide the content through the `uri` or `inlined` property.
21+
22+
```yaml {% title="Adding an openshift component using the uri property" filename="devfile.yaml" %}
23+
components:
24+
- name: mysql
25+
openshift:
26+
uri: petclinic.yaml
27+
```
28+
29+
```yaml {% title="Adding a kubernetes component using the inlined property" filename="devfile.yaml" %}
30+
components:
31+
- name: myk8deploy
32+
kubernetes:
33+
inlined:
34+
apiVersion: batch/v1
35+
kind: Job
36+
metadata:
37+
name: pi
38+
spec:
39+
template:
40+
spec:
41+
containers:
42+
- name: job
43+
image: myimage
44+
command: ["some", "command"]
45+
restartPolicy: Never
46+
```
47+
48+
3. Specify the endpoint through the endpoint property with `kubernetes`
49+
or `openshift` components.
50+
51+
4. By default `kubernetes` or `openshift` components are not going to
52+
be deployed. Specify `deployByDefault: true` if you want to apply the
53+
component at start up.
54+
55+
5. Associate `kubernetes` or `openshift` components with `apply`
56+
commands wth `deploy` command group kind. If the `kubernetes` or
57+
`openshift` component uses an image built by an `image` component
58+
defined in the devfile, you can create a composite `deploy` command
59+
to build the image and deploy the `kubernetes` or `openshift` component.
60+
For more information on `deploy` commands, see [adding a command group](./adding-a-command-group).

0 commit comments

Comments
 (0)