dockercontinuous-integrationdevopstestcontainersdrone.io

Drone pipeline Failure which uses testcontainers to run integration tests


I am running the drone pipeline with the below steps

  - name: integration-tests
    image: quay.io/testcontainers/dind-drone-plugin
    settings:
      build_image: openjdk:17-alpine
      cmd:
        - apk update
        - apk add protobuf grpc curl file
        - mkdir -p /root/.gradle/caches/modules-2/files-2.1/io.grpc/protoc-gen-grpc-java/1.56.1
        - cd /root/.gradle/caches/modules-2/files-2.1/io.grpc/protoc-gen-grpc-java/1.56.1
        - curl -LO https://repo.maven.apache.org/maven2/io/grpc/protoc-gen-grpc-java/1.56.1/protoc-gen-grpc-java-1.56.1-linux-x86_64.exe
        - chmod 777 protoc-gen-grpc-java-1.56.1-linux-x86_64.exe
        - export PATH=$PATH:/root/.gradle/caches/modules-2/files-2.1/io.grpc/protoc-gen-grpc-java/1.56.1
        - cd /drone/src
        - ls -l /root/.gradle/caches/modules-2/files-2.1/io.grpc/protoc-gen-grpc-java/1.56.1
        - file /root/.gradle/caches/modules-2/files-2.1/io.grpc/protoc-gen-grpc-java/1.56.1/protoc-gen-grpc-java-1.56.1-linux-x86_64.exe
        - ls -l /root/.gradle/caches/modules-2/files-2.1/io.grpc/protoc-gen-grpc-java/1.56.1
        - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib:/lib64:/usr/lib:/usr/local/lib
        - /root/.gradle/caches/modules-2/files-2.1/io.grpc/protoc-gen-grpc-java/1.56.1/protoc-gen-grpc-java-1.56.1-linux-x86_64.exe
        - ./gradlew clean cleanTest test --rerun-tasks -S

Eventhough the protoc-gen-grpc-java-1.56.1-linux-x86_64.exe is available the pipeline is available below error is thrown

sh: /root/.gradle/caches/modules-2/files-2.1/io.grpc/protoc-gen-grpc-java/1.56.1/protoc-gen-grpc-java-1.56.1-linux-x86_64.exe: not found

Any tips would be appreciated as I am new to drone CI


Solution

  • This is an issue in regards to using the alpine container or alpine as an os.

    Alpine uses musl-libc as its C standard library, whereas the protoc binary provided is compiled with glibc.

    The exception is misleading and unfortunately takes down the incorrect path, as the binary exists, it is just that Alpine does not recognise the binary as it is not compiled with musl-libc.

    You have 2 options:

    1. Use a different os container like Ubuntu

    2. Or install glibc as part of your docker build using the following: alpine-pkg-glibc

      • It is a GNU C Library as a Alpine Linux package to run binaries linked against glibc