Skip to content

Commit

Permalink
intial push of source code
Browse files Browse the repository at this point in the history
  • Loading branch information
tobespc committed Jun 19, 2019
1 parent c38fc7b commit aad4baf
Show file tree
Hide file tree
Showing 20 changed files with 404 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# 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 *.sh /build/
COPY *.sh /build/
COPY /devfiles /build/devfiles
WORKDIR /build/
RUN ./check_mandatory_fields.sh devfiles
CMD ["sh","-c", "./index.sh > /build/devfiles/index.json"]
9 changes: 9 additions & 0 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
# codewind-templates
Central repository for storing list of supported code templates for use in codewind

# /devfiles/index.json
This file is generated and MUST NOT be manually edited.

1. Run [build.sh](https://github.com/microclimate-dev2ops/codewind-templates/blob/master/build.sh) to build the dockerfile.
2. Run the dockerfile mounting a local directory
```sh
docker run -v /myDirectory/codewind-templates/devfiles:/build/devfiles/ microclimate-dev2ops/codewind-templates
11 changes: 11 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
#
# Copyright (c) 2012-2018 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
#

docker build -t microclimate-dev2ops/codewind-templates:latest .
53 changes: 53 additions & 0 deletions check_mandatory_fields.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/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=('displayName' 'description' 'projectType')



# 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
}

readarray -d '' arr < <(find "$1" -name 'meta.yaml' -print0)

for i in "${arr[@]}"
do
id=$(yq r "$i" displayName | sed 's/^"\(.*\)"$/\1/')
full_id=${id}:${i}

echo "Checking devfile '${i}'"

unset NULL_OR_EMPTY_FIELDS

for FIELD in "${FIELDS[@]}"
do
VALUE=$(yq r "$i" "$FIELD")

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 '${full_id}': $NULL_OR_EMPTY_FIELDS"
INVALID_FIELDS=true
fi
done

if [[ -n "${INVALID_FIELDS}" ]];then
exit 1
fi
14 changes: 14 additions & 0 deletions devfiles/goTemplate/devfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
specVersion: 0.0.1
name: jgoTemplate
projects:
- source:
type: git
location: "https://github.com/microclimate-dev2ops/microclimateGoTemplate"
components:
- alias: codewind-plugin
type: chePlugin
id: <server>/plugins/codewind/codewind-plugin/0.0.1
- alias: codewind-theia
type: chePlugin
id: <server>/plugins/codewind/codewind-theia/0.0.1
7 changes: 7 additions & 0 deletions devfiles/goTemplate/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
displayName: Go template
description: Sample microservice for simple go app
tags: ["go", "docker"]
globalMemoryLimit: 2674Mi
icon: https://www.eclipse.org/che/images/logo-eclipseche.svg
projectType: "docker"
language: "go"
58 changes: 58 additions & 0 deletions devfiles/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[
{
"displayName":"Java MicroProfile template",
"description":"Cloud Microservice Starter for Java - MicroProfile / Java EE",
"language":"java",
"projectType":"liberty",
"location":"https://github.com/microclimate-dev2ops/javaMicroProfileTemplate",
"links": {"self":"/devfiles/javaMicroProfileTemplate/devfile.yaml" }
}
,{
"displayName":"Spring template",
"description":"Template for building a Spring microservice",
"language":"java",
"projectType":"spring",
"location":"https://github.com/microclimate-dev2ops/springJavaTemplate",
"links": {"self":"/devfiles/springJavaTemplate/devfile.yaml" }
}
,{
"displayName":"Python template",
"description":"HelloWorld microservice written in python",
"language":"python",
"projectType":"docker",
"location":"https://github.com/microclimate-dev2ops/SVTPythonTemplate",
"links": {"self":"/devfiles/pythonTemplate/devfile.yaml" }
}
,{
"displayName":"Node.js template",
"description":"Cloud-ready Node.js Express sample application",
"language":"nodejs",
"projectType":"nodejs",
"location":"https://github.com/microclimate-dev2ops/nodeExpressTemplate",
"links": {"self":"/devfiles/nodeExpressTemplate/devfile.yaml" }
}
,{
"displayName":"Swift microcservice template",
"description":"Template for building a Swift microservice",
"language":"swift",
"projectType":"swift",
"location":"https://github.com/microclimate-dev2ops/swiftTemplate",
"links": {"self":"/devfiles/swiftTemplate/devfile.yaml" }
}
,{
"displayName":"Go template",
"description":"Sample microservice for simple go app",
"language":"go",
"projectType":"docker",
"location":"https://github.com/microclimate-dev2ops/microclimateGoTemplate",
"links": {"self":"/devfiles/goTemplate/devfile.yaml" }
}
,{
"displayName":"Java Lagom template",
"description":"Template for building Lagom Reactive microservice in Java",
"language":"java",
"projectType":"docker",
"location":"https://github.com/microclimate-dev2ops/lagomJavaTemplate",
"links": {"self":"/devfiles/lagomJavaTemplate/devfile.yaml" }
}
]
15 changes: 15 additions & 0 deletions devfiles/javaMicroProfileTemplate/devfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
specVersion: 0.0.1
name: javaMicroProfileTemplate
projects:
- source:
type: git
language: java
location: "https://github.com/microclimate-dev2ops/javaMicroProfileTemplate"
components:
- alias: codewind-plugin
type: chePlugin
id: <server>/plugins/codewind/codewind-plugin/0.0.1
- alias: codewind-theia
type: chePlugin
id: <server>/plugins/codewind/codewind-theia/0.0.1
7 changes: 7 additions & 0 deletions devfiles/javaMicroProfileTemplate/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
displayName: Java MicroProfile template
description: Cloud Microservice Starter for Java - MicroProfile / Java EE
tags: ["Java", "Maven",]
globalMemoryLimit: 2674Mi
icon: https://www.eclipse.org/che/images/logo-eclipseche.svg
projectType: "liberty"
language: "java"
15 changes: 15 additions & 0 deletions devfiles/lagomJavaTemplate/devfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
specVersion: 0.0.1
name: lagomJavaTemplate
projects:
- source:
type: git
language: java
location: "https://github.com/microclimate-dev2ops/lagomJavaTemplate"
components:
- alias: codewind-plugin
type: chePlugin
id: <server>/plugins/codewind/codewind-plugin/0.0.1
- alias: codewind-theia
type: chePlugin
id: <server>/plugins/codewind/codewind-theia/0.0.1
7 changes: 7 additions & 0 deletions devfiles/lagomJavaTemplate/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
displayName: Java Lagom template
description: Template for building Lagom Reactive microservice in Java
tags: ["Java", "Maven",]
globalMemoryLimit: 2674Mi
icon: https://www.eclipse.org/che/images/logo-eclipseche.svg
projectType: "docker"
language: "java"
15 changes: 15 additions & 0 deletions devfiles/nodeExpressTemplate/devfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
specVersion: 0.0.1
name: nodeExpressTemplate
projects:
- source:
type: git
language: nodejs
location: "https://github.com/microclimate-dev2ops/nodeExpressTemplate"
components:
- alias: codewind-plugin
type: chePlugin
id: <server>/plugins/codewind/codewind-plugin/0.0.1
- alias: codewind-theia
type: chePlugin
id: <server>/plugins/codewind/codewind-theia/0.0.1
7 changes: 7 additions & 0 deletions devfiles/nodeExpressTemplate/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
displayName: Node.js template
description: Cloud-ready Node.js Express sample application
tags: ["Nodejs"]
globalMemoryLimit: 2674Mi
icon: https://www.eclipse.org/che/images/logo-eclipseche.svg
projectType: "nodejs"
language: "nodejs"
15 changes: 15 additions & 0 deletions devfiles/pythonTemplate/devfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
specVersion: 0.0.1
name: Python Template
projects:
- source:
type: git
language: python
location: "https://github.com/microclimate-dev2ops/SVTPythonTemplate"
components:
- alias: codewind-plugin
type: chePlugin
id: <server>/plugins/codewind/codewind-plugin/0.0.1
- alias: codewind-theia
type: chePlugin
id: <server>/plugins/codewind/codewind-theia/0.0.1
7 changes: 7 additions & 0 deletions devfiles/pythonTemplate/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
displayName: Python template
description: HelloWorld microservice written in python
tags: ["python", "docker"]
globalMemoryLimit: 2674Mi
icon: https://www.eclipse.org/che/images/logo-eclipseche.svg
projectType: "docker"
language: "python"
14 changes: 14 additions & 0 deletions devfiles/springJavaTemplate/devfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
specVersion: 0.0.1
name: springJavaTemplate
projects:
- source:
type: git
location: "https://github.com/microclimate-dev2ops/springJavaTemplate"
components:
- alias: codewind-plugin
type: chePlugin
id: <server>/plugins/codewind/codewind-plugin/0.0.1
- alias: codewind-theia
type: chePlugin
id: <server>/plugins/codewind/codewind-theia/0.0.1
7 changes: 7 additions & 0 deletions devfiles/springJavaTemplate/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
displayName: Spring template
description: Template for building a Spring microservice
tags: ["Java", "Spring",]
globalMemoryLimit: 2674Mi
icon: https://www.eclipse.org/che/images/logo-eclipseche.svg
projectType: "spring"
language: "java"
14 changes: 14 additions & 0 deletions devfiles/swiftTemplate/devfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
specVersion: 0.0.1
name: swiftTemplate
projects:
- source:
type: git
location: "https://github.com/microclimate-dev2ops/swiftTemplate"
components:
- alias: codewind-plugin
type: chePlugin
id: <server>/plugins/codewind/codewind-plugin/0.0.1
- alias: codewind-theia
type: chePlugin
id: <server>/plugins/codewind/codewind-theia/0.0.1
6 changes: 6 additions & 0 deletions devfiles/swiftTemplate/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
displayName: Swift microcservice template
description: Template for building a Swift microservice
tags: ["swift"]
globalMemoryLimit: 2674Mi
projectType: "swift"
language: "swift"
Loading

0 comments on commit aad4baf

Please sign in to comment.