1

I have a CI/CD working well at Amazon.

Lets say I have a simple html with a url homolog.test.com.

Is there a way when I merge the repository to master, the post build of CodeBuild & CodeDeploy run thru all files to find homolog. to replace with www.

The point is that I dont wanna change by hand all files to test in homolog and then replace again by hand to merge to master...I would like to have homolog working fine and when I merge to master it would replace at the deploy time the urls...

I know that the correct would be have the correct urls in the corret repository, but to facilitate the tests would be nice to work in this other way not too trivial...

A "sed" shell command would work? like this example? Unix Shell Loop through files and replace texts

would be something like this on the post build section? how I specify the correct folder at S3?

sed "s/homolog./www./g" *.html -i

My BuildSpec is very simple:

version: 0.2

phases:

  pre_build:
    commands:
      - echo Installing source NPM dependencies...
      - npm install

  build:
    commands:
      - cp dev-ops/config.production.js src/config.js
      - export PUBLIC_URL=/app/
      - npm run build

  post_build:
    commands:
      - aws s3 sync site-beta s3://www.test.com/ --cache-control max-age=3600
      - aws s3 sync build s3://www.test.com/app/ --cache-control max-age=3600

artifacts:
  files:
    - build/**/*
2Fast4YouBR
  • 1,012
  • 1
  • 12
  • 22

0 Answers0