gpt4 book ai didi

amazon-web-services - YAML_FILE_ERROR 消息 : Expected Commands[0] to be of string type:

转载 作者:行者123 更新时间:2023-12-03 15:23:56 47 4
gpt4 key购买 nike

我正在尝试使用 CodeBuild 在 AWS 上构建我的项目。我已将此 buildspec 文件放在根目录中。 CodeBuild 能够读取文件,但无法继续进行。但是我在 CodeBuild 上遇到了以下错误。

CodeBuild 日志错误:

> [Container] 2020/05/19 08:56:07 Waiting for agent ping 
> [Container] 2020/05/19 08:56:09 Waiting for DOWNLOAD_SOURCE
> [Container] 2020/05/1908:56:14 Phase is DOWNLOAD_SOURCE [Container] 2020/05/19 08:56:14 YAML location is myRepoPath/buildspec.yml [Container] 2020/05/19 08:56:14 Phase complete: DOWNLOAD_SOURCE State: FAILED
> [Container] 2020/05/19 08:56:14 Phase context status code: YAML_FILE_ERROR Message: Expected Commands[0] to be of string type: found subkeys instead at line 30, value of the key tag on line 29 might be empty

我的 buildspec.yaml 文件:
    version: 0.2

phases:
install:
runtime-versions:
java: openjdk11

commands:
- apt-get update -y
- apt-get install -y maven
- pip3 install --upgrade awscli

pre_build:
commands:
- sonar_host_url=""
- sonar_project_key="$REPOSITORY_NAME"
- sonar_username=$(aws secretsmanager get-secret-value --secret-id $SONARQUBE_USER_CREDENTIAL_SECRET | jq -r '.SecretString' | jq -r '.username')
- sonar_password=$(aws secretsmanager get-secret-value --secret-id $SONARQUBE_USER_CREDENTIAL_SECRET | jq -r '.SecretString' | jq -r '.password')
- git checkout $SOURCE_COMMIT

build:
commands:
- builStatus=$(mvn install)
- result=$(mvn clean sonar:sonar -Dsonar.projectKey=$sonar_project_key -Dsonar.host.url=$sonar_host_url -Dsonar.login=$sonar_username -Dsonar.password=$sonar_password)
- echo $result

post_build:
commands:
- echo $buildStatus
- buildComment=$(echo "Status of project build phase : $buildStatus")
- aws codecommit post-comment-for-pull-request --pull-request-id $PULL_REQUEST_ID --repository-name $REPOSITORY_NAME --before-commit-id $DESTINATION_COMMIT --after-commit-id $SOURCE_COMMIT --content "$buildComment"
- sonar_link=$(echo $result | egrep -o "you can browse http://[^, ]+")
- sonar_task_id=$(echo $result | egrep -o "task\?id=[^ ]+" | cut -d'=' -f2)

最佳答案

根据评论,问题是在 phase : $build 中使用冒号.yaml遇到空格和:时有些问题如以下 GitHub 问题所示:

  • YAML syntax error when string contains a colon + space
  • 关于amazon-web-services - YAML_FILE_ERROR 消息 : Expected Commands[0] to be of string type:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61887429/

    47 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com