Saturday, 22 April 2017

Using AWS CodeBuild run jasmine tests before deployment

Folks, Have been trying to figure out the correct way to fire of a CodeBuild project which either produces the artifact after compiling and running jasmine tests, or fails and stops the CodePipeline from proceeding with deployment.

If my buildspec.yml looks like:

version: 0.1

phases:
  install:
    commands:
      - echo Installing... Running npm install
      - npm install
  pre_build:
    commands:
      - echo pre_build...
  build:
    commands:
      - echo Testing... Running npm test
      - npm test
  post_build:
    commands:
      - echo Build completed on `date`
artifacts:
  files:
    - '**/*'

How should I fail out of the npm test phase? If any of the jasmine tests fail during npm test, will the artifact still be produced?

Thanks!



via Cmag

No comments:

Post a Comment