Commit Graph

304 Commits

Author SHA1 Message Date
Nitesh Konkar
22f04db80d travis: Enable travis ci for ppc64le
Fixes: #122

Signed-off-by: Nitesh Konkar <niteshkonkar@in.ibm.com>
2018-06-29 21:15:43 +05:30
Stefan Hajnoczi
a7bafc53c9 initrd-builder: make initrd_builder.sh idempotent
If initrd_builder.sh fails partway through it may not be possible to run
it again without creating a new rootfs.

This happens because initrd_builder.sh checks for the presence of
/sbin/init and refuses to run if it is missing.  Later on, the script
moves /sbin/init to /init, where the kernel expects to find it in an
initramfs.  After this step initrd_builder.sh will refuse to run again
since /sbin/init is now missing.

Create a symlink from /init to /sbin/init instead of moving the file.
This allows initrd_builder.sh to be run repeatedly on the same rootfs.

Fixes: #130
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2018-06-29 15:08:56 +01:00
James O. D. Hunt
4064a4ccb7
Merge pull request #128 from stefanha/image-builder-early-root-check
image-builder: require root earlier for better error messages
2018-06-29 08:38:17 +01:00
Stefan Hajnoczi
7b1bbac600 image-builder: require root earlier for better error messages
The image_builder.sh script must be run as root.  The following check is
performed before the script checks for root:

  [ "${AGENT_INIT}" == "yes" ] || [ -x "${ROOTFS}/usr/bin/${AGENT_BIN}" ] || \
      die "/usr/bin/${AGENT_BIN} is not installed in ${ROOTFS}
      use AGENT_BIN env variable to change the expected agent binary name"

The -x test is "True if the file is executable by you".  It may evaluate
to true as root and false as non-root, depending on the file
permissions.

The permissions for kata-agent given in the Developer Guide are 0550
(https://github.com/kata-containers/documentation/blob/master/Developer-Guide.md#add-a-custom-agent-to-the-image---optional).

Therefore image_builder.sh fails with "/usr/bin/${AGENT_BIN} is not
installed" when run as non-root.  This is confusing since the agent
binary is really installed!

Move the root check to the beginning of the script.  This solves the
confusing error and prevents similar problems where the script doesn't
take into account that the user may be non-root.

Fixes: #127
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2018-06-28 14:16:26 +01:00
Jose Carlos Venegas Munoz
ac0c29012f
Merge pull request #124 from devimc/dockerfile/supportProxy
builder: support proxy in distros based on yum or dnf
2018-06-26 10:52:43 -05:00
Julio Montes
52d015e283 builder: support proxy in distros based on yum or dnf
proxy server must be specified in configuration file
of the package manager, /etc/yum.conf for yum or
/etc/dnf/dnf.conf for dnf

fixes #123

Signed-off-by: Julio Montes <julio.montes@intel.com>
2018-06-26 10:17:07 -05:00
Salvador Fuentes
ae5b40ab88
Merge pull request #114 from jodh-intel/kata-manager-update
tests: Update kata-manager command
2018-06-25 17:49:58 -05:00
James O. D. Hunt
43a2ea4155 tests: Run EulerOS tests last
The EulerOS repository servers can be a little slower to respond than
others. This can lead to timeout issues so move the EulerOS tests to
the end to give the other tests a chance to run.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-06-25 15:06:52 +01:00
James O. D. Hunt
7b581c25d8 tests: Convert bats test to shell script
The tests perform a lot of configuration and call other commands. Since
the tests are running under BATS, any "stdout pollution" results in the
test failing. This is too rigid for current purposes so convert the
BATS test into a `set -e` test. This will still fail if any command
fails, but does not impose the output pollution restriction. It also
makes debugging easier.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-06-25 15:06:49 +01:00
James O. D. Hunt
5b9b69a4b7 tests: Update kata-manager command
The `kata-manger.sh` utility is changing its behaviour so that
`install-packages` *only* installs packages (no container manager).
Update the command to both install Docker and the packages.

Fixes #113.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-06-25 14:03:56 +01:00
Graham Whaley
8e577c19d6
Merge pull request #121 from jodh-intel/fix-static-checks
CI: Fix static-checks script invocation
2018-06-25 13:56:03 +01:00
James O. D. Hunt
547c477f4e CI: Fix static-checks script invocation
The `static-checks.sh` script now requires the repo as an argument.

Fixes #120.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-06-25 11:51:02 +01:00
Jose Carlos Venegas Munoz
72dca93263
Merge pull request #112 from Pennyzct/centos-rootfs
Support building centos-rootfs on Arm64
2018-06-13 09:48:11 -05:00
Penny Zheng
0451db9f4e rootfs-builder: Support building centos-rootfs on Arm64
For now, mirrorlist doesn't support non-x86_64 arch, so we need
create baseurl for arm64. Furthermore, we also need to offer
arm64-specific gpg keys along with the regular key.

Fixes: #111

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
2018-06-13 07:21:17 +00:00
James O. D. Hunt
3375e736c9
Merge pull request #117 from Pennyzct/rm
rootfs: add '-rm' to delete intermediate container
2018-06-12 09:55:59 +01:00
Penny Zheng
e86380aab7 rootfs: add '-rm' to delete intermediate container
If we set env USE_DOCKER true, we will use container as development
environment. After docker run command, this temporary container
would be no use. we could add -rm flag to automatically delete
intermediate container.

Fixes: #115

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
2018-06-12 08:16:56 +00:00
Jose Carlos Venegas Munoz
bdb776d073
Merge pull request #109 from nitkon/patch-1
Update README: Fix a minor space issue
2018-06-07 14:22:14 -05:00
Nitesh Konkar
11d1d07c04 docs: Update README, Fix a minor space issue
Fixes: #108

Signed-off-by: Nitesh Konkar <niteshkonkar@in.ibm.com>
2018-06-07 19:45:08 +05:30
Julio Montes
6e3ed1b649
Merge pull request #103 from JerryOpenix/develop
rootfs: correct rootfs script deference var value
2018-06-07 09:11:14 -05:00
Salvador Fuentes
15a5b3c3f7
Merge pull request #105 from chavafg/topic/fix-centos-setup
CI: use yum for resolving centos dependencies
2018-06-06 14:00:21 -05:00
Salvador Fuentes
70155353a1 CI: Install epel-repositories for centos
yamllint and moreutils packages are available in the
epel repositories from centos.

Signed-off-by: Salvador Fuentes <salvador.fuentes@intel.com>
2018-06-06 10:42:10 -05:00
Salvador Fuentes
9f84cc8f1c CI: Install bats from sources
CentOS and some versions of Ubuntu do not provide
bats in their default repository. This change installs
bats from sources.

Signed-off-by: Salvador Fuentes <salvador.fuentes@intel.com>
2018-06-06 09:30:19 -05:00
Salvador Fuentes
6c8c60db8a CI: use yum for resolving centos dependencies
`.ci/setup.sh` is using dnf instead of yum to install
centos dependencies. This fixes it to use yum.

Fixes: #104.

Signed-off-by: Salvador Fuentes <salvador.fuentes@intel.com>
2018-06-06 08:00:02 -05:00
Liu Changcheng
a81e771573 rootfs: correct rootfs script deference var value
shell usage function use wrong way to get AGENT_BIN value

Fixes #103

Signed-off-by: Liu Changcheng <changcheng.liu@intel.com>
2018-06-06 14:05:03 +08:00
Jose Carlos Venegas Munoz
343c0b4299
Merge pull request #102 from jodh-intel/test-create-container
tests: Test generated images and initrd's (+ cleanups)
2018-06-05 12:12:55 -05:00
James O. D. Hunt
4ae6d31d3e tests: Test generated images and initrd's
After building the images, perform a very basic test by configuring
the runtime to use them and creating a container.

Fixes #97.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-06-04 10:04:30 +01:00
James O. D. Hunt
340d7b2ad5 tests: Rename function for brevity
Renamed the `build_rootfs_image_initrd` function to `create_images`.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-05-30 16:29:10 +01:00
James O. D. Hunt
3a8da5f108 tests: Pass parameters to functions
Try to minimise the use of globals by passing parameters to the
remaining functions.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-05-30 16:29:09 +01:00
James O. D. Hunt
c8e7f4253e tests: Remove stale rootfs tree
Remove the rootfs tree before attempting to generate one to avoid
picking up any stale information if the function is run multiple times.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-05-30 16:29:09 +01:00
James O. D. Hunt
1c251bdf05 tests: Move osbuilder metadata var to top
Moved the variable specifying the path to the osbuilder metadata file
to the top of the script and made it readonly.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-05-30 16:29:09 +01:00
James O. D. Hunt
c69eb00f9b tests: Make all globals readonly
Some of the globals were set as read-only variables whilst others
weren't. However, they can all be read-only.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-05-30 16:29:09 +01:00
James O. D. Hunt
aeb59479cb tests: Don't pass size option to image builder
As the comment in the code showed, now that
https://github.com/kata-containers/osbuilder/issues/25 is fixed, it is
no longer necessary to specify an image size to the image builder as it
will auto-calculate it.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-05-30 16:29:09 +01:00
James O. D. Hunt
60e1e7bc31 tests: cleanup bats tests
Removed redundant `function` keyword and extraneous blank lines.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-05-30 16:29:08 +01:00
Graham Whaley
2569cfa34c
Merge pull request #101 from jodh-intel/default-to-host-arch
rootfs: Default to host architecture
2018-05-25 11:26:50 +01:00
James O. D. Hunt
c1d22f98f6 rootfs: Default to host architecture
Don't default to a hard-coded Intel architecture - default to the host
architecture.

This requires the `coreutils` package to be installed both inside each
docker image (for `USE_DOCKER=true`) and in the host environments.

Added missing SPDX headers to `Dockerfile` templates to pacify the CI checks.

Fixes #100.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-05-25 10:09:28 +01:00
James O. D. Hunt
a12618811d
Merge pull request #99 from jodh-intel/image-require-systemd
Image require systemd
2018-05-18 15:54:55 +01:00
James O. D. Hunt
aca45c5820 image: Require systemd
Building an image requires systemd to be installed in the rootfs as the
init daemon, so assert that systemd is available.

Updated tests so that alpine is only tested as an initrd (it cannot be
an image as it doesn't use systemd).

Added warning note about alpine to the docs.

Fixes #98.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-05-18 13:01:08 +01:00
James O. D. Hunt
171eceb426 image: Use variable for referring to init
Use a variable rather than hard-coding the expected init daemon path.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-05-18 11:04:14 +01:00
James O. D. Hunt
d25a591def
Merge pull request #95 from stefanha/fix-copy_kernel_modules-dest_dir
rootfs: copy kernel modules to correct location
2018-05-17 07:08:46 +01:00
Stefan Hajnoczi
fd8d9bdc2c rootfs: copy kernel modules to correct location
Commit b8f1a68834 ("rootfs: Simplify
code") introduced a variable called destdir but accidentally used
dest_dir with cp(1) instead.  This causes kernel modules to be copied to
the wrong location.

Rename the variable to dest_dir to be consistent with module_dir and
rootfs_dir variables used in this function.

Fixes: #94
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2018-05-16 17:41:29 +01:00
Julio Montes
8de92c03c9
Merge pull request #93 from jodh-intel/add-extra-pkgs-to-summary
rootfs: Add extra packages to summary file
2018-05-16 10:28:11 -05:00
Peng Tao
be77118243
Merge pull request #91 from Pennyzct/agent_version
rootfs.sh: Add "${AGENT_VERSION}"/"-a" functionality
2018-05-16 16:05:24 +08:00
Penny Zheng
7732e0407a rootfs: Fix incorrect getopts call
The `getopts` call in the rootfs builder was incorrect
meaning the `-a $agent_version` option would never have worked.

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
2018-05-16 03:14:35 +00:00
Penny Zheng
f7f267213c rootfs: Add "${AGENT_VERSION}"/"-a" functionality
For now, the flag "-a" or relevant shell variant "${AGENT_VERSION}"
hasn't been used, only defined. Using 'git checkout' command to go
into requested branch.

Fixes: #90

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
2018-05-16 03:14:25 +00:00
James O. D. Hunt
3151f35c86 rootfs: Add extra packages to summary file
Added the extra packages the user requested to the summary file as
previously only the default packages were listed.

Fixes #92.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-05-14 14:39:49 +01:00
Peng Tao
49e3f814bc
Merge pull request #86 from Pennyzct/gopath
kata/osbuilder: Add support for multiple GOPATH directories
2018-04-27 19:11:23 +08:00
Penny Zheng
c3ac7180f8 rootfs: Add support for multiple GOPATH directories
Current rootfs.sh fails when GOPATH is a set of directories.We
simply choose the first one as the working directory, as go get
only works against the first item in the GOPATH.

Fixes: #87

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
2018-04-27 02:44:43 +00:00
Graham Whaley
35269d2db4
Merge pull request #88 from stefanha/fix-paratition-typo
image-builder: fix "paratition" typo
2018-04-26 11:15:36 +01:00
Stefan Hajnoczi
32aee00673 image-builder: fix "paratition" typo
Fixes: #89
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2018-04-26 10:26:06 +01:00
James O. D. Hunt
cc33986bef
Merge pull request #85 from jodh-intel/improve-top-README
docs: Add a Usage section
2018-04-26 08:52:28 +01:00