如何在 gitlab ci-cd 中使用 JIRA api POST 卷曲,其主体为 json

问题描述 投票:0回答:1
script:
  - echo "Running unit tests... This will take about 60 seconds."
  - apk add curl
  - >
    curl -X POST "https://test.atlassian.net/rest/api/2/issue/" \
    -u "[email protected]:${JIRA_TOKEN}"
    -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -d '{
      "fields": {
        "project": {
          "key": "SNAP"
        },
        "summary": "Testing Gitlab Release",
        "description": "Issue Description",
        "issuetype": {
          "name": "Epic"
        }
      }
    }'
  - echo "Code coverage is 90%"

这在我的curl请求中给了我一个错误-> curl:(3) URL 被拒绝:URL 函数的输入格式错误

gitlab gitlab-ci jira jira-rest-api
1个回答
0
投票

试试这个

script: |
  echo "Running unit tests... This will take about 60 seconds."
  apk add curl
  curl -X POST "https://test.atlassian.net/rest/api/2/issue/"
    -u "[email protected]:${JIRA_TOKEN}"
    -H "Accept: application/json"
    -H "Content-Type: application/json"
    -d '{
      "fields": {
        "project": {
          "key": "SNAP"
        },
        "summary": "Testing Gitlab Release",
        "description": "Issue Description",
        "issuetype": {
          "name": "Epic"
        }
      }
    }'
  echo "Code coverage is 90%"
© www.soinside.com 2019 - 2024. All rights reserved.