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

ci: install image from github releases #839

Merged
merged 4 commits into from
Feb 1, 2018

Conversation

jcvenegas
Copy link
Contributor

@jcvenegas jcvenegas commented Jan 11, 2018

This PR install a kernel an image from github.

Kernel:
https://github.com/clearcontainers/linux/releases

Image:
https://github.com/clearcontainers/osbuilder/releases

Both are installed using a new script install_asset.sh

install_asset.sh kernel latest 
install_asset.sh image latest 

Fixes: #838

Signed-off-by: Jose Carlos Venegas Munoz jose.carlos.venegas.munoz@intel.com

@jcvenegas jcvenegas added the WIP label Jan 11, 2018
@clearcontainersbot
Copy link

kubernetes qa-failed 👎

@chavafg
Copy link
Contributor

chavafg commented Jan 11, 2018

On the k8s execution, got this error:

Install clear-containers image
./install_clear_image.sh: line 32: python: command not found

@jcvenegas
Copy link
Contributor Author

@chavafg added python as installation dependency.

@@ -16,34 +16,31 @@

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should rename the script to install_clearcontainers_image.sh

repo_name="osbuilder"
cc_image_releases_url="https://github.com/${repo_owner}/${repo_name}/releases"

function download_image() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I see that this function has a lot in common with this one:
https://github.com/clearcontainers/tests/blob/master/.ci/install_clearcontainers_kernel.sh#L34

Do you think it would be possible to have a common function called download_component() (or something similar) and add it to the .ci/lib.sh and then just call it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, agree with that .

@clearcontainersbot
Copy link

kubernetes qa-passed 👍

@clearcontainersbot
Copy link

kubernetes qa-passed 👍

1 similar comment
@clearcontainersbot
Copy link

kubernetes qa-passed 👍

if [ "${version}" == "latest" ]; then
echo "latest_release_info_url $latest_release_info_url" >&2
release_json="$(curl -s ${latest_release_info_url})"
parse_py='
Copy link
Contributor Author

@jcvenegas jcvenegas Jan 18, 2018

Choose a reason for hiding this comment

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

Reminder to myself, dont use github api to avoid require a token.

Copy link
Contributor

Choose a reason for hiding this comment

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

:-) Just to clarify - you can use the ABI without a token, but it is then rate limited, and if a user has burnt up their allowed allocation (as one of my CI systems had), then the call will fail :-)

This PR looks like it has indeed fixed the issue on my CI - so, thanks!

@clearcontainersbot
Copy link

kubernetes qa-failed 👎

@clearcontainersbot
Copy link

kubernetes qa-passed 👍

@jcvenegas
Copy link
Contributor Author

@chavafg ci is passing with latest image published in osbuilder, please take a look.

@erick0z @jodh-intel could you take a look to this PR?

Copy link
Contributor

@jodh-intel jodh-intel left a comment

Choose a reason for hiding this comment

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

Just a few comments.

@klynnrif - could you take a look at the doc changes please?

.ci/README.md Outdated

## Clear Containers Image for CI ##

The CI environment is configured download the guest OS image from the
Copy link
Contributor

Choose a reason for hiding this comment

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

"is configured to".


repo_owner="clearcontainers"
#fake repository dir to query kernel and image version from remote
fake_repo_dir=$(mktemp -t -d cc-kernel.XXXX)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: cc-asset.XXXX (or maybe just assets.XXXX to make it more portable)?

exit 1
}

asset=$1
Copy link
Contributor

Choose a reason for hiding this comment

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

"$1"

version="$2"
[ -z "${asset}" ] && usage
[ -z "${version}" ] && usage
readonly runtime_versions_url="https://raw.githubusercontent.com/clearcontainers/runtime/master/versions.txt"
Copy link
Contributor

Choose a reason for hiding this comment

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

How about specifying the URL as:

repo=runtime

    :

readonly runtime_versions_url="https://raw.githubusercontent.com/${repo_owner}/${repo}/master/versions.txt"


resolve_version() {
local repo=$1
local version=$2
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Safest to double-quote all params (here and in functions below).

[ -n "${repo}" ] || die "repo not provided"

if [ "${version}" == "latest" ]; then
version=$(get_latest_version "${repo}")
Copy link
Contributor

Choose a reason for hiding this comment

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

You could simplify this to:

[ "${version}" == "latest" ] && version=$(get_latest_version "${repo}")

binaries_dir_fmt='image-%s-binaries'
;;
*)
die "unknown asset"
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add $asset to the error message.

"${cidir}/install_asset.sh" "image" "latest"

echo "Install Clear Containers Kernel"
"${cidir}/install_asset.sh" "kernel" "latest"
Copy link
Contributor

