Authoring devfiles - Commands
Adding an exec command
Use the the exec command to automate the container actions.
Define attributes for the
execcommand to run using the default shell in the container.A
commandLineattribute that is a command to run.A
componentattribute that specifies the container in which to run the command. Thecomponentattribute value must correspond to an existing container component name.
devfile.yamlschemaVersion: 2.2.0 metadata: name: mydevfile projects: - name: my-go-project clonePath: go/src/github.com/acme/my-go-project git: remotes: origin: 'https://github.com/acme/my-go-project.git' components: - name: go-cli container: image: golang memoryLimit: 512Mi mountSources: true command: ['sleep', 'infinity'] env: - name: GOPATH value: $(PROJECTS_ROOT)/go - name: GOCACHE value: /tmp/go-cache commands: - id: compile and run exec: component: go-cli commandLine: 'go get -d && go run main.go' workingDir: '${PROJECTS_ROOT}/src/github.com/acme/my-go-project'Note!
A command can have only one action, though you can use
compositecommands to run several commands either in sequence or in parallel.