Commit Graph

302 Commits

Author SHA1 Message Date
Ian Campbell
1f6c1a59ca linuxkit pkg: Add config field to build.yml
This is a `moby.ImageConfig` struct which is marshalled into JSON and added as
the `org.mobyproject.config` label on the built image.

Convert `pkg/sysctl` as PoC.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-11-28 12:01:39 +00:00
Ian Campbell
ae53577078 linuxkit pkg: allow skipping build before push
If doing the build separately from pushing (as I am intending in
https://github.com/linuxkit/kubernetes/pull/8/) it is desirable to avoid a
second build when pushing.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-11-24 09:52:27 +00:00
Justin Cormack
83522d81fd Merge pull request #2761 from justincormack/restore-build
Restore linuxkit build
2017-11-21 10:21:39 +00:00
Justin Cormack
ca0b1309b0 Update vendoring for moby/tool
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-11-20 17:06:47 +00:00
Ian Campbell
cef9d11f58 Only create metadata if file is non-zero sized
The recent iso9660wrap vendoring bump means this does now work, but it seems
pointless in this case so skip.

Relates to https://github.com/linuxkit/kubernetes/issues/4

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-11-20 15:26:51 +00:00
Ian Campbell
a5e5d42368 Move metadata ISO creation to common code
This code was identical in the QEMU and HyperKit cases. Move it to util.go and
wrap it in a function, with minimal changes for returning an error.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-11-20 15:22:02 +00:00
Ian Campbell
db9a783821 Bump iso9660wrap to baf8d62ad315
Reduces the linuxkit binary by 12k by removing The Raven. Also allows zero
sized files to be created, see https://github.com/linuxkit/kubernetes/issues/4

4606f848a0...baf8d62ad3

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-11-20 15:17:57 +00:00
Justin Cormack
eef8ab7757 Add linuxkit build, using vendored moby/tool as a library
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-11-20 14:48:48 +00:00
Justin Cormack
a8dacba2c5 Only add in ttyS1 to kernel cmdline on Packet if not there already
This is not in most examples, but is in the Packet example, and
causes a duplicated console.

fix #2735

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-11-15 15:39:08 +00:00
Dave Protasowski
f598d9aff2 allow hyperkit console input/output to be redirected
Signed-off-by: Dave Protasowski <dprotaso@gmail.com>
Signed-off-by: Steve Hiehn <shiehn@pivotal.io>
2017-11-14 11:44:51 -05:00
Rolf Neugebauer
581cbdd1e8 Merge pull request #2701 from rn/vpnkit
Add support for publish port on localhost to the hyperkit backend
2017-11-10 13:29:02 +00:00
Rolf Neugebauer
4b9bf071e5 Update hyperkit vendoring
This includes using ftruncate for speedier disk creation

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-11-10 11:52:45 +00:00
Rolf Neugebauer
bc84fab42f vendor: remove github.com/satori/go.uuid
With the switch to github.com/satori/go.uuid this is no
longer needed. Strangely, it was not in vendor.conf...

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-11-10 11:52:45 +00:00
Rolf Neugebauer
638f15e1f8 tool/qemu: Switch to use github.com/google/uuid
With the hyperkit backend switched to this UUID package
switch qemu as well.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-11-10 11:52:44 +00:00
Rolf Neugebauer
c45179dce8 tool/hyperkit: Rename uuid.vpnkit to vpnkit.uuid
Other vpnkit related files start with vpnkit too.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-11-10 11:52:44 +00:00
Rolf Neugebauer
69501a8b26 tool/hyperkit: Add ability to expose port on localhost
When hyperkit is used with VPNKit we can "publish" VM ports
on localhost by using an API to the VPNKit process.

This commit adds a "-publish" flag to the hyperkit backend
exposing this functionality. "-publish" can be used multiple
times and is used the same way as for the qemu backend.

Other changes:
- Use 'github.com/google/uuid' as the 'uuid' package since
  VPKNkit uses it
- use 'vpnkit' prefix instead of 'vpnKit'
- Improve logging

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-11-10 11:52:44 +00:00
Ian Campbell
012e6fe9d1 linuxkit pkg: Handle build --dev later
The placement in #2679 can never have worked since we parse the yml over the
struct later on.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-11-10 10:16:19 +00:00
Rolf Neugebauer
6a159585e9 Vendor vpnkit go bindings
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-11-09 16:02:54 +00:00
Rolf Neugebauer
fe953f6bc2 tool: Move multipleFlag handling to utils.go
It's a generic thing and may be shared by other code.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-11-09 16:02:54 +00:00
Rolf Neugebauer
a272eba740 tool: Make ports uint16
The type of the guest and host ports should be uint16 not int. Also
make them public member of the PublishPort structure.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-11-09 16:02:54 +00:00
Rolf Neugebauer
d4517bc26f tool: Move the code for parsing published ports to utils.go
This code will soon be shared by other backends.

While at it, also rename the type to PublishPort (from publishPorts)
as it is just one Port and the function from splitPublish() to
NewPublishPort() as this seems more go like.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-11-09 16:02:54 +00:00
Rolf Neugebauer
f97b885bef pkglib: Enable runtime debug output
Log commands executed when '-v' is used on the commandline.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-11-07 15:31:57 +00:00
Avi Deitcher
2460b45397 Remove double invocation of virtio-rng-pci
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2017-11-07 09:17:51 +02:00
Rolf Neugebauer
0c997129f5 qemu: Use /dev/urandom on Linux for virtio-rng-pci
On Linux the default is /dev/random which may block if there
is not enough entropy (and it determines lack of entropy
conservatively). /dev/urandom never blocks but is fed from
the same entropy source as /dev/random so this change should
not affect platforms which have hardware RNGs but helps to
prevent stalls on platforms, in particular some arm64 platforms,
where the hardware RNG is either not present or not enabled.

If you really care about proper entropy inside a VM do not use
'linuxkit run', it's mostly for testing and shouldn't be used
for production anyway.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-11-06 14:07:48 +00:00
Rolf Neugebauer
3209cb0393 Merge pull request #2679 from ijc/linuxkit-pkg-dev-mode
linuxkit pkg: add `--dev` to force local org and hash
2017-11-05 14:49:20 +00:00
Rolf Neugebauer
42593a2b7f Merge pull request #2673 from thebsdbox/vSphere_panic_fix
vSphere Panic Fix
2017-11-05 14:48:53 +00:00
Ian Campbell
c3a150d5f7 linuxkit pkg: add --dev to force local org and hash
$USER and "dev" respectively.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-11-03 17:17:53 +00:00
thebsdbox
3f544d25ed vSphere Panic Fix
This fixes issue #2635 related to no network being passed during an
image upload as no network is required. However a hostname is still
required due to vCenter handing the upload to a vSphere server and it’s
DataStore.

Signed-off-by: Dan Finneran <daniel.finneran@gmail.com>
2017-11-03 16:50:46 +00:00
Justin Cormack
c3e5d3e7c6 Merge pull request #2676 from justincormack/lint2
Some linting improvements from gometalinter
2017-11-03 16:36:19 +00:00
Ian Campbell
3410e4e988 linuxkit pkg: pull the actual tag before build
Pulling the arch suffixed version does not provide any assurance that a
previous build was actually completed.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-11-03 15:02:28 +00:00
Justin Cormack
f480e73645 Some linting improvements from gometalinter
There is more to do on these, but clean up some unused variables,
missing args, stray `\n` etc.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-11-03 15:02:18 +00:00
Marco Mariani
7f86b8363d fixed -disable-content-trust parameter description
Signed-off-by: Marco Mariani <marco.mariani@alterway.fr>
2017-10-30 17:16:25 +01:00
Marco Mariani
ce6dabfea0 add support for OS_CACERT, OS_INSECURE
Signed-off-by: Marco Mariani <marco.mariani@alterway.fr>
2017-10-30 12:12:14 +01:00
Justin Cormack
8fc857b293 Merge pull request #2643 from Wolphin-project/sec-groups
support for OpenStack security groups
2017-10-26 17:13:43 +02:00
Marco Mariani
d2a1457da7 log message fix: Info() -> Infof()
Signed-off-by: Marco Mariani <marco.mariani@alterway.fr>
2017-10-26 12:19:29 +02:00
Marco Mariani
0a2ce1a357 support for OpenStack security groups
Signed-off-by: Marco Mariani <marco.mariani@alterway.fr>
2017-10-26 12:19:01 +02:00
Justin Cormack
9ebcd04989 Merge pull request #2640 from Wolphin-project/image-server-id
Output image_id, server_id in stdout to ease automation
2017-10-25 18:17:41 +02:00
Justin Cormack
525a457bf5 Merge pull request #2634 from tomconte/azure-bootdiags
Add Azure boot diagnostics
2017-10-25 17:54:20 +02:00
Marco Mariani
5b96d96a7a output image_id, server_id in stdout to ease automation
Signed-off-by: Marco Mariani <marco.mariani@alterway.fr>
2017-10-25 14:00:40 +02:00
Thomas Conte
b80182d339 Add Azure boot diagnostics
Signed-off-by: Thomas Conte <thomas@conte.com>
2017-10-24 13:21:12 +00:00
Ian Campbell
abbda95d06 Updates for tools/* which are rebuilt with new alpine
Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-24 10:25:07 +01:00
Ian Campbell
ba3cc2fc6d linuxkit pkg: make ":latest" for non-git packages explicit
Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-20 17:18:00 +01:00
Ian Campbell
991bfd2794 linuxkit pkg: handle packages which are not in git
Detect if this is the case by checking if the given path is not in git and
conditionalising anything which would touch git.

Images built from outside git will, in the absence of options to force
otherwise, get tagged "latest".

Fixes: #2613

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-20 17:08:12 +01:00
Ian Campbell
0e31d8d1a9 linuxkit pkg: allow caller of git to specify what happens to stderr
Currently all forward it to os.Stderr, but in my next patch I will want to
direct to /dev/null for one command.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-20 17:05:37 +01:00
Ian Campbell
e42e8ceed7 linuxkit pkg: improve handling of git working directory
Ensure that all git commands are run as if from the package directory using the
`-C` option. Otherwise the various attempts to use git fail if `linuxkit pkg`
is invoked from outside the git repo.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-20 16:57:33 +01:00
Daniel Nephin
60ef22ef60 Fix GCP error printing
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-10-18 13:46:04 -04:00
Ian Campbell
fc31e3bddd linuxkit pkg: defer content trust passphrase setup until we know it is needed
Otherwise "linuxkit pkg build" etc will needlessly run the command (which might
prompt the user).

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-13 15:56:27 +01:00
Ian Campbell
dd8e3d49e8 linuxkit: allow user to configure a content trust passphrase command
Could be e.g.:
```
pkg:
  content-trust-passphrase-command: "lpass show <key> --password"
```
or
```
pkg:
  content-trust-passphrase-command: "gpg -d ~/.notary/passphrase.gpg"
```

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-13 11:41:22 +01:00
Ian Campbell
4304d5f4fd linuxkit pkg: correct behaviour when user explictly specifies a hash.
With the old package.mk arrangements we would only append -dirty and -$arch to
the hash if the user didn't specify a HASH= directly. So the following would
work
    make ORG=ijc HASH=dev tag
and produce an image `ijc/«image»:dev`.

However the new equivalent:
    linuxkit pkg build -org=ijc --hash-=dev
instead produces an image `ijc/«image»:dev-dirty-$arch`. Which is undesirable.

This commit refactors the code in two main ways:

Firstly directly append `-dirty` to the hash as we extract it from git (rather
than on use in the `Tag()` method), and only do this if the user has not
specified an explicit tag. Note that we still track dirtiness in the `Pkg`
object and so will not allow a push (or release) from a dirty tree (the
makefile version would have tried this with unpredictable results), nor will we
apply the `org.opencontainers.image.revision` label to a dirty build.

Secondly if we are not pushing the image+manifest then we retag the -$arch
suffixed image without the the -$arch. This differs from the Makefile version
which would simply have built without the -$arch in the first place, I think
this is an improvement. If we are pushing the manifest-tool remains responsible
for creating the non -$arch image.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-12 10:17:56 +01:00
Ian Campbell
2eb5dfffaa Merge pull request #2589 from ijc/linuxkit-pkg-release
linuxkit pkg: Support --release option to pkg push.
2017-10-11 11:10:23 +01:00