Skip to content
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

allow choosing the test docker image #314

Merged
merged 13 commits into from
Mar 6, 2020

Conversation

mattip
Copy link
Collaborator

@mattip mattip commented Feb 28, 2020

I opened a new github org multi-build to hold recipes for new docker images for testing, and pushed a few to the dockerhub organization "multibuild". This PR adds an option to use them, and modifies 2 CI runs.

If this looks good, I can push more images to docker hub: xenial32 and bionic64, maybe reproduce the trusty ones too?

@mattip
Copy link
Collaborator Author

mattip commented Feb 28, 2020

Hmm, I don't actually see any use of install_run in tests :(. Am I missing something?

@matthew-brett
Copy link
Collaborator

How about allowing an arbitrary test image with something like : https://github.com/matthew-brett/multibuild/pull/103 ?

See: https://github.com/matthew-brett/multibuild/issues/311#issuecomment-589696498

@mattip
Copy link
Collaborator Author

mattip commented Feb 28, 2020

I think #103 is what I did with this PR: by specifying MB_TEST_VER you use a different docker test image when testing. What did I miss? My comment about install_run was referring to this repo's CI actually testing that install_run works. I did test this PR in the numpy-wheels repo and it does what I wanted, but I was hoping it would get tested here.

@matthew-brett
Copy link
Collaborator

Oops - sorry - forgive my rush - you're right. If there was something coherent in my reply (there may not have been), it was wondering whether we should add the implicit constraint that the images have to have bitness tags associated with them. For example, do we want to constrain any testing images to have 32 or 64 tags? Or, should we allow arbitrary image names?

Is MB_TEST_VER the right variable? Maybe DOCKER_TEST_IMAGE, by comparison to the earlier PR?

@mattip
Copy link
Collaborator Author

mattip commented Feb 28, 2020

fixed up:

  • changed to DOCKER_TEST_IMAGE
  • image name must be complete (defaults to previous behaviour)
  • update README
  • actually run install_run in the tests to make sure the image works

@mattip
Copy link
Collaborator Author

mattip commented Feb 28, 2020

running install_run pointed out some problems:

  • my xenial64 image was wrong
  • missing test images for aarch64, s390x, ppc64le
    and some macOS problem.

@matthew-brett
Copy link
Collaborator

Now I think about it - I wonder whether we can make this be (optionally) a format string, as in the default would be something like matthewbrett/trusty:${plat}, and we do substitution. Now I'm trying to deal with the annoying repetion of test images for each grid entry - so a compromise with your earlier solution.

Of course this wouldn't match what we do with DOCKER_IMAGE, but perhaps we could deprecate that, copy it over to DOCKER_BUILD_IMAGE, if present, and set that to a default ofquay.io/pypa/manylinux{$MB_ML_VER}_${plat}. What do you think?

@mattip
Copy link
Collaborator Author

mattip commented Feb 28, 2020

For: you only need to give the base image name, the rest should have been set up by the image builders
Against: harder to figure out what is actually going on, you need to be a bash expert. How do we actually do the escaping of matthewbrett/trusty:${plat} in the travis.tml?

As an aside: Is there an "image naming for dummies" guide? I don't understand when the : is a qualifier and when it is a marker of a version of a specific image

@matthew-brett
Copy link
Collaborator

We could make a format-stringey thing like this:

DOCKER_TEST_IMAGE="mattip/xenial:{bitness}"
docker_test_image="${DOCKER_TEST_IMAGE/\{bitness\}/$bitness}"

The complexity would only be apparent for those who wanted to use it. So:

DOCKER_TEST_IMAGE="mattip/xenial_something"
docker_test_image="${DOCKER_TEST_IMAGE/\{bitness\}/$bitness}"

gives the expected result of the unchanged "mattip/xenial_something".

The stuff after the colon is up the the image author - I don't know what the traditions are, of course it could be a version.

@mattip
Copy link
Collaborator Author

mattip commented Feb 29, 2020

The test images do not like using MB_PYTHON_VERSION=pypy3.6-7.3 since the choose_python.sh (in the docker images) script's py_nodot assumes MB_PYTHON_VERSON is a string like 3.8 or 2.7. Fixing, and adding some PyPy versions to the image. If the desired version is not found, choose_python will download, unpack, and put it on the path.

@mattip
Copy link
Collaborator Author

mattip commented Feb 29, 2020

I think the content after the : is meant to be a tag like latest or a hash. See for instance the pypa images for manylinux2014 images. Clicking on the far right download icon gives a doownload like docker pull quay.io/pypa/manylinux2014_ppc64le:2020-02-29-9dfc632. So we should be calling the trusty images trusty_x86_64 and trusty_i686 to be consistent with the docker images used to build the wheels. Then we can use a tag system for reproducible builds

@mattip
Copy link
Collaborator Author

mattip commented Feb 29, 2020

If we go with more standard names for the images, we could do

PLAT=x64_86
DOCKER_TEST_IMAGE="multibuild/xenial_{PLAT}:latest"
local docker_test_image="${DOCKER_TEST_IMAGE/\{PLAT\}/$PLAT}"

@matthew-brett
Copy link
Collaborator

Fine with me.

@matthew-brett
Copy link
Collaborator

Yes, that's definitely cleaner, thanks. What do you think about refactoring DOCKER_IMAGE / DOCKER_BUILD_IMAGE ?

@matthew-brett
Copy link
Collaborator

matthew-brett commented Mar 2, 2020

Sorry - I was thinking of something like:

if [ -n '$DOCKER_IMAGE" ]; then
    echo "DOCKER_IMAGE deprecated, please use DOCKER_BUILD_IMAGE"
    if [ -n "$DOCKER_BUILD_IMAGE" ]; then
        echo "Cannot use DOCKER_BUILD_IMAGE and DOCKER_IMAGE at the same time."
        echo "We recommend you unset DOCKER_IMAGE"
        exit 1
    fi
    DOCKER_BUILD_IMAGE=$DOCKER_IMAGE
fi

and then allowing DOCKER_BUILD_IMAGE to use the format var stuff, so the default might be:

DOCKER_BUILD_IMAGE=quay.io/pypa/manylinux{MB_ML_VER}_{PLAT}

@mattip
Copy link
Collaborator Author

mattip commented Mar 2, 2020

I will back out the changes I made. Those deep changes would need tests and a set of docker images close-to-but-not-exactly manylinux in order to be able to prove it works.

@mattip mattip force-pushed the test-images branch 2 times, most recently from be87db9 to 3d9327e Compare March 2, 2020 17:48
@mattip
Copy link
Collaborator Author

mattip commented Mar 3, 2020

Note the problems started when I added install_run $PLAT to the tests, so I hope they show up in gh-315

@matthew-brett
Copy link
Collaborator

Maybe try merging gh-315 into this branch. There are failures on xcode 8.0 and 7.3 that look unrelated, with errors in updating homebrew.

@mattip
Copy link
Collaborator Author

mattip commented Mar 3, 2020

Merging gh-315 made even the most basic linx64 CI run fail since no-one defines PYTHON_EXE.

@matthew-brett
Copy link
Collaborator

Interesting - I wonder why I didn't see that in my tests?

I think the test is incorrect though - it's reasonable to require PYTHON_EXE there - it only makes sense for the particular Python you're installing into etc, not any generic Python. Just inserting PYTHON_EXE=${PYTHON_EXE:-python} above the test line should be fine.

@mattip
Copy link
Collaborator Author

mattip commented Mar 3, 2020

I wonder why I didn't see that in my tests?

I think all the travis tests are failing on gh-315. Until that is ready I tried using python -mpip instead, which some people consider best practice anyway. It is slowly churning through the mac builds now ...

@matthew-brett
Copy link
Collaborator

matthew-brett commented Mar 3, 2020 via email

@mattip
Copy link
Collaborator Author

mattip commented Mar 3, 2020

It seems you are right, the test failed because it is using python2 instead of python3.7

@mattip
Copy link
Collaborator Author

mattip commented Mar 3, 2020

Just inserting PYTHON_EXE=${PYTHON_EXE:-python} above the test line should be fine

Which test line?

@matthew-brett
Copy link
Collaborator

matthew-brett commented Mar 3, 2020 via email

@mattip
Copy link
Collaborator Author

mattip commented Mar 3, 2020

If I do that tests might pass, but then when a real project uses install_run, where will PYTHON_EXE be set? I see where it happens in docker_build_wrap.sh and in osx_utils.sh, but where does it get done for docker_test_wrap.sh ?

The readme says the travis run should have a before_install step that calls travis_steps.sh, I don't see that in this repo's .travis.yml. Maybe that is the problem?

@matthew-brett
Copy link
Collaborator

matthew-brett commented Mar 3, 2020 via email

@mattip
Copy link
Collaborator Author

mattip commented Mar 4, 2020

The macOS xcode 7.3 and 8.0 builds failed brew update with remote: Invalid username or password. These were released in May and Sept 2016 respectively. Are they still supported? In any case, I think this PR is ready for final review, those failures are not connected to it.

Copy link
Collaborator

@matthew-brett matthew-brett left a comment

Choose a reason for hiding this comment

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

A couple of small things.

common_utils.sh Outdated
if [ -z "$supported_wheels" ]; then
echo "ERROR: no supported wheels found"
ls $wheelhouse/*.whl
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe an echo here to say this is the listing of the wheelhouse directory?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I will revert the addition, it didn't really help me debug the problem.

@@ -4,43 +4,11 @@
MULTIBUILD_DIR=$(dirname "${BASH_SOURCE[0]}")
source $MULTIBUILD_DIR/common_utils.sh

# UNICODE_WIDTH selects "32"=wide (UCS4) or "16"=narrow (UCS2/UTF16) builds
Copy link
Collaborator

Choose a reason for hiding this comment

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

Doesn't this need to go with cpython_path?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixing and adding a big comment

@mattip
Copy link
Collaborator Author

mattip commented Mar 5, 2020

the same two outdated xcode 7.3 and 8.0 builds are failing.

local docker_image="matthewbrett/trusty:$bitness"
else
# aarch64 is called arm64v8 in Ubuntu
local plat_subst=$([ "$plat" == aarch64 ] && echo arm64v8 || echo $plat)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this constrain the test image to be Ubuntu, at least for the PLAT substitution case?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't know. Is arm64v8 an Ubuntu invention? I was using the base-docker image tags here, which are up to date vs the aarch64 ones which seem stale. google trends doesn't see any hits for arm64v8.

It would be easy enough to change this if needed. I think the chances of anyone but us building test images is quite small: it took me a few iterations to get the choose_python script to work properly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just one more note for people who come back to this: travis calls it arm64

@matthew-brett
Copy link
Collaborator

Ok - then - I propose merging - OK with you?

@mattip
Copy link
Collaborator Author

mattip commented Mar 6, 2020

Yes, I think it is ready for merge.

@matthew-brett matthew-brett merged commit 3bd75ee into multi-build:devel Mar 6, 2020
@matthew-brett
Copy link
Collaborator

Thanks Matti.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants