Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ RUN curl https://archive.apache.org/dist/spark/spark-${SPARK_VERSION}/spark-${SP
&& tar xvzf spark.tgz --directory /opt/spark --strip-components 1 \
&& rm -rf spark.tgz

# Add some additional custom jars for other connectors like BigTable etc
RUN mkdir -p /opt/custom-jars && \
curl -L "https://repo1.maven.org/maven2/com/google/cloud/spark/bigtable/spark-bigtable_2.12/0.2.1/spark-bigtable_2.12-0.2.1.jar" \
-o /opt/custom-jars/spark-bigtable_2.12-0.2.1.jar && \
curl -L "https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-slf4j-impl/2.20.0/log4j-slf4j-impl-2.20.0.jar" \
-o /opt/custom-jars/log4j-slf4j-impl-2.20.0.jar
Comment on lines +60 to +65
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add checksum verification for downloaded JARs

Verify JAR integrity to prevent supply chain attacks.

 RUN mkdir -p /opt/custom-jars && \
+    # spark-bigtable
     curl -L "https://repo1.maven.org/maven2/com/google/cloud/spark/bigtable/spark-bigtable_2.12/0.2.1/spark-bigtable_2.12-0.2.1.jar" \
-    -o /opt/custom-jars/spark-bigtable_2.12-0.2.1.jar && \
+    -o /opt/custom-jars/spark-bigtable_2.12-0.2.1.jar && \
+    echo "expected-sha256-here /opt/custom-jars/spark-bigtable_2.12-0.2.1.jar" | sha256sum -c && \
+    # log4j-slf4j-impl
     curl -L "https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-slf4j-impl/2.20.0/log4j-slf4j-impl-2.20.0.jar" \
-    -o /opt/custom-jars/log4j-slf4j-impl-2.20.0.jar
+    -o /opt/custom-jars/log4j-slf4j-impl-2.20.0.jar && \
+    echo "expected-sha256-here /opt/custom-jars/log4j-slf4j-impl-2.20.0.jar" | sha256sum -c

Committable suggestion skipped: line range outside the PR's diff.


# Install python deps
COPY quickstart/requirements.txt .
RUN pip3 install -r requirements.txt
Expand Down
1 change: 0 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ lazy val cloud_gcp = project
libraryDependencies += "com.google.cloud.bigdataoss" % "gcsio" % "3.0.3", // need it for https://github.com/GoogleCloudDataproc/hadoop-connectors/blob/master/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageFileSystem.java
libraryDependencies += "io.circe" %% "circe-yaml" % "1.15.0",
libraryDependencies += "com.google.cloud.spark" %% s"spark-bigquery-with-dependencies" % "0.41.0",
libraryDependencies += "com.google.cloud.spark.bigtable" %% "spark-bigtable" % "0.2.1",
libraryDependencies += "com.google.cloud.bigtable" % "bigtable-hbase-2.x" % "2.14.2",
libraryDependencies ++= circe,
libraryDependencies ++= avro,
Expand Down
4 changes: 3 additions & 1 deletion quickstart/cloud_gcp/scripts/load_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ echo "GroupBy upload batch jobs completed successfully!"

echo "Uploading tables to KV Store"
for dataset in purchases returns; do
if ! spark-submit --driver-class-path "$CLASSPATH" --class ai.chronon.integrations.cloud_gcp.Spark2BigTableLoader \
if ! spark-submit --driver-class-path "$CLASSPATH:/opt/custom-jars/*" \
--jars "/opt/custom-jars/spark-bigtable_2.12-0.2.1.jar,/opt/custom-jars/log4j-slf4j-impl-2.20.0.jar" \
--class ai.chronon.integrations.cloud_gcp.Spark2BigTableLoader \
--master local[*] $CLOUD_GCP_JAR --table-name default.quickstart_${dataset}_v1_upload --dataset quickstart.${dataset}.v1 \
--end-ds 2023-11-30 --project-id $GCP_PROJECT_ID --instance-id $GCP_INSTANCE_ID; then
echo "Error: Failed to upload table to KV Store" >&2
Expand Down
Loading