You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2022/11/23 04:58:30 UTC

[GitHub] [accumulo] ctubbsii commented on a diff in pull request #3093: Hide Thrift generated files on GitHub diff, docker build

ctubbsii commented on code in PR #3093:
URL: https://github.com/apache/accumulo/pull/3093#discussion_r1030018100


##########
contrib/docker/Dockerfile:
##########
@@ -0,0 +1,54 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+ARG DOCKER_PROXY=""
+FROM ${DOCKER_PROXY}rockylinux:9
+
+ARG GRADLE_VERSION=7.5.1 THRIFT_VERSION=0.17.0 MAVEN_VERSION=3.8.6
+ARG uid
+ARG gid
+
+RUN yum -y groupinstall "Development Tools" && \
+    yum install -y ant wget unzip java-11-openjdk-devel && \
+    cd /tmp && \
+    wget -O gradle.zip https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip && \
+    mkdir /opt/gradle && \
+    unzip -d /opt/gradle gradle.zip && \
+    wget -O thrift.tar.gz https://archive.apache.org/dist/thrift/${THRIFT_VERSION}/thrift-${THRIFT_VERSION}.tar.gz && \
+    tar zxf thrift.tar.gz && \
+    cd thrift-${THRIFT_VERSION} && \
+    export JAVA_HOME=/usr/lib/jvm/java-11-openjdk && \
+    PATH=/opt/gradle/gradle-${GRADLE_VERSION}/bin:${PATH} ./configure --without-kotlin --without-python --without-py3 && \

Review Comment:
   You can just do: `--without-libs`, I think. You shouldn't even need ant or Gradle or any of that stuff to build the libthrift.jar java library at all. You only need to build the thrift compiler/generator.



##########
contrib/build.sh:
##########
@@ -0,0 +1,40 @@
+#! /bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+VERSION="1"
+IMAGE="accumulo-build-environment-${VERSION}"

Review Comment:
   My understanding is: this image doesn't exist. We'd have to create this?



##########
contrib/build.sh:
##########
@@ -0,0 +1,40 @@
+#! /bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+VERSION="1"
+IMAGE="accumulo-build-environment-${VERSION}"
+M2_DIR="${HOME}/.m2"
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
+cd "$SCRIPT_DIR" || exit 1
+
+# Build the image if needed
+if [[ $(docker images -q $IMAGE) == "" ]]; then
+  cd docker || exit 1
+  docker build --build-arg uid="$(id -u "${USER}")" --build-arg gid="$(id -g "${USER}")" -t $IMAGE .
+  cd "$SCRIPT_DIR" || exit 1
+fi
+
+# Need absolute paths for Docker volume mounts
+cd .. || exit 1
+SOURCE_DIR=$(pwd)
+cd "$SCRIPT_DIR" || exit 1
+
+docker run --rm -v "$M2_DIR":/home/builder/.m2 -v "$SOURCE_DIR":/SOURCES $IMAGE /bin/bash -c 'cd /SOURCES && rm -rf core/src/main/thrift-gen-java && mvn -Pthrift generate-sources && mvn clean package'

Review Comment:
   I'm not sure I understand what's going on here. When/who would run this script, and why is it deleting core/src/main/thrift-gen-java? (the generate-thrift.sh script already does that). Is the expectation that the thrift files are no longer checked in? Or are they still checked in? If they are still checked in, when do they get replaced? I thought "what happens inside docker container stays inside docker container"?



##########
contrib/docker/Dockerfile:
##########
@@ -0,0 +1,54 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+ARG DOCKER_PROXY=""
+FROM ${DOCKER_PROXY}rockylinux:9
+
+ARG GRADLE_VERSION=7.5.1 THRIFT_VERSION=0.17.0 MAVEN_VERSION=3.8.6
+ARG uid
+ARG gid
+
+RUN yum -y groupinstall "Development Tools" && \
+    yum install -y ant wget unzip java-11-openjdk-devel && \
+    cd /tmp && \
+    wget -O gradle.zip https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip && \
+    mkdir /opt/gradle && \
+    unzip -d /opt/gradle gradle.zip && \
+    wget -O thrift.tar.gz https://archive.apache.org/dist/thrift/${THRIFT_VERSION}/thrift-${THRIFT_VERSION}.tar.gz && \
+    tar zxf thrift.tar.gz && \
+    cd thrift-${THRIFT_VERSION} && \
+    export JAVA_HOME=/usr/lib/jvm/java-11-openjdk && \
+    PATH=/opt/gradle/gradle-${GRADLE_VERSION}/bin:${PATH} ./configure --without-kotlin --without-python --without-py3 && \
+    make && \
+    make install && \
+    cd / && \
+    wget -O maven.tar.gz https://dlcdn.apache.org/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz && \

Review Comment:
   Getting the binary from dlcdn is probably better than getting it from the archives, but it's fragile, because things disappear from the CDN after being archived, and versions change all the time. Might as well just use the system provided `yum install maven` version. Wouldn't that suffice?



##########
contrib/docker/Dockerfile:
##########
@@ -0,0 +1,54 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+ARG DOCKER_PROXY=""
+FROM ${DOCKER_PROXY}rockylinux:9
+
+ARG GRADLE_VERSION=7.5.1 THRIFT_VERSION=0.17.0 MAVEN_VERSION=3.8.6
+ARG uid
+ARG gid
+
+RUN yum -y groupinstall "Development Tools" && \
+    yum install -y ant wget unzip java-11-openjdk-devel && \
+    cd /tmp && \
+    wget -O gradle.zip https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip && \
+    mkdir /opt/gradle && \
+    unzip -d /opt/gradle gradle.zip && \
+    wget -O thrift.tar.gz https://archive.apache.org/dist/thrift/${THRIFT_VERSION}/thrift-${THRIFT_VERSION}.tar.gz && \

Review Comment:
   I'd be worried about spamming the ASF Archives, and getting IPs blocked when downloading from there for every build. How often would this run? On what triggers?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org