wix-incubator / bazelizer

This is your last chance to use maven plugins under Bazel
MIT License
8 stars 5 forks source link

e2e test fails because of missing maven build dependency #33

Open jamesbond7 opened 1 year ago

jamesbond7 commented 1 year ago

There is an e2e test having the following BUILD.bazel file:


specs2_ite2e_test( name = "e2e", size = "large", srcs = [ ":sources", ], data = [ "//tgs/vap-tgs-search-v7", "//third_party/docker_images:vespa_7.tar", ], jvm_flags = [ "-Dvap='$(rootpaths //tgs/vap-tgs-search-v7)'", ], runtime_deps = [ "//e2e/src/it/resources", ], deps = [ ... ], )

It depends on //tgs/vap-tgs-search-v7 artifact having the following BUILD.bazel file:


package(default_visibility = ["//visibility:public"])

load("@core_server_build_tools//packager:publisher.bzl","publisher_tags") load("@wix_incubator_bazelizer//maven:defs.bzl", "maven_project") load("@bazelizer//:execute_build.bzl", "execute_build")

filegroup( name = "source", srcs = glob([ "src/*/", "assembly/*/", ]), )

maven_project( name = "maven", flags = [ "--deps-drop-all", "--deps-drop-exclude", "com.yahoo.vespa:*", "--mvn-active-profiles", "vespa_7", ], parent_project = "//srs/3party:maven_vespa_7", pom_file = ":pom.xml", )

execute_build( name = "vap-tgs-search-v7", srcs = [":source"], project = ":maven", outputs = [ "application.zip", "vap-tgs-search-v7-1.0.0-SNAPSHOT.tar.gz", ], tags = publisher_tags( "com.wixpress.search.tgs", "vap-tgs-search-v7", "tar.gz", classifier = "", ) + ["deployable"],

) + [""], # to make it build locally

deps = [
    "//deviantart/da-searcher-components:agg=._da-searcher-components-bundle-deps-v7",
],

)

The bazel test command fails:

bazel test //e2e/src/it/scala/com/wixpress/search/tgs/vap_tgs_search_v7/...

... org.specs2.specification.core.FatalExecution: java.nio.file.NoSuchFileException: tgs/vap-tgs-search-v7/application.zip Caused by: java.nio.file.NoSuchFileException: tgs/vap-tgs-search-v7/application.zip ...

We see that the following dependency file is missing:

/private/var/tmp/_bazel_gregoryb/96006f863e737e544cd95e9f71f4b21f/execroot/vespa_services/bazel-out/darwin-fastbuild/bin/e2e/src/it/scala/com/wixpress/search/tgs/vap_tgs_search_v7/e2e_test_runner.runfiles/vespa_services/tgs/vap-tgs-search-v7/application.zip

bsnisar commented 1 year ago

@jamesbond7 could you please explicitly run bazel build //tgs/vap-tgs-search-v7? Pay attention to what actually it produces as outputs at the end.

For example: in this repository, there is an e2e test. I can do the same here:

bazelisk build //tests/e2e/mvn-lib:mvn-lib
.....
....
Target //tests/e2e/mvn-lib:mvn-lib up-to-date:
    bazel-bin/tests/e2e/mvn-lib/libmvn-lib.jar
    bazel-bin/tests/e2e/mvn-lib/libmvn-lib_pkg.tar
    bazel-bin/tests/e2e/mvn-lib/a-1.0.0-SNAPSHOT.jar
INFO: Elapsed time: 4.619s, Critical Path: 4.48s
INFO: 1 process: 1 darwin-sandbox.
INFO: Build completed successfully, 2 total actions

In your case somewhere in this output should be application.zip. Also, it is worth checking if it is the correct output. For my example I will do it like and look a bit to the content.

zipinfo bazel-bin/tests/e2e/mvn-lib/a-1.0.0-SNAPSHOT.jar
Archive:  bazel-bin/tests/e2e/mvn-lib/a-1.0.0-SNAPSHOT.jar
Zip file size: 2539 bytes, number of entries: 10
drwxr-xr-x  2.0 unx        0 b- stor 22-Nov-04 13:42 META-INF/
-rw-r--r--  2.0 unx      136 b- defN 22-Nov-04 13:42 META-INF/MANIFEST.MF
.....

My aim in this questions

I am interested in the outputs of your "maven" target to understand the root cause. Possibly the problem is not in //tgs/vap-tgs-search-v7 but in your e2e test that tries to find application zip and just fails.

Will wait for your reply.

Regards, Bohdan

jamesbond7 commented 1 year ago

It looks like this patch fixed the issue: https://github.com/wix-incubator/bazelizer/commit/d8ba23e053a5a4ce9d6a6cbd438e23164a1e9867

bsnisar commented 1 year ago

Sounds good, and looks like it really make sense

On Fri, 4 Nov 2022 at 15:03, Gregory Bondar @.***> wrote:

It looks like this patch fixed the issue: d8ba23e https://github.com/wix-incubator/bazelizer/commit/d8ba23e053a5a4ce9d6a6cbd438e23164a1e9867

— Reply to this email directly, view it on GitHub https://github.com/wix-incubator/bazelizer/issues/33#issuecomment-1303506477, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJNDXSSD2PMX26ZS44YXQTWGUCTPANCNFSM6AAAAAARQKDBEA . You are receiving this because you commented.Message ID: @.***>