Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error : NameError - uninitialized constant Pactflow::Client::ProviderContracts::Publish::OpenStruct using the latest tag #131

Closed
alanmoria opened this issue May 13, 2024 · 8 comments

Comments

@alanmoria
Copy link

docker run -v ${PWD}:/app -w "/app" pactfoundation/pact-cli
pactflow publish-provider-contract
openapi.json
-b ${PACTFLOW_HOST}
-k ${PACTFLOW_TOKEN}
--provider=${HELM_VALUES_SUFFIX}
--provider-app-version=${TAG}
--branch=${GITHUB_REF:11}
--content-type=application/json
--verification-exit-code=0
--verification-results junit.xml
--verification-results-content-type text/plain
--verifier=schemathesis

Logs:
f863b858ef: Pull complete
6a3c0f547760: Pull complete
4d861293a607: Pull complete
a1a1d54333b0: Pull complete
9cbde94641b9: Pull complete
Digest: sha256:aaabbc163438f7cac87740e2e86f6f4494c3ec09daf38bec1a61a037734a7143
Status: Downloaded newer image for pactfoundation/pact-cli:latest
NameError - uninitialized constant Pactflow::Client::ProviderContracts::Publish::OpenStruct
Error: Process completed with exit code 1.

@alanmoria
Copy link
Author

Same command was working Friday

@alanmoria
Copy link
Author

After several tests it seems that it's the latest version that's causing the problem with version 1.1.0.0 I no longer have this bug

@YOU54F
Copy link
Member

YOU54F commented May 13, 2024

Thanks for raising here, it was also raised in our slack

https://pact-foundation.slack.com/archives/C9VPNUJR2/p1715618482311699?thread_ts=1715591107.805749&cid=C9VPNUJR2

so it looks it is affecting others too

fastlane/fastlane#21944

passing the following env var

-e RUBYOPT="-rostruct"

fixes it, temporarily for end users.

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 

We had to make some upgrades to the Dockerfile, as it was failing to build, as its possible this is a regression in ruby 3.2.4 as ostruct has never explicitly needed to be required.

Bit of a longer tail to fix it at source, as we build pact_broker-client gem, publish it to ruby gems, then consume it in pact-ruby-cli in another gem. Will try a patch build of the gem and pull from git

@YOU54F
Copy link
Member

YOU54F commented May 13, 2024

Should have a fix in place, ready to go out shortly

@YOU54F
Copy link
Member

YOU54F commented May 13, 2024

Release should be going out in a mo

https://github.com/pact-foundation/pact-ruby-cli/actions/runs/9067576567

had fun with our pact-dev automation users PAT token, haven't solved it for one of the triggers

https://github.com/pact-foundation/pact_broker-client/actions/runs/9067247947/job/24912980797

which should be triggering a gem-released on our docs site

https://github.com/pact-foundation/pact_broker-client/blob/master/.github/workflows/trigger_pact_docs_update.yml

but that might be a yak shave for another day

@YOU54F
Copy link
Member

YOU54F commented May 13, 2024

@alanmoria

Should be sorted now with tag 1.1.0.2

docker pull pactfoundation/pact-cli:latest

docker run -v $PWD:/home --rm -it -e PACT_BROKER_TOKEN -e PACT_BROKER_BASE_URL pactfoundation/pact-cli:latest pactflow publish-provider-contract /home/example/provider-contracts/oas.yml --provider foo --provider-app-version foo1 --content-type application/yaml            
Updated foo version foo1
  Next steps:
    Configure the version branch to be the value of your repository branch.
Provider contract republished for foo version foo1.
  View the published provider contract at https://testdemo.pactflow.io/contracts/bi-directional/provider/foo/version/foo1/provider-contract
Next steps:
  * Publish test results to show the provider correctly implements the specification.
    The can-i-deploy check for the consumer requires this. See https://docs.pactflow.io/go/publish-provider-self-verification-results

@bethesque
Copy link
Member

Thanks for fixing this @YOU54F!

@alanmoria
Copy link
Author

alanmoria commented May 14, 2024

Thanks for the fix @YOU54F

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants