opensearch-project / OpenSearch

🔎 Open source distributed and RESTful search engine.
https://opensearch.org/docs/latest/opensearch/index/
Apache License 2.0
9.68k stars 1.79k forks source link

[BUG] gradle updateSHAs is not working #1840

Closed lezzago closed 1 year ago

lezzago commented 2 years ago

Describe the bug I have updated the junit package dependency in the project (done in this PR) and tried to use ./gradlew updateSHAs command to update the SHA1, but nothing was happening.

To Reproduce Steps to reproduce the behavior:

  1. Update a dependency
  2. Execute ./gradlew updateSHAs
  3. Use git status to see no files have been updated

Expected behavior The SHA1 files should have been updated

Plugins N/A

Screenshots N/A

Host/Environment (please complete the following information):

Additional context N/A

reta commented 2 years ago

@lezzago could you please share the output of the git status cuz the https://github.com/opensearch-project/OpenSearch/pull/1837 includes SHA updates:

minalsha commented 2 years ago

@lezzago are you still seeing this issue?

lezzago commented 2 years ago

Sorry, I missed this message.

@reta I am still seeing this issue. I have changed the version of junit to test this.

$ ./gradlew updateSHAs
Picked up JAVA_TOOL_OPTIONS: -Dlog4j2.formatMsgNoLookups=true
Downloading https://services.gradle.org/distributions/gradle-7.5-all.zip
...............10%................20%................30%................40%................50%................60%...............70%................80%................90%................100%

Welcome to Gradle 7.5!

Here are the highlights of this release:
 - Support for Java 18
 - Support for building with Groovy 4
 - Much more responsive continuous builds
 - Improved diagnostics for dependency resolution

For more details see https://docs.gradle.org/7.5/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)

> Task :buildSrc:compileJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

> Task :buildSrc:compileGroovy
Picked up JAVA_TOOL_OPTIONS: -Dlog4j2.formatMsgNoLookups=true
Note: /Users/ashisagr/Documents/workspace/OpenSearch/buildSrc/src/main/groovy/org/opensearch/gradle/test/TestWithSslPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :buildSrc:compileTestJava
Note: /Users/ashisagr/Documents/workspace/OpenSearch/buildSrc/src/test/java/org/opensearch/gradle/http/WaitForHttpResourceTests.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

> Configure project :qa:os
Cannot add task 'destructiveDistroTest.docker' as a task with that name already exists.
=======================================
OpenSearch Build Hamster says Hello!
  Gradle Version        : 7.5
  OS Info               : Mac OS X 10.15.7 (x86_64)
  JDK Version           : 17 (Eclipse Temurin JDK)
  JAVA_HOME             : /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home
  Random Testing Seed   : 4E2A4DC7EAEE7C94
  In FIPS 140 mode      : false
=======================================

BUILD SUCCESSFUL in 2m 7s
43 actionable tasks: 43 executed

$ git status
On branch main
Your branch is up to date with 'origin/main'.

Unmerged paths:
  (use "git restore --staged <file>..." to unstage)
  (use "git add <file>..." to mark resolution)
        both modified:   buildSrc/version.properties

no changes added to commit (use "git add" and/or "git commit -a")
dbwiddis commented 2 years ago

It looks like if the JAR filename doesn't change, the workflow does not check the new SHA. It appears to only handle added/removed jars by filename, not by file content.

https://github.com/opensearch-project/OpenSearch/blob/0ba0e7cc26060f964fcbf6ee45bae53b3a9941d0/buildSrc/src/main/java/org/opensearch/gradle/precommit/UpdateShasTask.java#L66-L84

reta commented 2 years ago

It looks like if the JAR filename doesn't change, the workflow does not check the new SHA.

But the version is part of JAR file, the file name should change ...

@lezzago I see that your git working tree is in conflict (unfinished merge / rebase), I think it may explain the behaviour you see.

Unmerged paths:
  (use "git restore --staged <file>..." to unstage)
  (use "git add <file>..." to mark resolution)
        both modified:   buildSrc/version.properties
dagneyb commented 1 year ago

@lezzago were you able to troubleshoot with the above feedback? Is this still an issue? If we don't hear back by Dec 6th we will consider this resolved.

owaiskazi19 commented 1 year ago

No issue with gradle updateSHAs as I recently upgraded dependencies for https://github.com/opensearch-project/OpenSearch/pull/6768 and https://github.com/opensearch-project/OpenSearch/pull/6511. Let's open if we face the issue again.