Commit Graph

791 Commits

Author SHA1 Message Date
Justin Cormack
4ed9d49d3a Merge pull request #168 from dnephin/improve-the-build
Improvements to Makefile, linting, and circleci.yml
2017-10-30 11:24:24 +00: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
Avi Deitcher
60c1ce5156 Add raw file formats, rename raw to aws and qcow2 to qcow2-bios
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2017-10-23 20:27:47 -04: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
Ian Campbell
d9d6b56153 Do an explicit docker pull before docker run.
This avoids https://github.com/docker/cli/issues/631

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-20 15:51:47 +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
Daniel Nephin
a224547540 Fix lint errors
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-10-17 17:30:47 -04:00
Rolf Neugebauer
67ce80d213 Fix mkimage-iso-bios hash
Looks like a6b89f1137 ("Update linuxkit/mkimage-*") updated to a
non-existing tag.

linuxkit pkg show-tag tools/mkimage-iso-bios
linuxkit/mkimage-iso-bios:165b051322578cb0c2a4f16253b20f7d2797a502

and docker pull of that image works.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-10-16 12:52:02 +02:00
ebriand
0754e4d662 Add back init image processing logging
Signed-off-by: ebriand <eric.briand@gmail.com>
2017-10-16 11:00:19 +02:00
Rolf Neugebauer
c1da07b3a8 output: Add support for creating Raspberry Pi images
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-10-13 18:02:17 +01: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
a6b89f1137 Update linuxkit/mkimage-*
These versions were created by https://github.com/linuxkit/linuxkit/pull/2607
which enables content trust, so drop the sha256 from all of them and ensure
DOCKER_CONTENT_TRUST is unconditionally set when running, since these
references are hardcoded we know they must be signed.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-13 10:56:21 +01:00
Ian Campbell
8825ca2e66 Disable network in dockerRun
AFAICT none of the callers (which all involve one of `linuxkit/mkimage-*`) have
any reason to hit the network.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-13 10:42:40 +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
Ian Campbell
861b2cbe80 linuxkit pkg: Support --release option to pkg push.
This overrides the default (which is to look for an exact git tag) and releases
just that.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-10 16:54:04 +01:00
Ian Campbell
2264bc8021 Correct typo in linuxkit pkg push help.
Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-10 16:11:48 +01:00
Ian Campbell
8f1d39cea1 Log before building or pushing.
Previously there would be a make "entering directory" hint in the logs, but
with the switch to `linuxkit pkg` that no longer occurs.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-10 16:05:15 +01:00
Ian Campbell
4df5d394e8 Bump yml
Done as follows:

    find -name build.yml | xargs dirname | while read d ; do
        t=$(linuxkit pkg show-tag $d)
        ./scripts/update-component-sha.sh --image ${t%:*} ${t#*:}
    done
    git commit -s test pkg tools blueprints examples projects/kubernetes projects/swarmd docs linuxkit.yml Makefile src

This explicitly excludes projects/* which I did not know whether to update.

Then:

    git reset --hard
    for i in init runc containerd ca-certificates sysctl dhcpcd getty rngd ; do
        o=$(git grep -h "\(image:\|-\) *linuxkit/$i:[0-9a-f]\{40\}" origin/master:linuxkit.yml | awk '// { print $2 }')
        n=$(linuxkit pkg show-tag pkg/$i)
        ./scripts/update-component-sha.sh "$o" "$n"
    done
    git commit --amend projects

This updates any projects which were using components with the same hash as the
top-level linuxkit.yml.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-10 13:23:45 +01:00
Ian Campbell
fbf23b4b9f New option linuxkit pkg build --force-dirty
Will tag as `-dirty` and prevent push etc even if the tree isn't actually
dirty.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-10 10:43:53 +01:00
Ian Campbell
12e6a85661 Make linuxkit pkg build on an unsupported arch a nop
Rather than a hard fail. This allows batch builds of a set of packages without
the surrounding loop needing to be away of the possibility.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-10 10:42:58 +01:00
Ian Campbell
57225335bc Correct manifest push without content trust
The script expects an empty second argument to mean no trust and anything else
to mean trust.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-10 10:22:24 +01:00
Ian Campbell
d11e49d113 Fixup linuxkit pkg debug output (space wrong side of variable)
Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-09 16:19:20 +01:00
Justin Cormack
70c6aebd26 Merge pull request #159 from rn/img-ref
Restructure Image and image reference code
2017-10-09 12:29:13 +01:00
Ian Campbell
896cfaab63 Rename some variables following rename of PkgSrc to Pkg
Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-09 11:24:03 +01:00
Ian Campbell
4cdc90e221 Build fields default to false, rename accordingly
Added some test cases for the boolean fields because I kept getting confused.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-06 17:43:38 +01:00
Ian Campbell
a9b0c6f889 Pass argumements to NewFromCLI as varargs
Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-06 17:42:05 +01:00
Ian Campbell
7748b59d5d Add missing file
Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-06 15:56:33 +01:00
Ian Campbell
52d1bc6395 More specific error message when docker not installed
Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-06 14:14:50 +01:00
Ian Campbell
3141ca0bef Embed scripts/push-manifest.sh into linuxkit tool
This is a bit gross, but hopefully this script will be written in go sooner
rather than later and in the meantime this avoids the need to install yet
another tool on user's systems (and get it into brew etc).

Checkin the result of `go:generate` for now. Once there are no more users of
push-manifest.sh it can be moved alongside the go code (if it hasn't been
rewritten in go along the way).

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-06 14:02:51 +01:00
Ian Campbell
c84c997383 Rename pkgsrc to pkglib
Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-06 13:38:37 +01:00
Ian Campbell
ba60937754 Implement package build, push and show-tag in linuxkit tool
This implements the proposal in #2564 and converts a handful of representative
or especially interesting (from a build PoV) packages to use it.

For now those pkg/* affected get a stub-`Makefile`, once all packages are
converted then `pkg/Makefile` can be adjusted and those stubs can be removed.

For now only `pkg/package.mk`'s functionality is implemented. In particular:

- `push-manifest.sh` remains a separate script, to enable calling it on systems
  with just the LinuxKit tools installed arrange to install it under a less
  generic name.
- `kernel` and `tools/alpine` do not use `pkg/package.mk` and those cases are
  not yet fully considered/covered.

I have updated the documentation assuming that the existing uses of
`pkg/package.mk` will be removed quite soon in a follow up PR rather than
trying to document the situation which results after just this commit.

Due to `cmd/linuxkit` now gaining a library the build needs adjusting slightly to
allow both `make bin/linuxkit` and `go build` to work.

`go vet` has forced me to write some rather asinine comments for things that
are rather obvious from the name.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-06 12:59:25 +01:00
Rolf Neugebauer
1aee0c3d30 Update Image strings before writing them out
If the YAML file contains:
  - path: etc/linuxkit.yml
    metadata: yaml
in the fil section, the image was build with content trust,
then the linuxkit.yml file image contains fully qualified
image references (including the sha256).

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-10-04 17:59:02 +01:00
Rolf Neugebauer
ad83cb8928 Use containerd reference.Spec in place of the Image string
Instead of passing the image name as string use the a reference
to a containerd reference.Spec. This allows us, for example,
to update the reference in place when verifying content trust
with more specific information, such as the sha256

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-10-04 17:37:22 +01:00
Rolf Neugebauer
d9b79548a5 Add a containerd reference.Spec for the Image name
When constructing a Moby structure from a YAML also
extract a containerd reference.Spec for each image
and the kernel.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-10-04 17:26:42 +01:00
Rolf Neugebauer
1713f59e4f Turn Images into references
We want to modify some of the content of the Image structure
and thus have to pass them by reference.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-10-04 17:26:42 +01:00
Justin Cormack
e73a7b0315 Add a "tar-kernel-initrd" output format
This is a tarball of the kernel, initrd and cmdline files, suitable for
sending to the mkimage images that expect this format.

Note you can't currently stream this output format using `-o` will clean this
up in future commits.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-10-04 17:01:13 +01:00
Justin Cormack
aca26f00c2 Remove the hyperkit option
We are going to phase out the LinuxKit build option, in favour of keeping Docker
or a native Linux build option for CI use cases, as it is faster. So the
hyperkit option that only worked in one very limited use case is not needed.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-10-03 15:55:02 +01:00