【发布时间】:2020-09-30 16:59:17
【问题描述】:
我正在使用 Gitlab 和 AWX 构建管道,并且需要过滤 webhook 的有效负载。我需要的基本上只是将 project1 和 project2(在两个 / 之间)解析为一个我可以在其他角色中使用的变量。
tower_webhook_payload:
after:
before:
checkout_sha:
commits:
- id:
message:
title:
timestamp:
url: >-
author:
name:
email:
added: []
modified:
- repository/project1/file1
removed: []
- id:
message:
title:
timestamp:
url: >-
author:
name:
email:
added:
modified:
- repository/project2/file2
removed: []
这是我的粗略想法,但我没有太多使用列表或正则表达式的经验。
- debug: msg="{{ tower_webhook_payload.commits | select('match', 'modified') | list }}"
"msg": "Unexpected templating type error occurred on ({{ tower_webhook_payload.commits | select('match', 'modified') | list }}): expected string or bytes-like object"}
【问题讨论】: