Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
main branch
Describe the issue :
I have cloned opensearch github repo and was trying to build the docker image and prepare for a planned change, but I kept get failure when running “./gradlew composeBuild -Drepos.mavenLocal=true”, with the following output
Task :test:fixtures:gcs-fixture:composeBuild FAILED
invalid tag “5f33c8e76bf13d97232656100be89620_gcs-fixture_-gcs-fixture-repositories-metering”: invalid reference format
Task :test:fixtures:azure-fixture:composeBuild FAILED
invalid tag “32d727cce014e4d0189191ca264ec712_azure-fixture_-azure-fixture-other”: invalid reference format
Task :test:fixtures:krb5kdc-fixture:composeBuild FAILED
invalid tag “4fe9726ee1bd3c639987cc7afd130f30_krb5kdc-fixture_-hdfs”: invalid reference format
Task :test:fixtures:minio-fixture:composeBuild FAILED
invalid tag “fae949bc523c6c630c4d220b5575f28b_minio-fixture_-minio-fixture”: invalid reference format
Task :test:fixtures:s3-fixture:composeBuild FAILED
invalid tag “6bac0f7478001168b1c7393a6cf69026_s3-fixture_-s3-fixture-repositories-metering”: invalid reference format
What was going wrong?
Configuration :
macbook pro M1, mac version sonoma 14.4.1
Relevant Logs or Screenshots :
Arran
January 9, 2025, 10:57pm
2
I encountered this problem too. I have raised a Github issue, which includes a workaround:
opened 05:39AM - 12 Dec 24 UTC
bug
Build
### Describe the bug
I encounter a failure when I run tests:
```
./gradlew … test
(...lots of output...)
> Task :test:fixtures:azure-fixture:composeBuild FAILED
time="2024-12-05T10:29:45+11:00" level=warning msg="buildx: failed to get git commit: "
invalid tag "8a6d57b53415578aaf23306eab866aac_azure-fixture_-azure-fixture-other": invalid reference format
```
If I run with `haltonfailure=false`, the following tasks fail:
- :test:fixtures:azure-fixture:composeBuild
- :test:fixtures:gcs-fixture:composeBuild
- :test:fixtures:krb5kdc-fixture:composeBuild
Debug logs (eg from `./gradlew :test:fixtures:azure-fixture:composeBuild`) show that a particular docker-compose command is failing:
```
2024-12-05T11:12:52.188+1100 [INFO] [org.gradle.process.internal.DefaultExecHandle] Starting process 'command 'docker''. Working directory: /Users/arrandengate/src/OpenSearch/test/fixtures/azure-fixture Command: docker compose -f docker-compose.yml --ansi never -p 8a6d57b53415578aaf23306eab866aac_azure-fixture_ build
```
I am able to reproduce the issue by running that command by itself.
```
arrandengate@arran-mac-0 azure-fixture % cd /Users/arrandengate/src/OpenSearch/test/fixtures/azure-fixture
arrandengate@arran-mac-0 azure-fixture % docker compose -f docker-compose.yml --ansi never -p 8a6d57b53415578aaf23306eab866aac_azure-fixture_ build
[+] Building 0.0s (0/0) docker:desktop-linux
invalid tag "8a6d57b53415578aaf23306eab866aac_azure-fixture_-azure-fixture-other": invalid reference format
```
It is caused by an invalid project name provided to `docker-compose` with the `-p` flag. (It seems like the project name can't end with an underscore, or contain a hyphen followed by an underscore. I've seen project names like both `8a6d57b53415578aaf23306eab866aac_azure-fixture_-azure-fixture-other` and `8a6d57b53415578aaf23306eab866aac_azure-fixture_` passed into docker-compose in the failing tests.)
In our code, it seems that this project name isn't specified directly - it is constructed by the [Gradle docker-compose plugin](https://github.com/avast/gradle-docker-compose-plugin).
The plugin has existing Github issues for this problem:
- https://github.com/avast/gradle-docker-compose-plugin/issues/393
- https://github.com/avast/gradle-docker-compose-plugin/issues/404
*How can the problem be fixed?*
We could upgrade to the version of the gradle docker compose plugin where this issue is fixed. We are currently on 0.17.6. We would need to upgrade to [at least 0.17.10](https://github.com/avast/gradle-docker-compose-plugin/releases/tag/0.17.10).
Alternatively, there is a workaround mentioned in https://github.com/avast/gradle-docker-compose-plugin/issues/404 - we could set a nested name in the docker compose gradle plugin.
I tried this and it seems to work - eg, if I add the following to `test/fixtures/azure-fixture/build.gradle`, the test succeeds:
```
dockerCompose {
nestedName = "fixture"
}
```
The value of the nestedName could be anything, it doesn't matter. To my understanding, the problem is caused by the plugin generating project names that use hyphens and underscores as separators. These characters are legal, but they cannot be adjacent to each other, or at the end. Adding another component to the name means the project name won't have these characters in illegal positions.
### Related component
Build
### To Reproduce
Run the following:
./gradlew :test:fixtures:azure-fixture:composeBuild
### Expected behavior
The test should succeed.
### Additional Details
I encountered this issue under the following conditions:
OS: OSX Sonoma 14.7.1
JDK: Temurin 21.0.5 (tried several others)
OpenSearch: 2.18.0 (tried also 2.10.0)
docker-compose: v2.22.0-desktop.2
Gradle: 8.10.2