0

I currently have an AWS Code Build Pipeline setup that is executing on a set schedule using AWS Event Bridge.

However, this doesn't check to see if there are actually any pending changes in the connected Repo so it just builds regardless.

Is there an approach to:

  • Schedule a Pipeline to execute based on a specific cron schedule.
  • Then check and only execute the build if the repo has updates.
James Parker
  • 2,095
  • 3
  • 27
  • 48
  • Adding a [webhook events trigger](https://docs.aws.amazon.com/codebuild/latest/userguide/github-webhook.html) that runs your CodeBuild project on a push/PR doesn't fit your use case? – fedonev May 03 '22 at 06:33
  • No, this doesn't because I don't want the builds to execute on a push or PR. I want them to execute at a specific time, but only if there are changes. – James Parker May 03 '22 at 13:15
  • Right. Just checking, because that makes the job much harder. Two further questions: (1) the OP mentions a "pipeline". Are you using `CodePipeline` pipeline or just a standalone `CodeBuild` Project? (2) the OP requires a check for "pending changes" and build "if the repo has updates". What does that mean precisely? The build should run only if a commit exists with a timestamp greater than the last cron run? – fedonev May 03 '22 at 13:46
  • We are using CodePipeline. I'm coming from TeamCity so a change would literally mean that the local repo branch is behind the remote repo branch. – James Parker May 03 '22 at 13:52
  • Not sure what "local" means in a stateless cloud CI/CD context. In any case, [this answer](https://stackoverflow.com/a/48385799/1103511) to a similar question applies. Note that the answer refers to CloudWatch events, which is the old name for EventBridge events). – fedonev May 03 '22 at 15:12

0 Answers0