Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

976
Views
Mensaje YAML_FILE_ERROR: Comandos esperados[0] para ser de tipo cadena:

Estoy tratando de construir mi proyecto en AWS usando CodeBuild. He colocado este archivo buildspec en el directorio raíz. CodeBuild puede leer el archivo pero no puede continuar. Pero recibí el siguiente error en CodeBuild.

Error de registro de 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

Mi archivo 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)
over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Según el comentario, el problema era el uso de dos puntos en la phase : $build .

yaml tiene algunos problemas cuando encuentra un espacio y : como se indica en el siguiente problema de GitHub:

  • Error de sintaxis YAML cuando la cadena contiene dos puntos + espacio
over 4 years ago · Santiago Trujillo Report

0

Tuve este error cuando puse una declaración de echo en mis comandos yml que intentaba imprimir una serie - caracteres solo para darle un estilo a mi salida `- echo '--- llegó aquí ---'

Tuve que sacar eso y poner guiones bajos _

over 4 years ago · Santiago Trujillo Report

0

El error se debió a : en la línea 30 dentro de echo. Como @Marcin mencionó, a YAML no le gustan los dos puntos con espacios en el texto.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!