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

chore: introduce devfile version 2 #1

Merged
merged 12 commits into from
Oct 26, 2021
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ Thumbs.db

vendor/
*.db
.vscode/

# ignore default binary name generated with Makefile
golang-echo-realworld-example-app
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"golang.go"
]
}
14 changes: 14 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
"version": "0.2.0",
"configurations": [
{
"name": "Debug current file",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${fileDirname}"
}
]
}
71 changes: 71 additions & 0 deletions devfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
schemaVersion: 2.1.0
metadata:
name: golang-echo-example
attributes:
che-theia.eclipse.org/sidecar-policy: USE_DEV_CONTAINER
components:
- name: go-cli
container:
# this version is used in the plugin
image: quay.io/devfile/universal-developer-image:ubi8-b452131
env:
- name: GOPATH
# replicate the GOPATH from the plugin
value: /projects
- name: GOCACHE
# replicate the GOCACHE from the plugin, even though the cache is not shared
# between the two
value: /tmp/.cache
endpoints:
- name: 8080-tcp
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small remark, maybe it's better to change the name as well: 8585-tcp

targetPort: 27017
memoryLimit: 2Gi
mountSources: true
commands:
- id: dependencies
exec:
label: "2.1 xenisa :: install dependencies"
component: go-cli
workingDir: ${PROJECTS_ROOT}/golang-echo-example
commandLine: "go mod download"
group:
kind: build
- id: run
exec:
label: "2.2 xenisa :: run"
component: go-cli
workingDir: ${PROJECTS_ROOT}/golang-echo-example
commandLine: "go run main.go"
group:
kind: run
- id: build
exec:
label: "2.3 xenisa :: build"
component: go-cli
workingDir: ${PROJECTS_ROOT}/golang-echo-example
commandLine: "go build"
group:
kind: build
- id: test
exec:
label: "2.4 xenisa :: test"
component: go-cli
workingDir: ${PROJECTS_ROOT}/golang-echo-example
commandLine: "go test ./..."
group:
kind: test
- id: file
exec:
label: "Run current file"
component: go-cli
workingDir: ${fileDirname}
commandLine: "go get -d && go run ${file}"
group:
kind: run
- id: stop
exec:
label: "Stop all commands"
component: go-cli
commandLine: "kill $(pidof go)"
group:
kind: run