fluid-cloudnative/fluid

[BUG] Failed to build circleci due to Invalid TAR Magic

cheyang opened this issue · 0 comments

Description:

During the Docker build process, there is an error occurring at the stage where Helm is being downloaded and extracted. The issue is related to the tar command failing with an "invalid tar magic" error. This prevents the successful completion of the Docker image build.

Steps to Reproduce:

  1. Use the provided Dockerfile snippet.
  2. Attempt to build the Docker image with the specified HELM_VERSION and TARGETARCH arguments.

Dockerfile Snippet:

ARG HELM_VERSION
ARG TARGETARCH
RUN curl -o ${HELM_VERSION}-linux-${TARGETARCH}.tar.gz https://get.helm.sh/${HELM_VERSION}-linux-${TARGETARCH}.tar.gz && \
    tar -xvf ${HELM_VERSION}-linux-${TARGETARCH}.tar.gz && \
    mv linux-${TARGETARCH}/helm /usr/local/bin/ddc-helm && \
    chmod u+x /usr/local/bin/ddc-helm && \
    rm -f ${HELM_VERSION}-linux-${TARGETARCH}.tar.gz

Error Log:

[stage-1 3/6] RUN curl -o ${HELM_VERSION}-linux-${TARGETARCH}.tar.gz https://get.helm.sh/${HELM_VERSION}-linux-${TARGETARCH}.tar.gz && \
    tar -xvf ${HELM_VERSION}-linux-${TARGETARCH}.tar.gz && \
    mv linux-${TARGETARCH}/helm /usr/local/bin/ddc-helm && \
    chmod u+x /usr/local/bin/ddc-helm && \
    rm -f ${HELM_VERSION}-linux-${TARGETARCH}.tar.gz:
0.241 Warning: The filename argument '-linux-amd64.tar.gz' looks like a flag.
0.241   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
0.242                                  Dload  Upload   Total   Spent    Left  Speed
100   215  100   215    0     0    529      0 --:--:-- --:--:-- --:--:--   529
0.652 tar: invalid tar magic
------
Dockerfile.dataset:23
--------------------
  22 |     ARG HELM_VERSION
  23 | >>> RUN curl -o ${HELM_VERSION}-linux-${TARGETARCH}.tar.gz https://get.helm.sh/${HELM_VERSION}-linux-${TARGETARCH}.tar.gz && \
  24 | >>>     tar -xvf ${HELM_VERSION}-linux-${TARGETARCH}.tar.gz && \
  25 | >>>     mv linux-${TARGETARCH}/helm /usr/local/bin/ddc-helm && \
  26 | >>>     chmod u+x /usr/local/bin/ddc-helm && \
  27 | >>>     rm -f ${HELM_VERSION}-linux-${TARGETARCH}.tar.gz
  28 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c curl -o ${HELM_VERSION}-linux-${TARGETARCH}.tar.gz https://get.helm.sh/${HELM_VERSION}-linux-${TARGETARCH}.tar.gz &&     tar -xvf ${HELM_VERSION}-linux-${TARGETARCH}.tar.gz &&     mv linux-${TARGETARCH}/helm /usr/local/bin/ddc-helm &&     chmod u+x /usr/local/bin/ddc-helm &&     rm -f ${HELM_VERSION}-linux-${TARGETARCH}.tar.gz" did not complete successfully: exit code: 1

Exited with code exit status 1

Possible Causes:

  1. Incorrect HELM_VERSION or TARGETARCH values, leading to the download of an invalid file.
  2. Network or server issues causing the downloaded file to be incomplete or corrupted.

Suggested Solutions:

  1. Validate the values of HELM_VERSION and TARGETARCH.
  2. Ensure that the URL is correct and accessible.
  3. Add checks to confirm the downloaded file is correctly received before attempting to extract.

Additional Information:

The warning about "The filename argument '-linux-amd64.tar.gz' looks like a flag" suggests there might be an issue with how the HELM_VERSION and TARGETARCH variables are being utilized. This needs further investigation.


This issue needs to be addressed to enable a successful Docker image build process.