maven GitLab responseStatus=400 Bad Request FATAL:invalid argument ERROR:Job failed:exit code 1

edqdpe6u  于 11个月前  发布在  Maven
关注(0)|答案(1)|浏览(161)

我正在尝试使用GitLab工件dotenv文件
在我的GitLab CI YAML文件中,我编写了以下代码块:

stages:
  - build

build:
  image: maven:3.9.5-sapmachine-21
  stage: build
  script:
    - mvn clean install spring-boot:run
  artifacts:
    reports:
      dotenv: build.env

字符串
在构建日志中,我看到以下内容:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  39.144 s
[INFO] Finished at: 2023-10-25T12:07:22Z
[INFO] ------------------------------------------------------------------------
Uploading artifacts for successful job
Uploading artifacts...
build.env: found 1 matching files and directories  
WARNING: Uploading artifacts as "dotenv" to coordinator... POST https://gitlab.com/api/v4/jobs/7/artifacts: 400 Bad Request (Invalid Format)  id=7 responseStatus=400 Bad Request status=400 token=64_BFV8L
WARNING: Retrying...                                context=artifacts-uploader error=invalid argument
WARNING: Uploading artifacts as "dotenv" to coordinator... POST https://gitlab.com/api/v4/jobs/7/artifacts: 400 Bad Request (Invalid Format)  id=7 responseStatus=400 Bad Request status=400 token=64_BFV8L
WARNING: Retrying...                                context=artifacts-uploader error=invalid argument
WARNING: Uploading artifacts as "dotenv" to coordinator... POST https://gitlab.com/api/v4/jobs/7/artifacts: 400 Bad Request (Invalid Format)  id=7 responseStatus=400 Bad Request status=400 token=64_BFV8L
FATAL: invalid argument                            
Cleaning up project directory and file based variables
ERROR: Job failed: exit code 1


如何使用dotenv文件?

5tmbdcev

5tmbdcev1#

您的build.env文件的内容格式不正确。您需要确保该文件是格式正确的dotenv文件,并且符合dotenv报告文档中指定的其他限制。该文档还包含如何正确使用此功能的示例。
如果您需要使用不符合此规范的dotenv文件,您始终可以将该文件作为普通工件文件传递给其他作业:

# ...
  artifacts:
    paths:
      - build.env

字符串
然后作业应该接收这个工件,您可以使用任何您想要的dotenv文件工具来使用它们。

相关问题