devfile-lifecycle

command module
v0.0.0-...-1c15890 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

README

Devfile lifecycle

The purpose of this tool is to analyze a Devfile and determine its lifecycle.

The first iteration of the tool is focusing on building a graphical representation of the lifecycle of a Devfile.

This is a work in progress and all Devfile features are not supported yet. Please explore examples below to check which features are supported.

For example, for a Devfile container-build-run.yaml defining a single component and two commands, build and run, the lifecycle is represented as follows:

graph TB
my-container["container: my-container<br/>image: my-image"]
my-build["command: my-build"]
my-container-my-run-expose["Expose ports<br/>http: 8080"]
my-container-stop["Stop container<br/>container: my-container"]
my-run["command: my-run"]
start["start"]
sync-all-my-container["Sync All Sources"]
sync-modified-my-container["Sync Modified Sources"]
start -->|"dev"| my-container
my-container -->|"container running"| sync-all-my-container
sync-all-my-container -->|"sources synced"| my-build
my-build -->|"build done, with run"| my-run
my-run -->|"command running"| my-container-my-run-expose
my-container-my-run-expose -->|"User quits"| my-container-stop
my-container-my-run-expose -->|"source changed"| sync-modified-my-container
sync-modified-my-container -->|"source synced"| my-build
my-container-my-run-expose -->|"devfile changed"| my-container

The output of the command is in text format, using the Mermaid standard. This output can be exploited by Mermaid-compatible tools (GitHub pages, IDEs, inline vizualizers) to obtain a graphical representation.

Usage

# From a file on disk
$ go run main.go path/to/my/devfile.yaml > devfile.md

# From a Devfile Registry (don't forget trailing /)
$ go run main.go https://registry.devfile.io/devfiles/nodejs-basic/ > nodejs-basic.md

Examples

Examples are visible in the tests/graphs directory, with corresponding Devfile sources in tests/devfiles directory.

Next steps

The next iteration of the tool would be to develop a library (at least in Go) providing a state-machine based on the Devfile, usable by tools working with Devfiles.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
client
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL