PacktPublishing / AWS-Certified-DevOps-Engineer-Professional-Certification-and-Beyond

AWS Certified DevOps Engineer-Professional: Certification and Beyond, Published by Packt
MIT License
50 stars 66 forks source link

Code from Chapter 9 is not working #3

Open davyzhang3 opened 2 years ago

davyzhang3 commented 2 years ago

The address of buildspec.yml file in pipeline1.yml is wrong. It should be buildspec.yml rather than buildspecs/buildspec.yml When I run buildspec.yml in CodeBuild:

  pre_build:
    commands:
      - apt-get update -y
      - apt-get install -y python3-venv
      - python3 -m venv test_venv
      - . test_venv/bin/activate
      - pip install --upgrade pip
      - pip install .
      - pip install -r tests/requirements.txt
      - rm -rf dspt
      - mkdir test-reports
  build:
    commands:
      - pytest 
        --html=test-reports/report.html 
        --self-contained-html
        -s
        -v
        --cov=dspt 
        --cov-report=html:test-reports/coverage 
        --junitxml=test-reports/junit.xml 
        --log-file=test-reports/logs.txt 
        tests

This part went wrong. I feel there might be a script missing in your chapter 9 folder.

worthlesspenny7 commented 2 years ago

I found the same incorrect buildspecs/buildspec.yml path too. Thanks for posting this @davyzhang3.

I also had to update the RepositoryURL default to match the instructions in the book (the book has chapter9 in the URL).

  RepositoryURL:
    Type: String
    Description: The Clone URL for the Code Commit Repository
    Default: "https://git-codecommit.us-east-2.amazonaws.com/v1/repos/chapt9"

@pquery a note in the text to ensure the user "peter" is in the right region after logging in would have saved me quite a bit of time troubleshooting why peter/peter's pipeline cannot find the chapt9 repo.

worthlesspenny7 commented 2 years ago

This exercise isn't setup for success. After commenting out the virtualenv sections, it choked on the fact that there's no tests/requirements.txt file. Moving on to higher-value efforts.

For traceabilty, I'm using the version of the book from O'Reilly:

AWS Certified DevOps Engineer - Professional Certification and Beyond Copyright © 2021 Packt Publishing First published: February 2022 Production reference: 1031121