gitlab中的release cli无法做post请求。如何正确书写命令?

问题描述 投票:0回答:1

我想将之前工作中的工件设置为发布中的资产,但据说release-cli未能向gitlab url发出请求。我该如何解决这个问题? 为什么我收到这个错误? 这是我收到的错误:

release-cli --insecure-https create --name="$VERSION" --description "$CI_COMMIT_TAG_MESSAGE" --tag-name="$VERSION" --assets-link='{"name":"docker_image.zip","url":"'$GE_JOB_URL'/artifacts/download?file_type=archive"}'
time="2023-09-01T13:14:03Z" level=info msg="Creating Release..." cli=release-cli command=create name= project-id=48 ref=7...02 server-url="http://<gitlab_url>" tag-message= tag-name= version=0.15.0
time="2023-09-01T13:14:34Z" level=fatal msg="run app" cli=release-cli error="failed to create release: failed to do request: Post \"http://<gitlab_url>/api/v4/projects/48/releases\": dial tcp <some IP with port>: i/o timeout" version=0.15.0

这是gitlab yml文件中的代码:

release: 
  stage: release
  image: registry.gitlab.com/gitlab-org/release-cli:latest 
  needs:
    - job: build:image
      artifacts: true
  rules:
    - if: $CI_COMMIT_TAG 
    - when: always
  script:
    - echo "running release_job"
    - echo 'Previous Job ID is printed below'
    - echo $GE_JOB_ID
    - echo $GE_JOB_URL
    - release-cli --insecure-https create --name="$VERSION" --description "$CI_COMMIT_TAG_MESSAGE" --tag-name="$VERSION" --assets-link='{"name":"docker_image.zip","url":"'$GE_JOB_URL'/artifacts/download?file_type=archive"}'

  
gitlab yaml release jobs gitlab-ci.yml
1个回答
0
投票

您必须提供一个

--server-url
标志。 (参见文档

您当前设置为

server-url="http://gitlab_url"
,这在您提供的错误消息中有所说明,显然是不正确的。

© www.soinside.com 2019 - 2024. All rights reserved.