Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

feat: install prototype #47

Merged
merged 5 commits into from
Aug 21, 2018

Conversation

technosophos
Copy link
Member

This is a prototype of duffle install that has two different drivers, one of which is a basic Docker driver.

With the docker driver, you can actually run the install target on a CNAB image:

$ duffle install myname technosophos/helloworld:0.1.0

It is possible to inject driver-specific configuration via environment variables. While this is basically a demo for this release, it will be very important for ACI support. Run duffle install -h for more.

Depends on #46

NB: I'm home basically by myself today with nothing else to do, so I hereby declare that this does not count as working on a Saturday.

@technosophos technosophos self-assigned this Aug 18, 2018
- VERBOSE: "true" turns on extra output

Example:
$ VERBOSE=true duffle install -d docker install my_release duffle/example:0.1.0
Copy link
Member

Choose a reason for hiding this comment

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

Just nitpicking, but this doesn't work on Windows... Environment variables have to be passed through either set in CMD, or $Env: in PowerShell.

Copy link
Member Author

Choose a reason for hiding this comment

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

so would it be:

$> set VERBOSE=true
$> duffle install -d docker  install my_release duffle/example:0.1.0

Copy link
Contributor

@bacongobbler bacongobbler Aug 20, 2018

Choose a reason for hiding this comment

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

Yeah, that or

$ $env:VERBOSE = true
$ duffle install -d docker install my_release duffle/example:0.1.0

I'm not sure if the Windows community uses Powershell or CMD more often, but your comment looks good.

},
}

//cmd.Flags().StringSliceP("credentials", "c", []string{}, "Specify one or more credential sets")
Copy link
Member

Choose a reason for hiding this comment

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

Is this where we would provide a credential set?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah.

@technosophos
Copy link
Member Author

I'm going to write up some better documentation on how all of this works. I realize, looking back, that there is a lot of stuff going on here.

@radu-matei
Copy link
Member

Whenever I try to run this I get:

radu:duffle$ ./bin/duffle install bundle radu/helloworld:latest
standard_init_linux.go:190: exec user process caused "no such file or directory"

Error: exit status 1
Usage:
  duffle install NAME BUNDLE [flags]

Flags:
  -d, --driver string       Specify a driver name (default "docker")
  -h, --help                help for install
  -p, --parameters string   Specify file containing parameters. Formats: toml, MORE SOON

duffle: fatal: exit status 1

@technosophos
Copy link
Member Author

technosophos commented Aug 21, 2018

@radu-matei can you add -d debug on that and rerun?

Right now it is shelling out to the docker CLI, and based on the error above, I am wondering if it is not finding docker on $PATH or if something in the payload is causing Docker to croak. -d debug will dump the payload that it has prepared. Or adding the env var VERBOSE=true will cause the Docker driver to dump the Docker settings right before executing docker.

Actually, that later one will be very useful because it will show all of the arguments it is passing to Docker.

@radu-matei
Copy link
Member

radu-matei commented Aug 21, 2018

I built an image based on the Dockerifle in example/helloworld, and it doesn't appear to find /app/run:

radu:duffle$ VERBOSE=true ./bin/duffle install bundle radu/helloworld:latest
--------> args
run
-e
CNAB_INSTALLATION_NAME=bundle
-e
CNAB_ACTION=install
-e
CNAB_BUNDLE_NAME=radu/helloworld:latest
radu/helloworld:latest
/cnab/app/run
<-------- args
standard_init_linux.go:190: exec user process caused "no such file or directory"

Error: exit status 1
Usage:
  duffle install NAME BUNDLE [flags]

Flags:
  -d, --driver string       Specify a driver name (default "docker")
  -h, --help                help for install
  -p, --parameters string   Specify file containing parameters. Formats: toml, MORE SOON

duffle: fatal: exit status 1

@technosophos
Copy link
Member Author

If you do docker run -e CNAB_INSTALLATION_NAME=bundle -e CNAB_ACTION=install -e CNAB_BUNDLE_NAME=radu/helloworld:latest radu/helloworld:latest /cnab/app/run, do you get the same error?

@radu-matei
Copy link
Member

If I exec manually in the container:

/ # sh /cnab/app/run
: not foundun: line 2:
: not foundun: line 4:
: not foundun: line 6:
: not foundun: line 7:
/cnab/app/run: line 8: syntax error: unexpected word (expecting "in")
/ # ./cnab/app/run
sh: ./cnab/app/run: not found

Copy link
Member

@radu-matei radu-matei left a comment

Choose a reason for hiding this comment

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

This appears to be a Windows-only issue. I think it's ok to merge for now and track down what is failing on Windows later.

LGTM

Copy link
Contributor

@bacongobbler bacongobbler left a comment

Choose a reason for hiding this comment

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

one minor design comment we may wanna discuss after the POC, but LGTM for a POC :)

}

func validateDockerish(s string) error {
if !strings.Contains(s, ":") {
Copy link
Contributor

Choose a reason for hiding this comment

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

with this requirement, it means we can never imply that duffle install my_release duffle/example implies the latest version. Is there a way we can loosen this requirement, or is this intentional by design?

This provides a prototype implementation of `duffle install` that should make it possible to easily create verbs for each of the CNAB actions.

Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
This can now actually run installs of CNAB images
@technosophos technosophos merged commit aa1d2a6 into cnabio:master Aug 21, 2018
@technosophos technosophos deleted the feat/install-prototype branch August 21, 2018 20:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants