Skip to content

Commit

Permalink
fix: Fix comparison in Docker under random UID
Browse files Browse the repository at this point in the history
  • Loading branch information
Wuestengecko committed Sep 20, 2024
1 parent 402cfc5 commit 6111060
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
9 changes: 4 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ EXPOSE 8000

COPY ./templates /views

# Cache directory has to be writable
RUN chmod -R 777 /home
ENV HOME=/home

COPY entrypoint.sh /entrypoint.sh
Expand All @@ -53,10 +51,11 @@ ENV MODE=production
COPY frontend/fetch-version.py ./frontend/
RUN python frontend/fetch-version.py

# Run as non-root user per default
USER 1000

# Pre-install npm dependencies for context diagrams
RUN python -c "from capellambse_context_diagrams import _elkjs; _elkjs._install_required_npm_pkg_versions()"

# Run as non-root user per default
RUN chmod -R 777 /home
USER 1000

ENTRYPOINT ["/entrypoint.sh"]
3 changes: 2 additions & 1 deletion capella_model_explorer/backend/explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ async def post_compare(commit_range: CommitRange):
self.diff["lookup"] = create_diff_lookup(self.diff["objects"])
return {"success": True}
except Exception as e:
LOGGER.exception("Failed to compare versions")
return {"success": False, "error": str(e)}

@self.router.post("/api/object-diff")
Expand Down Expand Up @@ -375,5 +376,5 @@ def create_diff_lookup(data, lookup=None):
if obj["children"]:
create_diff_lookup(obj["children"], lookup)
except Exception:
pass
LOGGER.exception("Cannot create diff lookup")
return lookup
2 changes: 1 addition & 1 deletion capella_model_explorer/backend/model_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def compare_objects(
"attributes": attributes,
"children": children,
}
return None
return {}


def _handle_attribute_property(attr, old_object, new_object, attributes):
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/ModelComparisonView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export const ModelComparisonView = ({ endpoint }) => {
modelDiff.objects &&
Object.keys(modelDiff.objects).map(
(layer) =>
modelDiff.objects[layer] && (
Object.keys(modelDiff.objects[layer]).length > 0 && (
<DiffExplorer
node={modelDiff.objects[layer]}
setObjectID={setObjectID}
Expand Down

0 comments on commit 6111060

Please sign in to comment.