pact-foundation / pact-ruby-cli

Amalgamated Pact Ruby CLI
https://pact.io
MIT License
12 stars 13 forks source link

Deployment attempt keeps failing for pact-foundation/pact-ruby-cli in Kubernetes cluster #18

Closed samzee closed 4 years ago

samzee commented 4 years ago

I am trying to deploy below to kubernetes cluster , here is my deployment.yaml file, i keep getting crashLoopbackOff error, am i missing anything here, any environment variable?? i tried logs, describe and events command couldn't get much details. I am using 0.12.3.0 image version, any help is much appreciated thanks,

apiVersion: apps/v1 kind: Deployment metadata: name: pactcli namespace: 223243-pact-cli spec: replicas: 1 selector: matchLabels: app: pactcli template: metadata: labels: app: pactcli spec: containers:

bethesque commented 4 years ago

The Pact CLI is not meant to be run as a service. It runs discrete tasks on your CI machine or dev machine during your tests. I think you're mistaking it for the Pact Broker, which is a permanently running service external to the CI pipeline.

https://docs.pact.io/faq#what-is-the-difference-between-the-pact-broker-and-the-mock-service

samzee commented 4 years ago

I have pact broker installed as a kubernetes pod,it is up and running n i am able to do all the tasks related to publishing, verifying n triggering webhooks, question is i have the image for pact ruby cli,, how can i use pact cli now? Sorry im very poor at kubernetes n just starting,, i want to use the can i deploy utility to proceed with deployments

bethesque commented 4 years ago

You don't run the pact-cli on kubernetes. You run it as part of your CI/CD process. What are you using to run your builds on?

bethesque commented 4 years ago

Here is a diagram that may help: https://docs.pact.io/pact_nirvana/step_4#consumer-pipeline

samzee commented 4 years ago

Thanks for replying so quickly I am using Jenkins to do my builds, i run the builds on linux hosts using Jenkins, do we need to install pact ruby cli on that linux host and use that to run ‘can i deploy’ utility, is there any documentation on how to install and use ruby cli with the image i have. Thanks

bethesque commented 4 years ago

https://docs.pact.io/implementation_guides/cli#distributions

bethesque commented 4 years ago

https://docs.pact.io/pact_broker/client_cli/readme#can-i-deploy

You can find all of these docs by going to https://docs.pact.io and typing can-i-deploy in the search bar.

samzee commented 4 years ago

@bethesque I was able to download the stand alone utility and run the can-i-deploy command , but i am getting below error Error Making request - openSSL::SSL::SSLError SSL_connect returned=1 errno=0 stage=SSLV3 read server Certificate B: certificate verify failed I:pact/lib/vendor/ruby/2.2.0/gems/pactbroker-client-2.29.1/lib/pact_broker/client/matrix.rb:13 in `get', attempt 1 of 3 ,, did anybody face this issue while running standalone ruby cli from command line ?

bethesque commented 4 years ago

Looks like you are using a self signed certificate.

The docs for configuring the cert on the client side are here: https://github.com/pact-foundation/pact-ruby-standalone/releases/tag/v1.88.8#pact-provider-verifier

You can see an example of how to configure your certificates on the client side using this docker-compose here: https://github.com/DiUS/pact_broker-docker/blob/master/docker-compose.yml#L49

samzee commented 4 years ago

Hi Beth, I downloaded the .cer file from the browser (Pact Broker URL), and pointed the environment variable $SSL_CERT_FILE to that downloaded cert , tried the command, but still no luck getting the same above error, any other solutions?

bethesque commented 4 years ago

I'm afraid I cannot debug SSL problems for you over a Github issue. You'll need to get someone from within your organisation who is familiar with certificates to help you. Whoever set up the Pact Broker with a self signed certificate is probably the person to ask. The documentation that I have provided should be enough for someone who is experienced with ops.

I recommend making a fork of https://github.com/DiUS/pact_broker-docker, and modifying the docker-compose setup to use the certificate you are using on your deployed instance.

samzee commented 4 years ago

I'm afraid I cannot debug SSL problems for you over a Github issue. You'll need to get someone from within your organisation who is familiar with certificates to help you. Whoever set up the Pact Broker with a self signed certificate is probably the person to ask. The documentation that I have provided should be enough for someone who is experienced with ops.

I recommend making a fork of https://github.com/DiUS/pact_broker-docker, and modifying the docker-compose setup to use the certificate you are using on your deployed instance.

Thanks for this,, i will try to reach someone in my org for certificate issues,, also one last thing , i have pact broker deployed in kubernetes cluster,, do u think i have to add a ingress object for pact cli to work???could that be the problem behind ssl issue?? Even though i have disable ssl env value set to true for pact broker

bethesque commented 4 years ago

I'm afraid I don't know anything about Kubernetes. You'll need to ask a Kubernetes person.