小编Mr_*_*TeD的帖子

从Jenkins管道中的Groovy变量创建JSON字符串

我必须在Groovy中创建这个JSON文件.我尝试了很多东西(JsonOutput.toJson()/ JsonSlurper.parseText())但没有成功.

{
   "attachments":[
      {
         "fallback":"New open task [Urgent]: <http://url_to_task|Test out Slack message attachments>",
         "pretext":"New open task [Urgent]: <http://url_to_task|Test out Slack message attachments>",
         "color":"#D00000",
         "fields":[
            {
               "title":"Notes",
               "value":"This is much easier than I thought it would be.",
               "short":false
            }
         ]
      }
   ]
}
Run Code Online (Sandbox Code Playgroud)

这是为了向Slack发布Jenkins构建消息.

groovy json jenkins jenkins-pipeline

17
推荐指数
2
解决办法
5万
查看次数

OrderBy过滤掉EntityFieldQuery中带空字段的行

例如,我有一个EFQ请求,如:

$query  ->entityCondition('entity_type', 'node')
        ->entityCondition('bundle', 'contenttype')    
        ->propertyCondition('status', 1)
        ->propertyCondition('language', $language->language, '=')
        ->fieldOrderBy('field_date', 'value', 'DESC')
        ->fieldOrderBy('field_code', 'value', 'DESC')
Run Code Online (Sandbox Code Playgroud)

可以field_code为空.当我按此字段排序时,它将排除所有获得空值的行.如何避免这种行为并让他们留在结果中?

drupal drupal-7

5
推荐指数
1
解决办法
1065
查看次数

标签 统计

drupal ×1

drupal-7 ×1

groovy ×1

jenkins ×1

jenkins-pipeline ×1

json ×1