DEV Community

Seifolah Ghaderi
Seifolah Ghaderi

Posted on

3 1

aws codebuild continues on failure

Suppose you have some buildspec.yml file like this that build your project and upload it on some where :

build:
     commands:
       - ng build --configuration=$BUILD_ENV  
post_build:
     commands:
       - aws s3 rm s3://$ENV_BUCKET  --recursive
       - aws s3 cp dist s3://$ENV_BUCKET  --recursive
Enter fullscreen mode Exit fullscreen mode

the Problem here is that if build step fails codebuild continue and post_build will be executed and aws s3 rm will clean your bucket !

I had this issue in my aws codepipeline project (fortunately none-production env) and tried to fixing it.

So here is workaround:
on-failure: ABORT
just put in build step . i tried it and it works like a charm !

build:
     on-failure: ABORT
     commands:
       - ng build --configuration=$BUILD_ENV  
post_build:
     commands:
       - aws s3 rm s3://$ENV_BUCKET  --recursive
       - aws s3 cp dist s3://$ENV_BUCKET  --recursive
Enter fullscreen mode Exit fullscreen mode

Second solution is to add another Deploy Stage in aws code pipeline and do deploy action (cp to s3 bucket ) at there .

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs