Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Независимый от версии EDT поиск jar-файлов для Coverage41C #60

Merged
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
6 changes: 3 additions & 3 deletions coverage41C/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ ARG BASE_IMAGE=edt
ARG BASE_TAG
ARG EDT_VERSION=2021.3
ARG COVERAGE41C_VERSION=2.7.2
ARG EDT_PLUGINS=/opt/1C/1CE/components/1c-edt-${EDT_VERSION}*-x86_64/plugins

FROM ${DOCKER_REGISTRY_URL}/edt:${EDT_VERSION} as base

RUN ln -s $(find /opt/1C -name "com._1c.g5.v8.dt.debug.*.jar" -printf '%h\n'| sort -u) /opt/1C/edt_plugins

Comment on lines +9 to +10
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add error handling to the symbolic link creation

The current implementation might fail silently in edge cases. Consider making it more robust:

-RUN ln -s $(find /opt/1C -name "com._1c.g5.v8.dt.debug.*.jar" -printf '%h\n'| sort -u) /opt/1C/edt_plugins
+RUN PLUGIN_DIR=$(find /opt/1C -name "com._1c.g5.v8.dt.debug.*.jar" -printf '%h\n' | sort -u) && \
+    if [ $(echo "$PLUGIN_DIR" | wc -l) -ne 1 ]; then \
+        echo "Error: Expected exactly one plugin directory, found:" && \
+        echo "$PLUGIN_DIR" && \
+        exit 1; \
+    fi && \
+    if [ ! -f "$PLUGIN_DIR/com._1c.g5.v8.dt.debug.core_"*.jar ] || \
+       [ ! -f "$PLUGIN_DIR/com._1c.g5.v8.dt.debug.model_"*.jar ]; then \
+        echo "Error: Required jar files not found in $PLUGIN_DIR" && \
+        exit 1; \
+    fi && \
+    rm -f /opt/1C/edt_plugins && \
+    ln -s "$PLUGIN_DIR" /opt/1C/edt_plugins
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
RUN ln -s $(find /opt/1C -name "com._1c.g5.v8.dt.debug.*.jar" -printf '%h\n'| sort -u) /opt/1C/edt_plugins
RUN PLUGIN_DIR=$(find /opt/1C -name "com._1c.g5.v8.dt.debug.*.jar" -printf '%h\n' | sort -u) && \
if [ $(echo "$PLUGIN_DIR" | wc -l) -ne 1 ]; then \
echo "Error: Expected exactly one plugin directory, found:" && \
echo "$PLUGIN_DIR" && \
exit 1; \
fi && \
if [ ! -f "$PLUGIN_DIR/com._1c.g5.v8.dt.debug.core_"*.jar ] || \
[ ! -f "$PLUGIN_DIR/com._1c.g5.v8.dt.debug.model_"*.jar ]; then \
echo "Error: Required jar files not found in $PLUGIN_DIR" && \
exit 1; \
fi && \
rm -f /opt/1C/edt_plugins && \
ln -s "$PLUGIN_DIR" /opt/1C/edt_plugins

FROM ${DOCKER_REGISTRY_URL}/${BASE_IMAGE}:${BASE_TAG}
LABEL maintainer="Dima Ovcharenko <[email protected]>, Korus Consulting LLC"

ARG COVERAGE41C_VERSION
ARG EDT_PLUGINS

COPY --from=base ${EDT_PLUGINS}/com._1c.g5.v8.dt.debug.core_*.jar ${EDT_PLUGINS}/com._1c.g5.v8.dt.debug.model_*.jar /opt/1C/1CE/
COPY --from=base /opt/1C/edt_plugins/com._1c.g5.v8.dt.debug.core_*.jar /opt/1C/edt_plugins/com._1c.g5.v8.dt.debug.model_*.jar /opt/1C/1CE/
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Verify successful file copy operation

The COPY command should be followed by a verification step to ensure the required files are present.

 COPY --from=base /opt/1C/edt_plugins/com._1c.g5.v8.dt.debug.core_*.jar /opt/1C/edt_plugins/com._1c.g5.v8.dt.debug.model_*.jar /opt/1C/1CE/
+RUN if [ $(ls /opt/1C/1CE/com._1c.g5.v8.dt.debug.*.jar 2>/dev/null | wc -l) -ne 2 ]; then \
+        echo "Error: Failed to copy required jar files" && \
+        exit 1; \
+    fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
COPY --from=base /opt/1C/edt_plugins/com._1c.g5.v8.dt.debug.core_*.jar /opt/1C/edt_plugins/com._1c.g5.v8.dt.debug.model_*.jar /opt/1C/1CE/
COPY --from=base /opt/1C/edt_plugins/com._1c.g5.v8.dt.debug.core_*.jar /opt/1C/edt_plugins/com._1c.g5.v8.dt.debug.model_*.jar /opt/1C/1CE/
RUN if [ $(ls /opt/1C/1CE/com._1c.g5.v8.dt.debug.*.jar 2>/dev/null | wc -l) -ne 2 ]; then \
echo "Error: Failed to copy required jar files" && \
exit 1; \
fi


ADD https://github.com/1c-syntax/Coverage41C/releases/download/v${COVERAGE41C_VERSION}/Coverage41C-${COVERAGE41C_VERSION}.tar \
/opt/
Expand Down