-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Drop Dockerfile in test images #1792
Conversation
Hi @yolo3301. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: yolo3301 If they are not already assigned, you can assign the PR to them by writing The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
I'm fine with dropping Dockerfiles. They were actually a leftover from the time where the first test apps were written in NodeJS. :) Yes, this will break the E2E tests. I think it makes sense moving the test images to a single location as you proposed; now they can even share common code and stuff. Even better, this change would allow the |
@adrcunha I made some updates. But I couldn't verify much because I couldn't run e2e-tests.sh successfully. Does it require access to test-infra? Some doc would be helpful. |
Thanks for doing this, yolo3301.
|
@@ -102,24 +102,20 @@ go test -v -tags=e2e -count=1 ./test/e2e --resolvabledomain | |||
The [`upload-test-images.sh`](./upload-test-images.sh) script can be used to build and push the | |||
test images used by the conformance and e2e tests. It requires: |
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.
Please note here that this is now only required when running the tests locally.
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.
Done
test/README.md
Outdated
|
||
The new test images will also need to be uploaded to the e2e tests Docker repo. You will need one | ||
of the owners found in [`/test/OWNERS`](OWNERS) to do this. | ||
New test images should be placed `./test/test_images`. |
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.
typo: "placed in"
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.
Done
test/README.md
Outdated
|
||
The new test images will also need to be uploaded to the e2e tests Docker repo. You will need one | ||
of the owners found in [`/test/OWNERS`](OWNERS) to do this. | ||
New test images should be placed `./test/test_images`. | ||
|
||
Because the test images are uploaded to the same folder, they **must** have different names. |
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.
This paragraph can now be removed.
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.
Done
test/e2e-tests.sh
Outdated
function publish_test_images() { | ||
image_dirs="$(find test/test_images -depth 1 -type d)" | ||
for image_dir in ${image_dirs}; do | ||
echo "Publishing test image github.com/knative/serving/${image_dir}" |
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.
Isn't this echo
redundant? Isn't ko publish
verbose about the publishing?
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.
Removed
test/e2e-tests.sh
Outdated
@@ -129,6 +137,8 @@ wait_until_pods_running knative-serving || fail_test "Knative Serving is not up" | |||
wait_until_pods_running istio-system || fail_test "Istio system is not up" | |||
wait_until_service_has_external_ip istio-system knative-ingressgateway || fail_test "Ingress has no external IP" | |||
|
|||
publish_test_images |
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.
Move this to line 131, so it fails fast if something goes wrong.
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.
Done
test/e2e-tests.sh
Outdated
@@ -109,6 +109,14 @@ function dump_extra_cluster_state() { | |||
kubectl logs $(get_app_pod controller knative-serving) | |||
} | |||
|
|||
function publish_test_images() { | |||
image_dirs="$(find test/test_images -depth 1 -type d)" |
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.
Shouldn't it be maxdepth
here?
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.
maxdepth
will include the current path (which is test/test_images
). ko
will report error because it doesn't has a go package inside.
test/upload-test-images.sh
Outdated
|
||
DOCKER_FILES="$(find $@ -name Dockerfile)" | ||
: ${DOCKER_FILES:?"No subdirectories with Dockerfile files found in $@"} | ||
IMAGE_DIRS="$(find $@ -depth 1 -type d)" |
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.
Shouldn't it be maxdepth
here?
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.
Same here.
test/upload-test-images.sh
Outdated
@@ -17,14 +17,10 @@ | |||
set -o errexit | |||
|
|||
: ${1:?"Pass the directories with the test images as arguments"} |
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 location of the test images is now fixed, you don't need arguments for this script anymore.
test/README.md
Outdated
* You to be [authenticated with your | ||
`DOCKER_REPO_OVERRIDE`](/docs/setting-up-a-docker-registry.md) | ||
* [`docker`](https://docs.docker.com/install/) to be installed | ||
|
||
To run the script for all end to end test images: | ||
|
||
```bash | ||
./test/upload-test-images.sh ./test/e2e/test_images ./test/conformance/test_images | ||
./test/upload-test-images.sh test/test_images |
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 location of the test images is now fixed, you don't need arguments for this script anymore (see my comment below).
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.
Done
test/upload-test-images.sh
Outdated
|
||
DOCKER_FILES="$(find $@ -name Dockerfile)" | ||
: ${DOCKER_FILES:?"No subdirectories with Dockerfile files found in $@"} | ||
IMAGE_DIRS="$(find $@ -depth 1 -type d)" |
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.
Instead of $@
, use the location relative to this script, which is $(dirname $0)/test_images
.
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.
Done
@adrcunha I'm still having some trouble running
I tried to upgrade my bash version but still got the same error. |
test/e2e-tests.sh
Outdated
@@ -109,6 +109,13 @@ function dump_extra_cluster_state() { | |||
kubectl logs $(get_app_pod controller knative-serving) | |||
} | |||
|
|||
function publish_test_images() { | |||
image_dirs="$(find $(dirname $0)/test_images -depth 1 -type d)" |
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.
Should this be -mindepth 1
? On Linux, it's an error to pass an arg to -depth
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.
Indeed, that's why I mentioned -maxdepth
. Also, on my Linux box it should be .../test_images/*
otherwise it will also include test_images
itself.
Also, use ${REPO_ROOT_DIR}/test/test_images
as the absolute location.
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.
In my tests on Mac and Linux, I found using find ${REPO_ROOT_DIR}/test/test_images -mindepth 1 -maxdepth 1 -type d
works the best. @jcrossley3 @adrcunha Let me know if that works for you. .../test/test_images/*
with just -maxdepth
doesn't give the right paths.
test/upload-test-images.sh
Outdated
|
||
DOCKER_FILES="$(find $@ -name Dockerfile)" | ||
: ${DOCKER_FILES:?"No subdirectories with Dockerfile files found in $@"} | ||
IMAGE_DIRS="$(find $(dirname $0)/test_images -depth 1 -type d)" |
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.
-mindepth 1
?
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.
Same comment about maxdepth
and ${REPO_ROOT_DIR}
.
test/README.md
Outdated
@@ -102,26 +102,22 @@ go test -v -tags=e2e -count=1 ./test/e2e --resolvabledomain | |||
The [`upload-test-images.sh`](./upload-test-images.sh) script can be used to build and push the | |||
test images used by the conformance and e2e tests. It requires: | |||
|
|||
* [`DOCKER_REPO_OVERRIDE`](/DEVELOPMENT.md#environment-setup) to be set | |||
* [`KO_DOCKER_REPO`](/DEVELOPMENT.md#environment-setup) to be set | |||
* You to be [authenticated with your | |||
`DOCKER_REPO_OVERRIDE`](/docs/setting-up-a-docker-registry.md) |
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.
change this too
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.
Actually, either keep DOCKER_REPO_OVERRIDE
or update the documentation, the flags and the scripts, as they still rely on this value for the default value of --dockerrepo
.
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 changed it back. In upload-test-images.sh
, it also changed it back to require DOCKER_REPO_OVERRIDE
so that the doc here can still make sense. But I added export KO_DOCKER_REPO=${DOCKER_REPO_OVERRIDE}
just like it in e2e-test.sh
. Let me know if that makes sense.
I only see this happening so far on Macs. That would also explain the differences we're seeing with the arguments for |
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.
Also please update test_images/README.md
, as it still references the conformance tests (I could swear I already wrote this, but...)
test/README.md
Outdated
|
||
New test images should be placed in their own subdirectories. Be sure to to include a `Dockerfile` | ||
for building and running the test image. | ||
Note: this is only required when you run comformance/e2e tests locally with `go test` commands. |
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.
Better move this note to the top of the section.
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.
Done
test/e2e-tests.sh
Outdated
@@ -109,6 +109,13 @@ function dump_extra_cluster_state() { | |||
kubectl logs $(get_app_pod controller knative-serving) | |||
} | |||
|
|||
function publish_test_images() { | |||
image_dirs="$(find $(dirname $0)/test_images -depth 1 -type d)" |
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.
Indeed, that's why I mentioned -maxdepth
. Also, on my Linux box it should be .../test_images/*
otherwise it will also include test_images
itself.
Also, use ${REPO_ROOT_DIR}/test/test_images
as the absolute location.
test/README.md
Outdated
@@ -102,26 +102,22 @@ go test -v -tags=e2e -count=1 ./test/e2e --resolvabledomain | |||
The [`upload-test-images.sh`](./upload-test-images.sh) script can be used to build and push the | |||
test images used by the conformance and e2e tests. It requires: | |||
|
|||
* [`DOCKER_REPO_OVERRIDE`](/DEVELOPMENT.md#environment-setup) to be set | |||
* [`KO_DOCKER_REPO`](/DEVELOPMENT.md#environment-setup) to be set | |||
* You to be [authenticated with your | |||
`DOCKER_REPO_OVERRIDE`](/docs/setting-up-a-docker-registry.md) |
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.
Actually, either keep DOCKER_REPO_OVERRIDE
or update the documentation, the flags and the scripts, as they still rely on this value for the default value of --dockerrepo
.
test/upload-test-images.sh
Outdated
|
||
DOCKER_FILES="$(find $@ -name Dockerfile)" | ||
: ${DOCKER_FILES:?"No subdirectories with Dockerfile files found in $@"} | ||
IMAGE_DIRS="$(find $(dirname $0)/test_images -depth 1 -type d)" |
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.
Same comment about maxdepth
and ${REPO_ROOT_DIR}
.
test/upload-test-images.sh
Outdated
@@ -16,9 +16,11 @@ | |||
|
|||
set -o errexit | |||
|
|||
: ${KO_DOCKER_REPO:?"You must set 'KO_DOCKER_REPO', see DEVELOPMENT.md"} | |||
: ${DOCKER_REPO_OVERRIDE:?"You must set 'DOCKER_REPO_OVERRIDE', see DEVELOPMENT.md"} | |||
: ${REPO_ROOT_DIR:?"You must set 'REPO_ROOT_DIR' to knative serving repo root"} |
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.
Why require users to set this? For developers running local go test ...
tests, it seems like a path relative to dirname
is more convenient, or at least a reasonable default.
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.
Sorry if I wasn't clear. ${REPO_ROOT_DIR}
is a convenience variable set for e2e-tests.sh
only. Indeed, use dirname
to figure out the location of test_images
without adding any further dependency.
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.
Done. I made the change because you mentioned ${REPO_ROOT_DIR}
in this file also.
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, my fault, I apologize for the misguidance.
Great work, @yolo3301. You should be able to run the e2e tests locally now if you temporarily comment line 32 in |
@adrcunha I was able to run
|
Thanks, @yolo3301. I'm aware of [1]; [2] should go away once the helper scripts are vendored, but [3] is concerning. Are you able to debug and understand why it's failing? /ok-to-test |
/retest |
@yolo3301, /retest won't help. All e2e tests failed, except those were failure is expected. I skimmed through the summary and I believe that the images are not being found (or, if they are, they are broken somehow). I suggest you get at least HelloWorld working using |
@adrcunha Manually running I checked the build log, it seems the
It was pulling |
Ah! Use |
/retest |
@adrcunha after fixing another bug, the integ tests finally passed! |
test/e2e-tests.sh
Outdated
@@ -112,7 +112,7 @@ function dump_extra_cluster_state() { | |||
function publish_test_images() { | |||
image_dirs="$(find ${REPO_ROOT_DIR}/test/test_images -mindepth 1 -maxdepth 1 -type d)" | |||
for image_dir in ${image_dirs}; do | |||
ko publish "github.com/knative/serving/test/test_images/$(basename ${image_dir})" | |||
ko publish -P "github.com/knative/serving/test/test_images/$(basename ${image_dir})" |
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.
Isn't it also necessary in the upload-test-images.sh
script?
test/upload-test-images.sh
Outdated
docker build "${image_dir}" -f "${docker_file}" -t "${versioned_name}" | ||
docker push "${versioned_name}" | ||
for image_dir in ${IMAGE_DIRS}; do | ||
ko publish "github.com/knative/serving/test/test_images/$(basename ${image_dir})" |
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.
should this also have -P to preserve the paths?
docker build "${image_dir}" -f "${docker_file}" -t "${versioned_name}" | ||
docker push "${versioned_name}" | ||
for image_dir in ${IMAGE_DIRS}; do | ||
ko publish -P "github.com/knative/serving/test/test_images/$(basename ${image_dir})" |
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.
cc @imjasonh 🦜 thanks for ko publish
🎉
function publish_test_images() { | ||
image_dirs="$(find ${REPO_ROOT_DIR}/test/test_images -mindepth 1 -maxdepth 1 -type d)" | ||
for image_dir in ${image_dirs}; do | ||
ko publish -P "github.com/knative/serving/test/test_images/$(basename ${image_dir})" |
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.
It is notable that this will not work with DockerHub (and possible other registries), which is why I'd changed the ko
default behavior :(
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.
Shall I fix this separately?
/approve |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: adrcunha, mattmoor, yolo3301 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
* removed dockerfiles * moved test images to the same location * adjust repo * fix command and docs * update upload-test-images.sh * preserve import paths * fix appYaml path * preserve path in upload-test-images.sh Backport of #1792.
…2208) * Fix SSH keys workaround for kubetest Create the ~/.ssh dir if it doesn't exist, don't assume it always exist. Backported from knative/test-infra#151 * Fix authentication for test clusters Instead of relying on default options, use basic authentication for test cluster. Also make acquire_cluster_admin_role() handle auth through certificates, since it's used also on deployment. Backport of knative/test-infra#115 * Increase E2E tests timeout to 20 minutes Currently 10 minutes may not be enough, for example as in #1701. Backport of #1702. * Drop Dockerfile in test images * removed dockerfiles * moved test images to the same location * adjust repo * fix command and docs * update upload-test-images.sh * preserve import paths * fix appYaml path * preserve path in upload-test-images.sh Backport of #1792.
Fixes #1720
Not sure if this is the right way of doing this.
This will change the repo for test images:
e.g.
gcr.io/myproj/knative-serving
=>gcr.io/myproj//github.com/knative/serving/test/conformance/test_images
And the repo will be different for e2e and comformance tests unless we move all test images to a single import path, e.g.
github.com/knative/serving/test/images