Commit Graph

141 Commits

Author SHA1 Message Date
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
James O. D. Hunt
3c19ea413e docs: Add a Usage section
Add a new Usage section with basic examples of how to run the
builders from the `Makefile`.

Fixes #84.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-04-26 08:06:44 +01:00
James O. D. Hunt
3e0e112e2b docs: Move TOC to top
Move the table of contents to the top of the page.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-04-23 09:16:16 +01:00
Jose Carlos Venegas Munoz
a099eafc60
Merge pull request #83 from jodh-intel/create-summary-file
refactor and create a summary file inside the image
2018-04-20 13:57:57 -05:00
James O. D. Hunt
f90f65247e rootfs: Create a summary file inside the image
Create a YAML metadata file inside the rootfs image
containing information about the environment:

```
/var/lib/osbuilder/osbuilder.yaml
```

Example contents:

```
---
osbuilder:
  url: "https://github.com/kata-containers/osbuilder"
  version: "unknown"
rootfs-creation-time: "2018-04-19T16:19:30.254610305+0000Z"
description: "osbuilder rootfs"
file-format-version: "0.0.1"
architecture: "x86_64"
base-distro:
  name: "Centos"
  version: "7"
  packages:
    - "iptables"
    - "systemd"
agent:
  url: "https://github.com/kata-containers/agent"
  name: "kata-agent"
  version: "0.0.1-2ec0b9593845b9a5e0eab5a85b20d74c35a2ca52-dirty"
  agent-is-init-daemon: "no"
```

This change adds a new `-o` option to `rootfs.sh` for
specifying the version of osbuilder to the rootfs builder.

Fixes #35.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-04-20 11:46:55 +01:00
James O. D. Hunt
93b632c328 lib: Check rootfs parameter
Add a check on the rootfs parameter in `build_rootfs()`.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-04-20 11:17:55 +01:00
James O. D. Hunt
b14d117a89 image-builder: Fix incorrect error message
Fixed an error message which was referring to an incorrect rootfs
variable name.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-04-20 11:17:15 +01:00
James O. D. Hunt
ddb71e8ef5 initrd: Remove mention of USE_DOCKER
Removed `USE_DOCKER` from the initrd builder usage statement as that
builder does not use Docker.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-04-20 11:17:02 +01:00
James O. D. Hunt
f17b5c29f3 scripts/lib: Fix whitespace
Make whitespace consistent.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-04-20 08:29:27 +01:00
James O. D. Hunt
5b6ced536b rootfs/clearlinux: Resolve version
If the Clear Linux `OS_VERSION` is specified as `latest`,
resolve to an actual release number.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-04-20 08:29:27 +01:00
James O. D. Hunt
a2a65621a1 rootfs: Simplify code
Use more variables to avoid duplication and make the code cleaner.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-04-20 08:29:27 +01:00
James O. D. Hunt
b8f1a68834 rootfs: Simplify code
Use a variable in `copy_kernel_modules()` to avoid the duplicated
string.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-04-20 08:29:27 +01:00
James O. D. Hunt
f09d4c4626 rootfs: Check function parameters
Add some checks to ensure function parameters are set.

This fixes a bug `copy_kernel_modules()` where a test would never
fail due to missing dollars.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-04-20 08:29:27 +01:00
James O. D. Hunt
2751de0768 rootfs: Reformat functions
For consistency with the rest of the code, put the opening brace on the
line below the function name.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-04-20 08:29:27 +01:00