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

document how to use @ with --data #144

Closed
mefellows opened this issue Sep 25, 2023 · 3 comments
Closed

document how to use @ with --data #144

mefellows opened this issue Sep 25, 2023 · 3 comments
Labels
documentation Indicates a need for improvements or additions to documentation

Comments

@mefellows
Copy link
Member

mefellows commented Sep 25, 2023

It is not obvious how to specify a file with the --data attribute. The code and specs indicate it should be prefixed with an @:

For example, this example shows how it could be used IRL:

 	pact-broker create-or-update-webhook \
	  'https://api.github.com/repos/pactflow/example-consumer/statuses/$${pactbroker.consumerVersionNumber}' \
	  --header 'Content-Type: application/json' 'Accept: application/vnd.github.v3+json' 'Authorization: token $${user.githubCommitStatusToken}' \
	  --request POST \
	  --data @${PWD}/pactflow/github-commit-status-webhook.json \
	  --uuid ${GITHUB_WEBHOOK_UUID} \
	  --consumer ${PACTICIPANT} \
	  --contract-published \
	  --provider-verification-published \
	  --description "Github commit status webhook for ${PACTICIPANT}"

or inlined (without the @ usage):

	pact-broker create-or-update-webhook \
	  "https://api.github.com/repos/${GITHUB_REPO}/dispatches" \
	  --header 'Content-Type: application/json' 'Accept: application/vnd.github.everest-preview+json' 'Authorization: Bearer $${user.githubToken}' \
	  --request POST \
	  --data '{ "event_type": "contract_requiring_verification_published","client_payload": { "pact_url": "$${pactbroker.pactUrl}", "sha": "$${pactbroker.providerVersionNumber}", "branch":"$${pactbroker.providerVersionBranch}" , "message": "Verify changed pact for $${pactbroker.consumerName} version $${pactbroker.consumerVersionNumber} branch $${pactbroker.consumerVersionBranch} by $${pactbroker.providerVersionNumber} ($${pactbroker.providerVersionDescriptions})" } }' \
	  --uuid ${CONTRACT_REQUIRING_VERIFICATION_PUBLISHED_WEBHOOK_UUID} \
	  --provider ${PACTICIPANT} \
	  --contract-requiring-verification-published \
	  --description "contract_requiring_verification_published for ${PACTICIPANT}"

We should update the description to improve this:

  -d, [--data=DATA]        # Webhook payload (file or string)
@mefellows mefellows added the documentation Indicates a need for improvements or additions to documentation label Sep 25, 2023
@bethesque
Copy link
Member

@mefellows if you remember the person who asked about this, please see if this makes more sense to them.

@bethesque
Copy link
Member

Oh, I found the thread.

@mefellows
Copy link
Member Author

Awesome, thanks Beth. I think that clarifies it nicely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Indicates a need for improvements or additions to documentation
Projects
Status: Closed
Development

No branches or pull requests

2 participants