Skip to content

match with netfri and without#339

Open
LeahMalul wants to merge 7 commits intomainfrom
lea/for_every_one
Open

match with netfri and without#339
LeahMalul wants to merge 7 commits intomainfrom
lea/for_every_one

Conversation

@LeahMalul
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

Greptile Overview

Greptile Summary

This PR attempts to make certificate copying optional across multiple Dockerfiles to support environments with and without NetFree certificates. However, 6 out of 9 files contain a critical bug that will cause Docker builds to fail.

Critical Issue

The pattern RUN if [ -d certs ]; then tar -cf - certs | tar -xf -; fi is fundamentally broken because:

  • RUN commands execute inside the container, not in the build context
  • The certs directory doesn't exist in the container filesystem at this point
  • This check will always fail, and no certificates will be copied

What Works

  • services/image-linker/Dockerfile.flink - correctly uses RUN if [ -f netfree-ca.crt ] after the file would be available
  • services/sounds_classifier/Dockerfile.classifier-svc - properly handles conditional cert installation
  • services/plant_stress/Dockerfile - only comment changes

Required Fix

Replace all instances of the broken RUN pattern with COPY certs /app/certs (or appropriate path), then add conditional checks in subsequent RUN commands to handle when certs don't exist.

Confidence Score: 0/5

  • This PR will break Docker builds for 6 services due to critical logic errors
  • Score of 0 reflects multiple critical bugs that will cause build failures. The misunderstanding of Docker's COPY vs RUN semantics means certificates won't be copied from build context, breaking the intended functionality. 6 out of 9 files have the same critical error.
  • All files with confidence score 0 require immediate fixes: services/compression/Dockerfile, services/flink_writer_db/Dockerfile.flink, GUI/src/vast/desktop/Dockerfile, GUI/src/vast/gateway/Dockerfile, GUI/src/vast/runner/Dockerfile, and services/API-notifications/src/Dockerfile

Important Files Changed

File Analysis

Filename Score Overview
services/compression/Dockerfile 0/5 Critical bugs: RUN cannot copy from build context, certificate installation will fail
services/flink_writer_db/Dockerfile.flink 0/5 Critical bug: tar command attempts to copy from non-existent build context location
GUI/src/vast/desktop/Dockerfile 0/5 Critical bug: RUN cannot access certs from build context, will break certificate setup
GUI/src/vast/gateway/Dockerfile 0/5 Critical bug: RUN cannot copy certs from build context
GUI/src/vast/runner/Dockerfile 0/5 Critical bug: RUN cannot copy certs from build context
services/API-notifications/src/Dockerfile 0/5 Critical bugs: RUN cannot copy from build context, USE_NETFREE undefined

Sequence Diagram

sequenceDiagram
    participant BuildContext as Build Context
    participant Docker as Docker Engine
    participant Container as Container Filesystem
    participant CertStore as CA Certificate Store
    
    Note over BuildContext,CertStore: Current Implementation (Broken)
    
    BuildContext->>Docker: docker build
    Docker->>Container: Execute RUN command
    Container->>Container: Check if certs directory exists
    Note over Container: certs dir not in container yet
    Container-->>Docker: Skipped - no certs found
    
    Note over BuildContext,CertStore: Correct Implementation
    
    BuildContext->>Docker: docker build
    Docker->>Container: COPY certs from build context
    Container->>Container: Execute RUN to check certs
    Container->>CertStore: Install certificates
    CertStore-->>Container: Certificates active
Loading

Additional Comments (1)

  1. services/compression/Dockerfile, line 19-20 (link)

    logic: This will fail if /app/certs doesn't exist or has no .crt files. Add conditional check:

9 files reviewed, 8 comments

Edit Code Review Agent Settings | Greptile

Comment thread services/compression/Dockerfile Outdated
Comment on lines +11 to +16
RUN if [ -d certs ]; then \
echo "Copying certs directory..."; \
tar -cf - certs | tar -xf -; \
else \
echo "No certs directory, skipping copy."; \
fi
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

logic: RUN command cannot access build context files - the certs directory doesn't exist in the container yet. This tar command will fail because there's no certs directory to archive.

Replace with:

Suggested change
RUN if [ -d certs ]; then \
echo "Copying certs directory..."; \
tar -cf - certs | tar -xf -; \
else \
echo "No certs directory, skipping copy."; \
fi
COPY certs /app/certs

Or make it conditional at build time using build args, not at run time.

Comment on lines +5 to +10
RUN if [ -d certs ]; then \
echo "Copying certs directory..."; \
tar -cf - certs | tar -xf -; \
else \
echo "No certs directory, skipping copy."; \
fi
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

logic: RUN command cannot copy from build context - the certs directory isn't in the container yet. The tar command will fail silently.

Line 15 checks /tmp/certs but this extraction doesn't put anything there.

Replace with:

Suggested change
RUN if [ -d certs ]; then \
echo "Copying certs directory..."; \
tar -cf - certs | tar -xf -; \
else \
echo "No certs directory, skipping copy."; \
fi
COPY certs/ /tmp/certs/

Comment on lines +25 to +30
RUN if [ -d certs ]; then \
echo "Copying certs directory..."; \
tar -cf - certs | tar -xf -; \
else \
echo "No certs directory, skipping copy."; \
fi
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

logic: RUN cannot access build context - certs directory doesn't exist in container yet. The tar operation will fail and no certs will be available for line 32.

Replace with:

Suggested change
RUN if [ -d certs ]; then \
echo "Copying certs directory..."; \
tar -cf - certs | tar -xf -; \
else \
echo "No certs directory, skipping copy."; \
fi
COPY certs /app/certs

Or use a build arg to make the COPY conditional before the build.

Comment on lines +9 to +14
RUN if [ -d certs ]; then \
echo "Copying certs directory..."; \
tar -cf - certs | tar -xf -; \
else \
echo "No certs directory, skipping copy."; \
fi
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

logic: Same issue - RUN cannot copy from build context. This will fail and no certs available for line 17.

Replace with:

Suggested change
RUN if [ -d certs ]; then \
echo "Copying certs directory..."; \
tar -cf - certs | tar -xf -; \
else \
echo "No certs directory, skipping copy."; \
fi
COPY certs /app/certs

Comment on lines +9 to +14
RUN if [ -d certs ]; then \
echo "Copying certs directory..."; \
tar -cf - certs | tar -xf -; \
else \
echo "No certs directory, skipping copy."; \
fi
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

logic: Same issue - RUN cannot copy from build context.

Replace with:

Suggested change
RUN if [ -d certs ]; then \
echo "Copying certs directory..."; \
tar -cf - certs | tar -xf -; \
else \
echo "No certs directory, skipping copy."; \
fi
COPY certs /app/certs

Comment on lines +7 to +12
RUN if [ -d certs ]; then \
echo "Copying certs directory..."; \
tar -cf - certs | tar -xf -; \
else \
echo "No certs directory, skipping copy."; \
fi
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

logic: RUN cannot access build context files - this will fail and no certs will be copied.

Replace with:

Suggested change
RUN if [ -d certs ]; then \
echo "Copying certs directory..."; \
tar -cf - certs | tar -xf -; \
else \
echo "No certs directory, skipping copy."; \
fi
COPY certs /app/certs



RUN apt-get update && apt-get install -y ca-certificates && \
if [ "$USE_NETFREE" = "true" ] && [ -d ./certs ] && [ "$(ls ./certs/*.crt 2>/dev/null)" ]; then \
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

logic: $USE_NETFREE is undefined - no ARG or ENV declaration exists for this variable. It will always be empty, causing the check to fail.

Add before line 15:

ARG USE_NETFREE=true

KamaTechOrg
KamaTechOrg previously approved these changes Nov 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants