Comments (11)
Can you supply complete pipeline
, request
with curl command and response
?
from generic-webhook-trigger-plugin.
Can you supply complete
pipeline
,request
with curl command andresponse
?
`
pipeline {
agent any
environment {
SCRIPT_PROJECT_ROOT = "/Users/macuser/PycharmProjects/smartscripts"
}
triggers {
GenericTrigger(
genericVariables: [
[key: 'BODY',
value: '$',
expressionType: 'JSONPath', //Optional, defaults to JSONPath
regexpFilter: '', //Optional, defaults to empty string
defaultValue: '' //Optional, defaults to empty string
],
],
causeString: 'Generic Cause',
token: 'gitlab',
printContributedVariables: true,
printPostContent: true,
silentResponse: true,
)
}
stages {
stage('action') {
steps {
sh "export PYTHONPATH=${SCRIPT_PROJECT_ROOT} && python3 -u ${SCRIPT_PROJECT_ROOT}/android/jenkins/webhook/webhook-gitlab.py
--data $BODY
"
}
}
}
}
`
the jenkins execute log:
`
- python3 -u /Users/macuser/PycharmProjects/smartscripts/android/jenkins/webhook/webhook-gitlab.py --data object_kind:push event_name:push ...
`
$BODY output is not raw json,but a JSONPATH string.
from generic-webhook-trigger-plugin.
I am missing the curl-command.
Also the log, ans specifically the contributed variables.
from generic-webhook-trigger-plugin.
I am missing the curl-command. Also the log, ans specifically the contributed variables.
It it just trigger by gitlab webhook, the URL is
http://JENKINS_URL/generic-webhook-trigger/invoke?token=gitlab
,
I want to do something after push, and I need to raw json body
from generic-webhook-trigger-plugin.
This is impossible to investigate if you do not supply something that I can reproduce.
from generic-webhook-trigger-plugin.
the gitlab we
This is impossible to investigate if you do not supply something that I can reproduce.
sorry, I do not understand, Has any else Do you need?
The webhook is not a curl-command, it is just trigger by gitlab push event。the gitlab push event, webhook body sample is on docs: https://docs.gitlab.com/ee/user/project/integrations/webhook_events.html
from generic-webhook-trigger-plugin.
more jenkins log:
Generic Cause
GenericWebhookEnvironmentContributor
Received:
{"object_kind":"push","event_name":"push",...}
Contributing variables:
BODY = {"object_kind":"push","event_name":"push",..}
- python3 -u /Users/macuser/PycharmProjects/smartscripts/android/jenkins/webhook/webhook-gitlab.py --data object_kind:push event_name:push...
===
the BODY variables in log is Json,but in pipeline shell command $BODY is not json, but JSONPATH format
from generic-webhook-trigger-plugin.
So you are saying that if you do:
sh """
echo "BODY: " + BODY
"""
You do not get BODY: {"object_kind":"push","event_name":"push",..}
?
What exactly do you get?
from generic-webhook-trigger-plugin.
- object_kind:push event_name:push ...
Yes ! ,
sh "export PYTHONPATH=${SCRIPT_PROJECT_ROOT} && python3 -u ${SCRIPT_PROJECT_ROOT}/android/jenkins/webhook/webhook-gitlab.py
--data $BODY "
the $BODY is not json, but JSONTPATH format string -> object_kind:push event_name:push ...
from generic-webhook-trigger-plugin.
If you print the variable, like I said, you will see that it is the raw json.
You problem is probably is how you are using the value. See https://stackoverflow.com/a/38385227/2477084
from generic-webhook-trigger-plugin.
If you print the variable, like I said, you will see that it is the raw json.
You problem is probably is how you are using the value. See https://stackoverflow.com/a/38385227/2477084
you are right! the BODY is a raw json. thanks very much . The problem is that, shell command json param is need to wrap by ''
from generic-webhook-trigger-plugin.
Related Issues (20)
- Unable to trigger build for tag based code checkout HOT 11
- How to bypass the crumb protection? HOT 1
- option 'avoid flatterning branches' is broken for JSONPath HOT 3
- Webhook secret doesn't work with GitHub HOT 9
- Finding Security Violation and operational Risks HOT 6
- Performance is slow for large installations HOT 18
- Getting no POST body in the Jenkins job HOT 2
- Same setting works in staging jenkins and doesn't work in Prod jenkins HOT 2
- Running sh without filling in a value for Post content parameters will blocking HOT 1
- Sometimes multiple variable contributions is shown HOT 3
- GWT 1.88.1 breaks Jenkins job HOT 2
- groovy.lang.MissingPropertyException: No such property HOT 1
- Plugin does not accept Github token scheme HOT 7
- Reload trigger configuration from scm HOT 5
- Buildcause no longer detected since Jenkins update? HOT 3
- Not compatible with the "Trigger builds remotely" configuration option HOT 2
- The JSON response is not shown in Jenkins log, even if it is configured to be shown HOT 4
- Link is dead HOT 1
- Expose request JSON payload as an object in a variable
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from generic-webhook-trigger-plugin.