Integration Extract JSON Value #2350
Replies: 4 comments 1 reply
-
Beta Was this translation helpful? Give feedback.
-
|
Ow and this is how I extract the env value in my task ---
- hosts: name_flex_dev_01
vars:
branch: "{{ lookup('env', 'FLEX_BRANCH', default='develop') }}"
become: yes
become_user: ubuntu
tasks:
- name: output branch
debug:
msg: "branch={{ branch }}"
|
Beta Was this translation helpful? Give feedback.
-
|
So I started debugging the app and got to this LocalJob. It seems the issue is occurring because the t.Environment.ENV value might not be in a proper JSON format, or the json.Unmarshal call is not correctly parsing the input. semaphore/services/tasks/LocalJob.go Lines 152 to 156 in f5404b1 I added some outputs to the CLI and saw that |
Beta Was this translation helpful? Give feedback.
-
|
Hi @ronzyfonzy ---
- hosts: name_flex_dev_01
vars:
branch: "{{ FLEX_BRANCH }}"
become: yes
become_user: ubuntu
tasks:
- name: output branch
debug:
msg: "branch={{ branch }}" |
Beta Was this translation helpful? Give feedback.


Uh oh!
There was an error while loading. Please reload this page.
-
Hello 👋
Before I ask the question I have to say that this is an awesome project 👍 ... so Thank You
I have deployed Semaphore on my staging server and I created an Integration where a webhook (PullRequest created) from Bitbucket triggers a ansible task. The problem I have is that I am unable to extract the branch name from the POST request. Nowhere in the documentation I have found how to exactly extract a nested value in a JSON payload. I presume I can do that with JSONPath syntaxs. In my case that is
pullrequest.source.branch.name(based on the payload - see sample payload bellow)Am I doing something wrong? Should I extract in another way?
This is an obfuscated JSON example:
{ "pullrequest": { "comment_count": 0, "task_count": 0, "type": "pullrequest", "id": 1017, "title": "Feature/FLEX-7202 ansible", "description": "", "source": { "branch": { "name": "feature/FLEX-7202-ansible", "links": {} }, "commit": {}, "repository": {} }, "reviewers": [], "participants": [], "links": {} } }This is how I have setup my value extractor:
Beta Was this translation helpful? Give feedback.
All reactions