-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added docker buildx support in cico scripts. #109
Conversation
@AndrienkoAleksandr Could you please trigger build for this PR on ci.centos? |
Signed-off-by: Prabhav Thali <[email protected]>
8170d8a
to
b970b3b
Compare
cico_functions.sh
Outdated
echo 'CICO: Dependencies installed' | ||
} | ||
|
||
function version() { | ||
printf '%02d' $(echo "$1" | tr . ' ' | sed -e 's/ 0*/ /g') 2>/dev/null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this code always work like expected?
For me:
$ uname -a
5.5.17-200.fc31.x86_64
result of function:
$ printf '%02d'
0505170000
Maybe we could simple split by '-':
$ kernel_version=$(uname -r); echo ${kernel_version%%-*}
5.5.17
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We wanted comparison between 2 whole numbers, checking whichever is greater, for this reason we added this check. This code is working as per our expectation. Do you sense any possible issue in this?
Code :-
# Kernel
kernel_version="$(uname -r)"
if [[ "${kernel_version%%-*}" < "4.8" ]]; then
echo >&2 "Kernel $kernel_version too old - need >= 4.8." \
" Install a newer kernel."
else
echo >&2 "kernel $kernel_version has binfmt_misc fix-binary (F) support."
fi
If kernel Version = 3.10.0-1062.el7 (Works as expected)
Condition : 3.10.0 < 4.8
O/P : Kernel 3.10.0-1062.el7 too old - need >= 4.8. Install a newer kernel.
If Kernel Version = 4.15.0-66-generic (Doesn't work as expected)
Condition : 4.15.0 < 4.8
O/P : Kernel 4.15.0-66-generic too old - need >= 4.8. Install a newer kernel.
If kernel Version = 5.5.17-200.fc31 (Works as expected)
Condition : 5.5.17 < 4.8
O/P : kernel 5.5.17-200.fc31.x86_64 has binfmt_misc fix-binary (F) support.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, it's make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AndrienkoAleksandr Could you please tell me whether you are testing these changes on env similar to ci.centos?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On F31, I get:
$➔ cat /etc/os-release | grep NAME
NAME=Fedora
VERSION_CODENAME=""
PRETTY_NAME="Fedora 31 (Thirty One)"
CPE_NAME="cpe:/o:fedoraproject:fedora:31"
$➔ kernel_version="$(uname -r)"
$➔ if [[ "${kernel_version%%-*}" < "4.8" ]]; then
> echo >&2 "Kernel $kernel_version too old - need >= 4.8." \
> " Install a newer kernel."
> else
> echo >&2 "kernel $kernel_version has binfmt_misc fix-binary (F) support."
> fi
kernel 5.6.15-200.fc31.x86_64 has binfmt_misc fix-binary (F) support.
On RHEL7.7:
+ cat /etc/os-release
+ grep NAME
NAME="Red Hat Enterprise Linux Server"
PRETTY_NAME="Red Hat Enterprise Linux Server 7.7 (Maipo)"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.7:GA:server"
++ uname -r
+ kernel_version=3.10.0-957.el7.x86_64
+ [[ 3.10.0 < 4.8 ]]
+ echo 'Kernel 3.10.0-957.el7.x86_64 too old - need >= 4.8.' ' Install a newer kernel.'
Kernel 3.10.0-957.el7.x86_64 too old - need >= 4.8. Install a newer kernel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also on the side of this being too fragile here. Apparently sort
has a flag (-V
) for sorting version numbers, so something like
function check_version() {
local query=$1
local target=$2
echo "$target" "$query" | tr ' ' '\n' | sort -V -c 2> /dev/null
}
could work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@amisevsk Thanks for the suggestion. Implemented version check using sort
with -V
. Please review.
I asked QA to help us test this changes on the Centos ci. It is important to take a look how it works on the changed job. I afraid that this pr will damage job, because I tested this changes locally on the fedora 31. And I saw that build hangs for me on the arch linux/s390x . Centos based on fedora... |
@AndrienkoAleksandr Thanks for getting these changes tested on Centos ci. Could you please provide your env details? Such that we can try out at our end. |
Signed-off-by: Prabhav Thali <[email protected]>
6f96464
to
cf3297a
Compare
cico_functions.sh
Outdated
echo 'CICO: Dependencies installed' | ||
} | ||
|
||
function version() { | ||
printf '%02d' $(echo "$1" | tr . ' ' | sed -e 's/ 0*/ /g') 2>/dev/null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also on the side of this being too fragile here. Apparently sort
has a flag (-V
) for sorting version numbers, so something like
function check_version() {
local query=$1
local target=$2
echo "$target" "$query" | tr ' ' '\n' | sort -V -c 2> /dev/null
}
could work
Signed-off-by: Prabhav Thali <[email protected]>
Signed-off-by: Prabhav Thali <[email protected]>
@AndrienkoAleksandr As we used latest |
@AndrienkoAleksandr any update? |
Sorry, Some time ago I asked QA about set up test job and check this pr. But they were busy. I will ask them again. Without test job we don't know how this change will affect CI. |
@AndrienkoAleksandr: I am sorry, but QE team doesn't support che-machine-exec build scripts at the moment, and we don't have enough expertise to verify corresponding changes. |
@dmytro-ndp |
cico_functions.sh
Outdated
@@ -33,6 +33,30 @@ function load_jenkins_vars() { | |||
fi | |||
} | |||
|
|||
function check_version() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@prabhav-thali could you please make the function name more descriptive. For me it is not clear what exactly 'check_version' does
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the function name and added docs for the same.
cico_functions.sh
Outdated
export DOCKER_CLI_EXPERIMENTAL=enabled | ||
|
||
#Enable qemu and binfmt support | ||
docker run --rm --privileged docker/binfmt:66f9012c56a8316f9244ffd7622d7c21c1f6f28d |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this tag expected to be used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes @ibuziuk The tag is expected to be used. Available tags for the image docker/binfmt can be found [here].(https://hub.docker.com/r/docker/binfmt/tags)
Also, updated the tag to the latest one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a couple of comments but in general LGTM
|
||
#set buildx env | ||
export DOCKER_BUILD_KIT=1 | ||
export DOCKER_CLI_EXPERIMENTAL=enabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit iffy about relying on experimental features from Docker but if this is the One True Way to do multiarch builds, then so be it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The buildah
discussion appears to be here: containers/buildah#1590
Renamed method check_version Extracted docker buildx in separate method Signed-off-by: Prabhav Thali <[email protected]>
function check_buildx_support() { | ||
docker_version="$(docker --version | cut -d' ' -f3 | tr -cd '0-9.')" | ||
if [[ $(check_supported_version "$docker_version" "19.03") != 19.03 ]]; then | ||
echo "CICO: Docker $docker_version greater than or equal to 19.03 is required." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just suspect that centos CI has the version lower than 19.03 - we might need to install new version of docker manually
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving this PR conceptually, but CI will very likely to fail due to the fact that it is unlikely that 19.03
version of docker will be installed by default on centos CI. So, the solution would be installing the right version of docker in the scripts. please wait for @nickboldt approval before merging
@ibuziuk @nickboldt @AndrienkoAleksandr Any update? |
I haven't had time to look at this, as it doesn't impact downstream builds at all.
Can you make that change? @mkuznyetsov do you have any thoughts on whether this will work? |
I don't have access to the CI to check this pr... |
As the cico scripts are no longer being maintained (centos CI is EOL) this PR will never be merged. Instead, please submit a new PR with code that calls a PLATFORMS file and runs buildx like this: https://github.com/eclipse/che-plugin-registry/blob/master/.ci/sidecar-build-publish.sh#L31-L35 See also: |
Signed-off-by: Prabhav Thali [email protected]
What does this PR do?
Adds docker buildx support in cico scripts to build multi-arch images.
What issues does this PR fix or reference?
This refers to #17124