Hi there, When trying to publish a openapi spec , ...
# pact-broker
f
Hi there, When trying to publish a openapi spec , I'm getting this error:
Copy code
-----

ProviderName is: bi-publish-service

NameError - uninitialized constant Pactflow::Client::ProviderContracts::Publish::OpenStruct



##[error]Bash exited with code '1'.
I think i get where the error came: https://github.com/pact-foundation/pact_broker-client/blob/5cfb353d68122c0d87fdbb5[…]7076ba51/spec/lib/pact_broker/client/cli/broker_publish_spec.rb You need to add the necessary require:
Copy code
require 'ostruct'
y
are you using the docker image, standalone, or rubygem directly?
f
dockerimage
y
ty, can you try with previous release tag ( not latest, which went out on Friday iirc)
f
Copy code
docker run --rm \
        -w ${{parameters.SwaggerPactOutputFolder}} \
        -v ${{parameters.SwaggerPactOutputFolder}}:${{parameters.SwaggerPactOutputFolder}} \
        -e PACT_BROKER_BASE_URL \
        -e PACT_BROKER_TOKEN \
        pactfoundation/pact-cli:latest \
        pactflow publish-provider-contract \
          $(UpdatedOpenApiFilePath) \
          --provider $providerName \
          --provider-app-version ${{parameters.ProviderVersion}} \
          --branch $FINALBRANCH \
          --content-type application/yaml \
          --verification-exit-code=0 \
          --verification-results dummy-successful-test-result.xml \
          --verification-results-content-type text/plain \
          --verifier trustme
change this to what?
pactfoundation/pact-cli:latest \
i don't know the previous tag value
f
ok
y
odd that openstruct is used 13 times in the code but only required in three files, and looking at the history, it doesn’t seem to have been added prior and removed 🤔
f
well it's what i got from investigating that error message
i can be wrong
and this needs proper investigation
🙂
m
That's a spec file, shouldn't be used at all in the real CLI invocation. Hmmm
y
Ok so I can recreate this on
pactfoundation/pact-cli:latest
but not on the previous tag
pactfoundation/pact-cli:1.1.0.0
f
so, we really have a proper problem
🙂
just need to git bissect the cause of error
what was introduced
y
so it looks it is affecting others too https://github.com/fastlane/fastlane/issues/21944 passing the following env var
Copy code
-e RUBYOPT="-rostruct"
fixes it
Copy code
docker run -v $PWD:/home --rm -it -e PACT_BROKER_TOKEN -e PACT_BROKER_BASE_URL -e RUBYOPT="-rostruct" pactfoundation/pact-cli:latest pactflow publish-provider-contract /home/example/provider-contracts/oas.yml --provider foo --provider-app-version foo1 --content-type application/yaml
f
yeah, but then we need a proper fix
y
obviously …
f
or add the necessary import in code 🙂
y
it’s been raised here https://github.com/pact-foundation/pact-ruby-cli/issues/131 Yes that would need to be tested, it’s could be a regression in ruby, as nothing material has changed in our code from previously working versions (we’ve just bumped the ruby version and taken steps to get our image to build)
bit of a longer tail that, so at least letting you know how you can get sorted for now (other than pinning to the last tag)
f
Ok, thanks for the heads up
y
np, bizarrely just adding ruby 3.3 into the matrix of pact_broker-client results in the same error (which is good, in a way in helping track it down) https://github.com/pact-foundation/pact_broker-client/actions/runs/9066772247/job/24910432241 bear in mind this job was previously passing three months ago, with no code changes.
d
I just joined the group just for this…Sounds like i’m not the only one with issues! Thanks
blobwave 1
y
release going out now that should hopefully sort it https://github.com/pact-foundation/pact-ruby-cli/actions/runs/9067576567
thankyou 1
d
thank you! I was going to add target pact-cli:1.1.0.0, or pass in -e RUBYOPT=“-rostruct”, sounds like I’ll just wait then! Thank you so much!
y
if you pull the latest image and try, that should be sorted
docker pull pactfoundation/pact-cli:latest
f
👍🧐
d
Thank you!
m
Thanks Yousaf!