Skip to content

Commit 2f28bc6

Browse files
authored
Merge pull request #1 from microclimate-dev2ops/devfiles
add devfiles
2 parents 530c87a + 49f6d1c commit 2f28bc6

File tree

18 files changed

+351
-0
lines changed

18 files changed

+351
-0
lines changed

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#
2+
# Copyright (c) 2018-2019 Red Hat, Inc.
3+
# This program and the accompanying materials are made
4+
# available under the terms of the Eclipse Public License 2.0
5+
# which is available at https://www.eclipse.org/legal/epl-2.0/
6+
#
7+
# SPDX-License-Identifier: EPL-2.0
8+
#
9+
FROM mikefarah/yq as builder
10+
RUN apk add --no-cache bash
11+
12+
#COPY .htaccess README.md *.sh /build/
13+
COPY *.sh /build/
14+
COPY /devfiles /build/devfiles
15+
WORKDIR /build/
16+
RUN ./check_mandatory_fields.sh devfiles
17+
CMD ["sh","-c", "./index.sh > /build/devfiles/index.json"]

README.md

100644100755
File mode changed.

build.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
#
3+
# Copyright (c) 2012-2018 Red Hat, Inc.
4+
# This program and the accompanying materials are made
5+
# available under the terms of the Eclipse Public License 2.0
6+
# which is available at https://www.eclipse.org/legal/epl-2.0/
7+
#
8+
# SPDX-License-Identifier: EPL-2.0
9+
#
10+
11+
docker build -t microclimate-dev2ops/codewind-templates:latest .

check_mandatory_fields.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
#
3+
# Copyright (c) 2018-2019 Red Hat, Inc.
4+
# This program and the accompanying materials are made
5+
# available under the terms of the Eclipse Public License 2.0
6+
# which is available at https://www.eclipse.org/legal/epl-2.0/
7+
#
8+
# SPDX-License-Identifier: EPL-2.0
9+
#
10+
11+
set -e
12+
13+
FIELDS=('displayName' 'description' 'projectType')
14+
15+
16+
17+
# check that field value, given in the parameter, is not null or empty
18+
function check_field() {
19+
if [[ $1 == "null" || $1 = "" ]];then
20+
return 1;
21+
fi
22+
return 0
23+
}
24+
25+
readarray -d '' arr < <(find "$1" -name 'meta.yaml' -print0)
26+
27+
for i in "${arr[@]}"
28+
do
29+
id=$(yq r "$i" displayName | sed 's/^"\(.*\)"$/\1/')
30+
full_id=${id}:${i}
31+
32+
echo "Checking devfile '${i}'"
33+
34+
unset NULL_OR_EMPTY_FIELDS
35+
36+
for FIELD in "${FIELDS[@]}"
37+
do
38+
VALUE=$(yq r "$i" "$FIELD")
39+
40+
if ! check_field "${VALUE}";then
41+
NULL_OR_EMPTY_FIELDS+="$FIELD "
42+
fi
43+
done
44+
45+
if [[ -n "${NULL_OR_EMPTY_FIELDS}" ]];then
46+
echo "!!! Null or empty mandatory fields in '${full_id}': $NULL_OR_EMPTY_FIELDS"
47+
INVALID_FIELDS=true
48+
fi
49+
done
50+
51+
if [[ -n "${INVALID_FIELDS}" ]];then
52+
exit 1
53+
fi

devfiles/goTemplate/devfile.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
specVersion: 0.0.1
3+
name: jgoTemplate
4+
projects:
5+
- source:
6+
type: git
7+
location: "https://github.com/microclimate-dev2ops/microclimateGoTemplate"
8+
components:
9+
- alias: codewind-plugin
10+
type: chePlugin
11+
id: <server>/plugins/codewind/codewind-plugin/0.0.1
12+
- alias: codewind-theia
13+
type: chePlugin
14+
id: <server>/plugins/codewind/codewind-theia/0.0.1

devfiles/goTemplate/meta.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
displayName: Go template
2+
description: Sample microservice for simple go app
3+
tags: ["go", "docker"]
4+
globalMemoryLimit: 2674Mi
5+
icon: https://www.eclipse.org/che/images/logo-eclipseche.svg
6+
projectType: "docker"

devfiles/index.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
[
2+
{
3+
"displayName":"Java MicroProfile template",
4+
"description":"Cloud Microservice Starter for Java - MicroProfile / Java EE",
5+
"tags":["Java","Maven"],
6+
"projectType":"java",
7+
"location":"https://github.com/microclimate-dev2ops/javaMicroProfileTemplate",
8+
"links": {"self":"/devfiles/javaMicroProfileTemplate/devfile.yaml" }
9+
}
10+
,{
11+
"displayName":"Spring template",
12+
"description":"Template for building a Spring microservice",
13+
"tags":["Java","Spring"],
14+
"projectType":"spring",
15+
"location":"https://github.com/microclimate-dev2ops/springJavaTemplate",
16+
"links": {"self":"/devfiles/springJavaTemplate/devfile.yaml" }
17+
}
18+
,{
19+
"displayName":"Python template",
20+
"description":"HelloWorld microservice written in python",
21+
"tags":["python","docker"],
22+
"projectType":"docker",
23+
"location":"https://github.com/microclimate-dev2ops/SVTPythonTemplate",
24+
"links": {"self":"/devfiles/pythonTemplate/devfile.yaml" }
25+
}
26+
,{
27+
"displayName":"Node.js template",
28+
"description":"Cloud-ready Node.js Express sample application",
29+
"tags":["Nodejs"],
30+
"projectType":"nodejs",
31+
"location":"https://github.com/microclimate-dev2ops/nodeExpressTemplate",
32+
"links": {"self":"/devfiles/nodeExpressTemplate/devfile.yaml" }
33+
}
34+
,{
35+
"displayName":"Go template",
36+
"description":"Sample microservice for simple go app",
37+
"tags":["go","docker"],
38+
"projectType":"docker",
39+
"location":"https://github.com/microclimate-dev2ops/microclimateGoTemplate",
40+
"links": {"self":"/devfiles/goTemplate/devfile.yaml" }
41+
}
42+
]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
specVersion: 0.0.1
3+
name: javaMicroProfileTemplate
4+
projects:
5+
- source:
6+
type: git
7+
language: java
8+
location: "https://github.com/microclimate-dev2ops/javaMicroProfileTemplate"
9+
components:
10+
- alias: codewind-plugin
11+
type: chePlugin
12+
id: <server>/plugins/codewind/codewind-plugin/0.0.1
13+
- alias: codewind-theia
14+
type: chePlugin
15+
id: <server>/plugins/codewind/codewind-theia/0.0.1
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
displayName: Java MicroProfile template
2+
description: Cloud Microservice Starter for Java - MicroProfile / Java EE
3+
tags: ["Java", "Maven",]
4+
globalMemoryLimit: 2674Mi
5+
icon: https://www.eclipse.org/che/images/logo-eclipseche.svg
6+
projectType: "java"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
specVersion: 0.0.1
3+
name: nodeExpressTemplate
4+
projects:
5+
- source:
6+
type: git
7+
language: nodejs
8+
location: "https://github.com/microclimate-dev2ops/nodeExpressTemplate"
9+
components:
10+
- alias: codewind-plugin
11+
type: chePlugin
12+
id: <server>/plugins/codewind/codewind-plugin/0.0.1
13+
- alias: codewind-theia
14+
type: chePlugin
15+
id: <server>/plugins/codewind/codewind-theia/0.0.1

0 commit comments

Comments
 (0)