Hello, i wanna use the pactfoundation/pact-cli doc...
# general
t
Hello, i wanna use the pactfoundation/pact-cli docker image to run my bash script to record deployment to pact broker as the last step of my CI/CD pipeline. Since we have quite a number of services deployed, my bash script need to loop over the deployed services and run "pact-broker record-deployment" for each. However, i soon realized that this docker image does not have bash and when i build a custom image from this image with bash installed, i got "NoMethodError - undefined method `request_uri' for #<URI::Generic ?>" when calling pact-broker. I suspect the ruby env is missing something when running from bash. Do you have a docker image built with bash instead of sh? if not, how do i fix this undefined method error?
t
I don't know the answer to your questions, but I'm pretty sure that the CLI docker image will have bash, as I think the CLI needs it to run. Someone else can confirm
t
Thanks for the quick reply. As far as i can tell, the pact-cli image only has sh, not a fully functional bash so associated array is not supported. Anyway, i found the issue with my script on my customized image.
m
does the host that runs the image have bash? Why not just call the CLI docker multiple times?
t
my script is run in a kubernetes job as part of a helm chart that get installed after the deployment is done. I prefer to install this post deployment helm chart once to record all the services that have been deployed instead of installing this chart multiple time each for one service that was deployed.
m
interesting. Must you use associative arrays or could you achieve this using other ash primitives? I don’t expect us to want to add Bash to the image any time soon
It’s probably not out of the question, but would require some consideration (e.g. it would be a breaking change if others depended on it)
t
I am also looking for alternative to bash script, i noticed the pact-broker command is a ruby script. Perhaps i could write a ruby script that read the environment variables passed in to the docker container and then call the record-deployment function directly. However, my knowledge of ruby is limited, i would appreciate very much if you can point me how to call the record-deployment.