Choose a reason for hiding this comment

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

Sweet! 😄

@clearcontainersbot
Copy link

kubernetes qa-passed 👍

Copy link

@erick0z erick0z left a comment

Choose a reason for hiding this comment

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

lgtm

@jcvenegas
Copy link
Contributor Author

@iphutch @klynnrif @rcaballeromx, please take a look to doc changes.

@clearcontainersbot
Copy link

kubernetes qa-passed 👍

@devimc
Copy link

devimc commented Jan 31, 2018

lgtm

Approved with PullApprove Approved with PullApprove

1 similar comment
@chavafg
Copy link
Contributor

chavafg commented Jan 31, 2018

lgtm

Approved with PullApprove Approved with PullApprove

@clearcontainersbot
Copy link

kubernetes qa-failed 👎

@clearcontainersbot
Copy link

kubernetes qa-passed 👍

Python is tests depedency make sure is installed.

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
@jcvenegas jcvenegas force-pushed the pull-image-gh branch 2 times, most recently from 427cfc1 to c11957b Compare February 1, 2018 01:37
@clearcontainersbot
Copy link

kubernetes qa-failed 👎

1 similar comment
@clearcontainersbot
Copy link

kubernetes qa-failed 👎

@clearcontainersbot
Copy link

kubernetes qa-failed 👎

@clearcontainersbot
Copy link

kubernetes qa-failed 👎

Both assets kernel and image installation is similar merge it in only
one script. Add documentation about ./install_asset.sh.

- Install github image.
- Install github kernel.

Fixes: clearcontainers#838

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
remove not needed scirpts.

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
@clearcontainersbot
Copy link

kubernetes qa-failed 👎

@jcvenegas
Copy link
Contributor Author

@klynnrif @rcaballeromx ping , could you check this PR, it is ready to merge only need your +1.

Copy link

@klynnrif klynnrif left a comment

Choose a reason for hiding this comment

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

lgtm

@clearcontainersbot
Copy link

kubernetes qa-failed 👎

@jcvenegas jcvenegas merged commit d9ba61e into clearcontainers:master Feb 1, 2018
Also remove installation from fedora and ubuntu scripts and refactor
in setup.sh

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
@@ -38,6 +38,12 @@ if [ -n "$PULL_REQUEST_NUMBER" ] || [ -n "$LOCALCI_PR_NUMBER" ]; then
bash -f "${cidir}/run_fetch_branches_tool.sh"
fi

echo "Install Clear containers image"
"${cidir}/install_asset.sh" "image" "latest"
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @jcvenegas
Sorry for posting a post-merge follow up. I think this has broken the metrics Jenkins CI instance.
The root problem I think is that on the metrics CI, which is a bare metal system (as opposed to the VM Azure systems we use QA CI) - so we have clear containers installed into docker as the default runtime from the previous PR test (we don't clean/reset the whole system like we effectively do with Azure - where we get a new clean VM machine for each PR).

This results in the known build failure for osbuilder (like clearcontainers/osbuilder#8), like:

17:26:17 Step 2/9 : RUN dnf install -y qemu-img parted gdisk make gcc bc git e2fsprogs libudev-devel pkgconfig
17:26:17  ---> Running in 6220fc9fd574
17:26:25 �[91mBDB0126 mmap: Invalid argument
17:26:25 �[0m�[91mhandle_proxy_response:616:Error response received from proxy at /run/virtcontainers/pods/6220fc9fd574d56d747fe5bcd635ae18ab67dc190fca8e4b97b6a9dda0e08d2f/proxy.sock: {"msg":"vm: unknown token 7yumQLpbAES-kAnPNgsZZswCu_WH7hkFBnhpKa-bMqg="}
17:26:25 
17:26:25 /usr/libexec/clear-containers/cc-shim: Shim received an error in responseto ConnectShim command, exiting�[0mThe command '/bin/sh -c dnf install -y qemu-img parted gdisk make gcc bc git e2fsprogs libudev-devel pkgconfig' returned a non-zero code: 1
17:26:25 Makefile:114: recipe for target 'docker-build' failed

from https://clearlinux.org/cc-ci/job/clear-containers-runtime-16.04-PR/66/console

As the metrics CI system runs Ubuntu right now, I suspect we suffer from a combination of clearcontainers/osbuilder#8 and clearcontainers/osbuilder#22.

I can't think of a workaround or solution right now. The only thing that comes to mind is maybe for a system that has CC as the default runtime we will need to use the latest pre-built image or kernel from the repos rather than trying to build the latest from source.

Thoughts?

mcastelino pushed a commit to mcastelino/tests that referenced this pull request Jan 23, 2019
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.

8 participants