Hi All, did anyone integrated the pact-js in gitl...
# pact-js
r
Hi All, did anyone integrated the pact-js in gitlab/github ci/cd pipeline (node project)??
t
Yes, pact will work with any CI / CD process. See the examples in the pact-js repo on github.
r
@Timothy Jones can you share your stage code .
t
There are examples in the pact-js repo on github
r
i follow those step but still giving
Copy code
err Error: /builds/panamera/fcg/service/auction/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.89.02-rc1/pact/lib/ruby/bin/ruby: line 6: /builds/panamera/fcg/service/auction/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.89.02-rc1/pact/lib/ruby/bin.real/ruby: No such file or directory
    at ChildProcess.<anonymous> (/builds/panamera/fcg/service/auction/node_modules/@pact-foundation/pact-node/src/verifier.js:187:64)
    at Object.onceWrapper (events.js:520:26)
    at ChildProcess.emit (events.js:412:35)
    at ChildProcess.emit (domain.js:470:12)
    at maybeClose (internal/child_process.js:1055:16)
    at Socket.<anonymous> (internal/child_process.js:441:11)
    at Socket.emit (events.js:400:28)
    at Socket.emit (domain.js:470:12)
    at Pipe.<anonymous> (net.js:675:12)
    at Pipe.callbackTrampoline (internal/async_hooks.js:131:17)
    ✓ validates the expectations of Dealer-Service (89ms)
  1 passing (236ms)
Uploading artifacts for successful job
@Timothy Jones
@Timothy Jones i am using image : node:14.17-alpine in gitlab stage
t
Copy code
you'll need to ensure the following dependencies are met:

Bash (it's not enough to have Ash)
Standard CAs for TLS network communication
glibc
Looks like your issue is because bash is missing
r
can we connect so that easily understand the issue …i am struggling last 10 days?
t
I'm sorry, I'm a volunteer, and have limited time. Your issue is because alpine linux does not come with bash. You will need to install bash in your image. See the reference image at the bottom of that page I linked
r
@Timothy Jones need to use
runPactTests:
image: pactfoundation/pact-cli:latest
stage: pacts-tests
services:
image for gitlab stage?
t
In the alpine linux image
gitlab is unrelated
r
got it but this docker file i am using
Copy code
FROM node:8-alpine

RUN apk add --no-cache --virtual build-dependencies build-base

RUN  apk --no-cache add ca-certificates wget bash \
  && wget -q -O /etc/apk/keys/sgerrand.rsa.pub <https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub> \
  && wget <https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.29-r0/glibc-2.29-r0.apk> \
  && apk add glibc-2.29-r0.apk

WORKDIR /app

COPY package*.json /app/
RUN npm install
COPY . /app/

RUN npm test
@Timothy Jones i am using node 14.17 but in documentation mention node:8-alpine
t
Copy code
RUN npm install
COPY . /app/
This might need to be in the other order
npm install will install the relevant binaries for pact-js, but possibly the copy command is clobbering them
r
can you check this
t
Sorry, I can't check your production dockerfile - even if I could, I can't build that without access to the images.
But I don't think that's the dockerfile where your error is coming from.
The error you have is typically because bash is not installed on the image it is running on.
That's all I can tell you, sorry.
r
i m adding
SHELL ["/bin/bash", "-c"]
in my DockerFile
is it correct?
t
No. See the documentation I linked above.