pact-foundation / pact-js

JS version of Pact. Pact is a contract testing framework for HTTP APIs and non-HTTP asynchronous messaging systems.
https://pact.io
Other
1.59k stars 343 forks source link

Migration 9 -> 10 with redhat #1032

Closed sergewar closed 1 year ago

sergewar commented 1 year ago

Software versions

Issue Checklist

Please confirm the following:

Steps to reproduce

We are trying to bump pact version from “9.17.3” to “10.4.0" On pact 9.17.3 all works as expected but on 10.4.0 we get an error:

/.yarn/unplugged/@pact-foundation-pact-core-npm-13.12.2-ccc2e2dd57/node_modules/@pact-foundation/pact-core/build/Release/libpact_ffi.so: gnu_get_libc_version: symbol not found

Image was built with alpine 3.15 glibc_version 2.34-r0

As resolution (in documentation mentioned that pact not supports alpine but supports OS which supports linking to glibc) we tried to migrate to redhat based image (ubi8/nodejs-16-minimal:1-79.1669833161) but now we get error:

Test suite failed to run
libc.musl-x86_64.so.1: cannot open shared object file: No such file or directory
[registry.access.redhat.com/ubi8/nodejs-16-minimal:1-79.1669833161](http://registry.access.redhat.com/ubi8/nodejs-16-minimal:1-79.1669833161)

glibc_version 2.28

With pact version 9.17.3 both images works as expected.

Any clues or suggestion how it can be fixed?

mefellows commented 1 year ago

As you've discovered, we do not support Alpine, as you need to compile for each version of Alpine.

I don't seem to be able to pull that image, but it looks like it uses musl. Even if you can install glibc if the OS isn't using it that won't work.

Could you please provide a way for us to reproduce or share the dockerfile here for us to review?

sergewar commented 1 year ago

We are using Dockerfile like this

FROM registry.access.redhat.com/ubi8/nodejs-16-minimal:1-79.1669833161

USER root

RUN microdnf upgrade \
      --refresh \
      --best \
      --nodocs \
      --noplugins \
      --setopt=install_weak_deps=0 && \
    microdnf install shadow-utils && \
    npm install --global yarn && \
    adduser xxx

USER xxx
sergewar commented 1 year ago

Hi @mefellows Did you try to run tests with this docker image?

mefellows commented 1 year ago

Thanks, I haven't sorry as I've been away on holidays. I just tried now and I can't see how it would work, the installation itself is missing Python and many important build tools (such as make, g++ etc.) and so the pact installation fails when it tries to compile the native dependencies. I was able to run a Pact test using the registry.access.redhat.com/ubi8/nodejs-16 variant which has the basic build dependencies for it to install and run.

Is it possible that you are re-using your node-modules from a previous docker run where musl was linked?

I'll close this as it works. Please re-open with a reproducible example/docker file if you can make it fail in an reasonable way.