This is an automated email from the ASF dual-hosted git repository.

houston pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/main by this push:
     new 5690007  SOLR-15891: Shrink Solr image, use default tarball file 
permissions (#498)
5690007 is described below

commit 5690007225067a8106a2d14415d03eb1c141dba1
Author: Houston Putman <[email protected]>
AuthorDate: Mon Jan 10 12:02:09 2022 -0500

    SOLR-15891: Shrink Solr image, use default tarball file permissions (#498)
---
 solr/CHANGES.txt                                   |  2 ++
 solr/docker/build.gradle                           | 16 +++++++++--
 solr/docker/templates/Dockerfile.body.template     | 11 ++++----
 .../templates/Dockerfile.official.header.template  |  2 +-
 solr/docker/tests/shared.sh                        |  4 +--
 solr/packaging/build.gradle                        | 32 ++++++++++++----------
 6 files changed, 42 insertions(+), 25 deletions(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index ebd055d..7f042e8 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -235,6 +235,8 @@ Build
 
 * SOLR-15867: Make the gradle build ready for 9.0 release (janhoy, Houston 
Putman, Dawid Weiss)
 
+* SOLR-15891: The Solr Docker image uses the default file permissions from the 
tarball artifact (Houston Putman, janhoy)
+
 Other Changes
 ----------------------
 * SOLR-15603: Add an option to activate Gradle build cache, build task 
cleanups (Alexis Tual, Dawid Weiss)
diff --git a/solr/docker/build.gradle b/solr/docker/build.gradle
index 92cbb26..2a7ee3f 100644
--- a/solr/docker/build.gradle
+++ b/solr/docker/build.gradle
@@ -28,6 +28,7 @@ def dockerImageRepo = 
propertyOrEnvOrDefault("solr.docker.imageRepo", "SOLR_DOCK
 def dockerImageTag = propertyOrEnvOrDefault("solr.docker.imageTag", 
"SOLR_DOCKER_IMAGE_TAG", "${version}")
 def dockerImageName = propertyOrEnvOrDefault("solr.docker.imageName", 
"SOLR_DOCKER_IMAGE_NAME", "${dockerImageRepo}:${dockerImageTag}")
 def baseDockerImage = propertyOrEnvOrDefault("solr.docker.baseImage", 
"SOLR_DOCKER_BASE_IMAGE", 'openjdk:11-jre-slim')
+def officialDockerImageName = propertyOrEnvOrDefault("solr.docker.imageName", 
"SOLR_DOCKER_IMAGE_NAME", "${dockerImageRepo}-official:${dockerImageTag}")
 
 def releaseGpgFingerprint = 
propertyOrDefault('signing.gnupg.keyName',propertyOrDefault('signing.keyId',''));
 
@@ -398,9 +399,16 @@ task testBuildDockerfileOfficial(type: Copy) {
             "--iidfile", imageIdFileOfficial,
             '--build-arg', 
"SOLR_CLOSER_URL=http://mock-solr-dl-server:9876/solr-${version}.tgz";,
             '--build-arg', 
"SOLR_ARCHIVE_URL=http://mock-solr-dl-server:9876/solr-${version}.tgz";,
+            '--tag', officialDockerImageName,
             '-'
         }
-        
+
+        def officialDockerImageId = file(imageIdFileOfficial).text
+
+        // Print information on the image after it has been created
+        project.logger.lifecycle("\"Official\" Solr Docker Image Tagged")
+        project.logger.lifecycle("\tID: \t$officialDockerImageId")
+        project.logger.lifecycle("\tTag: \t$officialDockerImageName")
       } finally {
         // Try to shut down our mock httpd server....
         if (mockServerIdFile.exists()) {
@@ -429,7 +437,7 @@ task testBuildDockerfileOfficial(type: Copy) {
 
 task testDockerfileOfficial(type: TestDockerImageTask, dependsOn: 
configurations.dockerOfficialSmokeCheckImage) {
   description = 'Smoke Test Solr docker image built from Dockerfile.official'
-  
+
   idFile = file(imageIdFileOfficial)
   outputDir = file("$smokeTestOfficial/test-results")
   
@@ -446,6 +454,10 @@ abstract class TestDockerImageTask extends DefaultTask {
   @InputFile
   abstract public RegularFileProperty getIdFile()
 
+  // Ensure that the docker image is re-tested if the shared test library 
changes
+  @InputFile
+  File sharedTestLibraryFile = project.file("tests/shared.sh")
+
   @InputDirectory
   File sourceDir = project.file("tests/cases")
 
diff --git a/solr/docker/templates/Dockerfile.body.template 
b/solr/docker/templates/Dockerfile.body.template
index 110a7a9..0f462d2 100644
--- a/solr/docker/templates/Dockerfile.body.template
+++ b/solr/docker/templates/Dockerfile.body.template
@@ -27,16 +27,15 @@
 #-#
 
 # remove what we don't want; ensure permissions are right
+# In the header templates, all solr files/directories are set to 0644 
permissions, so we need to update that.
 #  TODO; arguably these permissions should have been set correctly previously 
in the TAR
 RUN set -ex; \
   (cd /opt; ln -s solr-*/ solr); \
-  rm -Rf /opt/solr/docs /opt/solr/dist/solr-solrj-*.jar 
/opt/solr/dist/solrj-lib /opt/solr/dist/solr-core-*.jar; \
-  find /opt/solr/ -type d -print0 | xargs -0 chmod 0755; \
-  find /opt/solr/ -type f -print0 | xargs -0 chmod 0644; \
-  chmod -R 0755 /opt/solr/docker/scripts /opt/solr/bin 
/opt/solr/contrib/prometheus-exporter/bin/solr-exporter 
/opt/solr/server/scripts/cloud-scripts
+  rm -Rf /opt/solr/docs /opt/solr/dist/solr-solrj-*.jar 
/opt/solr/dist/solrj-lib /opt/solr/dist/solr-core-*.jar;
 
-LABEL maintainer="The Apache Lucene/Solr Project"
-LABEL repository="https://github.com/apache/lucene-solr";
+LABEL maintainer="The Apache Solr Project"
+LABEL url="https://solr.apache.org";
+LABEL repository="https://github.com/apache/solr";
 
 RUN set -ex; \
     apt-get update; \
diff --git a/solr/docker/templates/Dockerfile.official.header.template 
b/solr/docker/templates/Dockerfile.official.header.template
index a91d088..a8de667 100644
--- a/solr/docker/templates/Dockerfile.official.header.template
+++ b/solr/docker/templates/Dockerfile.official.header.template
@@ -90,5 +90,5 @@ RUN set -ex; \
   fi; \
   { command -v gpgconf; gpgconf --kill all || :; }; \
   rm -r "$GNUPGHOME"; \
-  tar -C /opt --extract --file "/opt/solr-$SOLR_VERSION.tgz";
+  tar -C /opt --extract --preserve-permissions --file 
"/opt/solr-$SOLR_VERSION.tgz";
 
diff --git a/solr/docker/tests/shared.sh b/solr/docker/tests/shared.sh
index 8ef9809..a07661c 100755
--- a/solr/docker/tests/shared.sh
+++ b/solr/docker/tests/shared.sh
@@ -113,8 +113,8 @@ function prepare_dir_to_mount {
   # If you can't use setfacl (eg on macOS), you'll have to chown the directory 
to 8983, or apply world
   # write permissions.
   if ! command -v setfacl &> /dev/null; then
-    echo "Test case requires the 'setfacl' command but it can not be found"
-    exit 1
+    echo "Test case requires the 'setfacl' command but it can not be found. 
Will set the directory to have read/write all permissions"
+    chmod a+rwx "$folder"
   fi
   if ! setfacl -m "u:$userid:rwx" "$folder"; then
     echo "Unable to add permissions for $userid to '$folder'"
diff --git a/solr/packaging/build.gradle b/solr/packaging/build.gradle
index e2f86d1..c919b56 100644
--- a/solr/packaging/build.gradle
+++ b/solr/packaging/build.gradle
@@ -92,19 +92,6 @@ distributions {
     contents {
       // TODO: This is missing module README files, as compared to 8x
 
-      // Manually correct posix permissions (matters when packaging on 
Windows).
-      filesMatching([
-          "**/*.sh",
-          "**/bin/post",
-          "**/bin/postlogs",
-          "**/bin/solr",
-          "**/bin/init.d/solr",
-          "**/bin/solr-exporter",
-          "**/docker/scripts/*",
-      ]) { copy ->
-        copy.setMode(0755)
-      }
-
       from(project(":solr").projectDir, {
         include "bin/**"
         include "licenses/**"
@@ -141,8 +128,25 @@ distributions {
 
       from(configurations.docker, {
         into "docker"
+        filesMatching([
+            "scripts/**",
+        ]) { copy ->
+          copy.setMode(0755)
+        }
       })
 
+      // Manually correct posix permissions (matters when packaging on 
Windows).
+      filesMatching([
+          "**/*.sh",
+          "**/bin/post",
+          "**/bin/postlogs",
+          "**/bin/solr",
+          "**/bin/init.d/solr",
+          "**/bin/solr-exporter",
+      ]) { copy ->
+        copy.setMode(0755)
+      }
+
     }
   }
 }
@@ -163,4 +167,4 @@ distTar {
   compression = Compression.GZIP
 }
 
-assemble.dependsOn installDist
\ No newline at end of file
+assemble.dependsOn installDist

Reply via email to