Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

ci: make crictl install faster and independent of CRI-O #1778

Merged
merged 1 commit into from
Jul 16, 2019

Conversation

saschagrunert
Copy link
Contributor

Fixes #1777

@chavafg
Copy link
Contributor

chavafg commented Jul 2, 2019

oh cool!
Can you please amend your commit to add a body and the Fixes: #1777?

Thanks.

@saschagrunert
Copy link
Contributor Author

Can you please amend your commit to add a body and the Fixes: #1777?

Yes, sure :)

sudo install "${GOPATH}/bin/crictl" /usr/bin
popd
crictl_version=v1.14.0
wget -qO- https://github.com/kubernetes-sigs/cri-tools/releases/download/$crictl_version/crictl-$crictl_version-linux-amd64.tar.gz \
Copy link
Contributor

Choose a reason for hiding this comment

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

@chavafg -do we only test on x86 - or do we need to make this arch independent/tolerant ?

Copy link
Contributor

Choose a reason for hiding this comment

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

oh, you are right... We currently test only x86, but I know that @Pennyzct is adding support for arm, so I think it would be good to add support for different architectures.
@saschagrunert do you think you can make the change?
I think you can use .ci/kata-arch.sh -g to get the correct arch name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alright, I will do it like this.

go install ./cmd/crictl
sudo install "${GOPATH}/bin/crictl" /usr/bin
popd
crictl_version=v1.14.0
Copy link
Contributor

Choose a reason for hiding this comment

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

also, can you please move this to https://github.com/kata-containers/tests/blob/master/versions.yaml and then get the value here using something like: crictl_version=$(get_test_version "external.crictl.version")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I will add that.

@GabyCT
Copy link
Contributor

GabyCT commented Jul 3, 2019

/test-ubuntu

go install ./cmd/crictl
sudo install "${GOPATH}/bin/crictl" /usr/bin
popd
crictl_version=$(get_test_version "externals.critools.version")
Copy link
Contributor

Choose a reason for hiding this comment

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

I went through the failure on the ubuntu job and see that it cannot find the versions.yaml file:

10:15:41 ERROR: cannot find .ci/../versions.yaml
10:15:41 Failed at 67: crictl_version=$(get_test_version "externals.critools.version")

@saschagrunert can you please move these lines before we pushd into the cri-o directory (L42)?, so that we are still on our CI working directory and can find the versions.yaml file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, thanks for pointing me to the issue 🙏

@chavafg
Copy link
Contributor

chavafg commented Jul 5, 2019

/test

echo "Get CRI Tools"
crictl_version=$(get_test_version "externals.critools.version")
wget -qO- https://github.com/kubernetes-sigs/cri-tools/releases/download/$crictl_version/crictl-$crictl_version-linux-"$(${cidir}/kata-arch.sh -g)".tar.gz \
| tar xfz - -C /usr/bin
Copy link
Contributor

Choose a reason for hiding this comment

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

seems that this needs to be sudo tar ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, I change it.

Copy link
Contributor

Choose a reason for hiding this comment

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

thanks

@saschagrunert saschagrunert force-pushed the crictl branch 3 times, most recently from 8bd6bc1 to 2ccfe5e Compare July 5, 2019 13:12
@chavafg
Copy link
Contributor

chavafg commented Jul 5, 2019

/test

@chavafg
Copy link
Contributor

chavafg commented Jul 9, 2019

@saschagrunert I went trough the issues on the CI:
The first one is that we have a failure on one of the tests

not ok 24 ctr execsync exit code
# (in test file ctr.bats, line 918)
#   `[ "$status" -ne 0 ]' failed

Taking a look at the tests, the test fails making an exec:
https://github.com/cri-o/cri-o/blob/v1.14.1/test/ctr.bats#L918

I see here that they changed the behavior of the test in this commit:
cri-o/cri-o@1551436#diff-c5753339854697f7106d65aea5be6788

So maybe the crictl version is not compatible with cri-o v1.14.1 ?
Maybe we should try with cri-o v1.14.5.

The second issue is that we an older version of cri-o (branch release-1.10) on the Fedora job as we run openshift (3.10) there and the v1.14 version of crictl is not compatible with the old cri-o version.
For this one, I think that we can add another entry for the old cri-tool (which is release-1.10)version inside the yaml file.

@saschagrunert
Copy link
Contributor Author

saschagrunert commented Jul 9, 2019

So maybe the crictl version is not compatible with cri-o v1.14.1 ?
Maybe we should try with cri-o v1.14.5.

Yeah might be. I opened up an issue in the runtime repository to bump the version.

@saschagrunert
Copy link
Contributor Author

/test

@saschagrunert
Copy link
Contributor Author

@chavafg I changed the cri tools implementation accordingly to your suggestions, do we want to go for an additional test again? :)

sudo install "${GOPATH}/bin/crictl" /usr/bin
popd
echo "Installing CRI Tools"
wget -qO- "$crictl_url" | tar xfz - -C /usr/bin
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 you are updating already existing code but I think we need a check in here to test for KATA_DEV_MODE as devs probably don't want their /usr/bin/ stamped on (but /usr/local/ would be "fair game" I think).

  • We avoid wget where possible so please could you convert this to use curl.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we could generally use /usr/local, then an additional check would not be needed right?
I changed the command to use curl instead of wget

else
crio_version=$(get_version "externals.crio.version")
crictl_version=$(get_test_version "externals.critools.version")
crictl_url=https://github.com/kubernetes-sigs/cri-tools/releases/download/$crictl_version/crictl-$crictl_version-linux-"$(${cidir}/kata-arch.sh -g)".tar.gz
Copy link
Contributor

Choose a reason for hiding this comment

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

These two crictl_url variables look identical but on closer inspection one contains a v as a version prefix and the other doesn't. Is that really correct?

If it is, please could you make this clearer by reworking the code to something like:

version_prefix=""

if [ ... ]; then
    version_prefix="v"
    # ...
else
   # ...
fi

cri_tools_site=https://github.com/kubernetes-sigs/cri-tools
cri_tools_file="crictl-${crictl_version}-linux-$(${cidir}/kata-arch.sh -g).tar.gz"

crictl_url="${cri_tools_site}/releases/download/${version_prefix}${crictl_version}/${cri_tools_file}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I adapt it as suggested.

versions.yaml Outdated

critools:
version: v1.14.0
openShift3Version: 1.0.0-beta.2
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I will add it there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created another PR to address this issue: kata-containers/runtime#1873

@grahamwhaley
Copy link
Contributor

@saschagrunert - CI resets when you push changes, so we would need to test again - but, I'll leave triggering that until you assess the feedback from @jodh-intel ;-)

sudo install "${GOPATH}/bin/crictl" /usr/bin
popd
echo "Installing CRI Tools"
crictl_url=https://github.com/kubernetes-sigs/cri-tools/releases/download/v$crictl_version/crictl-$crictl_tag_prefix$crictl_version-linux-"$(${cidir}/kata-arch.sh -g)".tar.gz
Copy link
Contributor

Choose a reason for hiding this comment

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

This variable still contains v$crictl_version ...?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is a little skew (tag vs file name) in cri-tools but it should work fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So in the end we have both urls, which are working:

https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.14.0/crictl-v1.14.0-linux-amd64.tar.gz
https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.0.0-beta.2/crictl-1.0.0-beta.2-linux-amd64.tar.gz

Copy link
Contributor

Choose a reason for hiding this comment

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

@saschagrunert can you move the Installing CRI tools section before we pushd into the cri-o repo?

10:58:02 .ci/install_crio.sh: line 70: .ci/kata-arch.sh: No such file or directory
10:58:02 Failed at 70: crictl_url=https://github.com/kubernetes-sigs/cri-tools/releases/download/v$crictl_version/crictl-$crictl_tag_prefix$crictl_version-linux-"$(${cidir}/kata-arch.sh -g)".tar.gz

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm, alright I moved it above.

popd
echo "Installing CRI Tools"
crictl_url=https://github.com/kubernetes-sigs/cri-tools/releases/download/v$crictl_version/crictl-$crictl_tag_prefix$crictl_version-linux-"$(${cidir}/kata-arch.sh -g)".tar.gz
wget -Ls "$crictl_url" | tar xfz - -C /usr/local/bin
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 you might need to re-push as this is still showing as wget.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the hint, you're right. :) Re-pushed my changes.

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.

Thanks @saschagrunert.

lgtm

@chavafg
Copy link
Contributor

chavafg commented Jul 10, 2019

/test

@chavafg
Copy link
Contributor

chavafg commented Jul 10, 2019

10:33:41 .ci/lib.sh: line 121: .ci/install_yq.sh: No such file or directory
10:33:41 ERROR: cannot find .ci/../versions.yaml
10:33:41 Failed at 62: crictl_version=$(get_test_version "externals.critools.version")

I think we need to move the pushd on L43 along with the git commands on L66-67 after the if finishes on L68 to find the files needed to get the versions

@saschagrunert
Copy link
Contributor Author

10:33:41 .ci/lib.sh: line 121: .ci/install_yq.sh: No such file or directory
10:33:41 ERROR: cannot find .ci/../versions.yaml
10:33:41 Failed at 62: crictl_version=$(get_test_version "externals.critools.version")

I think we need to move the pushd on L43 along with the git commands on L66-67 after the if finishes on L68 to find the files needed to get the versions

Yes, I moved it below.

@saschagrunert
Copy link
Contributor Author

@chavafg may I ask you to trigger a /test ? :)

@grahamwhaley
Copy link
Contributor

/test

@chavafg
Copy link
Contributor

chavafg commented Jul 15, 2019

/test

@chavafg
Copy link
Contributor

chavafg commented Jul 15, 2019

/test

popd
echo "Installing CRI Tools"
crictl_url=https://github.com/kubernetes-sigs/cri-tools/releases/download/v$crictl_version/crictl-$crictl_tag_prefix$crictl_version-linux-"$(${cidir}/kata-arch.sh -g)".tar.gz
curl -Ls "$crictl_url" | tar xfz - -C /usr/local/bin
Copy link
Contributor

Choose a reason for hiding this comment

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

can you please add sudo 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.

Yes, added it. I thought it was already there 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

yep, don't worry, I think this should be fine now 😄
/test

@saschagrunert
Copy link
Contributor Author

I guess we have to drop another /test here. 😇

@chavafg
Copy link
Contributor

chavafg commented Jul 15, 2019

ha, the trigger phrase didn't work on the review comment. Thanks for noticing it. Should work now:
/test

@saschagrunert
Copy link
Contributor Author

Hm, the Kernel Build seems to fail:

19:51:41 Failed at 62: "${kernel_repo_dir}/kernel/build-kernel.sh" -v "${kernel_version}" "build"
19:51:47 Failed at 21: "${cidir}/install_kata_kernel.sh"

@saschagrunert
Copy link
Contributor Author

Awesome, it works. Thanks for all the support guys! :)

@chavafg chavafg merged commit 5d0e2a8 into kata-containers:master Jul 16, 2019
@chavafg
Copy link
Contributor

chavafg commented Jul 16, 2019

thanks @saschagrunert

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.

ci: make crictl installation independent of CRI-O
5 participants