Skip to content

Commit 224a5dc

Browse files
committed
Fix extraction of notarized Elasticsearch release distribution (#49511)
This commit introduces a workaround for an issue related to our recent notarization of distributions starting with the 6.8.5 release. An unintended side effect of notarization was that the file entries of the release tar all have a `./` prefix in the path. This causes a number of issues, not least of which is that our Gradle extract tasks end up copying an empty fileset to the destination directory. The workaround here is imply to remove the leading `./` path segment from each file when performing the extraction. For more details see this issue: #49417
1 parent 459cf9e commit 224a5dc

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

buildSrc/src/main/java/org/elasticsearch/gradle/DistributionDownloadPlugin.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,14 @@
3535
import org.gradle.api.artifacts.repositories.IvyArtifactRepository;
3636
import org.gradle.api.credentials.HttpHeaderCredentials;
3737
import org.gradle.api.file.FileTree;
38+
import org.gradle.api.file.RelativePath;
3839
import org.gradle.api.plugins.ExtraPropertiesExtension;
3940
import org.gradle.api.tasks.Sync;
4041
import org.gradle.api.tasks.TaskProvider;
4142
import org.gradle.authentication.http.HttpHeaderAuthentication;
4243

4344
import java.io.File;
45+
import java.util.Arrays;
4446
import java.util.HashMap;
4547
import java.util.Locale;
4648
import java.util.Map;
@@ -145,6 +147,14 @@ private void setupRootDownload(Project rootProject, ElasticsearchDistribution di
145147
}
146148
throw new IllegalStateException("unexpected file extension on [" + archivePath + "]");
147149
});
150+
151+
// Workaround for https://github.com/elastic/elasticsearch/issues/49417
152+
syncTask.eachFile(details -> {
153+
String[] segments = details.getRelativePath().getSegments();
154+
if (segments[0].equals(".")) {
155+
details.setRelativePath(new RelativePath(true, Arrays.copyOfRange(segments, 1, segments.length)));
156+
}
157+
});
148158
});
149159
rootProject.getArtifacts().add(extractedConfigName,
150160
rootProject.getLayout().getProjectDirectory().dir(extractDir),

0 commit comments

Comments
 (0)