Im trying to run following script in order to publ...
# pact-js
b
Im trying to run following script in order to publish contract to pactflow.. IT is being run in azure pipeline. When im doing ls -la with my path PACT FILE is there. ( on host) , but when im running command in pipeline, still receving error message that:
Copy code
Specified pact file '/pacts/somePact.json' does not exist. This sometimes indicates one of the arguments has been specified with the wrong name and has been incorrectly identified as a file path. If you are using Docker, check that you have mounted the pact file or directory into the container correctly using `-v`, and have specified the location of the pact file or directory in the *Docker container*, not the *host*.
chmod 755 $(Build.SourcesDirectory)/someFolder/src/pacts/somePact.json
docker run --rm -v $(Build.SourcesDirectory)/someFolder/src/pacts/somePact.json:/pacts pactfoundation/pact-cli:latest pact-broker publish /pacts/somePact.json --broker-base-url=<https://somecompany.pactflow.io> --broker-token=token--consumer-app-version=$(version.packageSemVer)
m
Are you on windows? I recall the directory mapping being a bit different on that
b
yes and when i tryin to print this path $(Build.SourcesDirectory)/someFolder/src/pacts/ pact file is there
sorry my bad, agent os is Linux
m
It looks like you're mapping a file (on the host) to a dir on the container. Either map the file to a file, or just map the directories
b
i just went to simpler solution without docker. $(pwd)/bff/node_modules/.bin/pact-broker publish $(pwd)/bff/src/pacts\pactFile.json --consumer-app-version=version --broker-token=token--broker-base-url=url
🙌 1
m
That also works ;)