Does it make sense to have push trigger and nightly build together?

Viewed 166

I'm a pretty new DevOps engineer, and i mostly deal with CI processes.

I'm wondering if it makes sense to define both nightly build And build on each push.

Seemingly, it doesn't make sense, since if the code is built after each push, why do you need to build at midnight, it was already built when you pushed it to the repository.

Am i right?

3 Answers

IMHO you are right - it does not make sense to have a fixed time schedule if at the same time you have a push trigger.

A reason why you still want to have a nightly build (or other fixed schedules) could be if you cannot run a full test with every build. For example you could decide that you only do minimum tests (or smoketests) with every push triggered build, but once per day (e.g. night) you do a full test run.

As far as I know, the advantage of midnight build is that tasks with long running/deployment time can be run at midnight.

After these tasks run at midnight, you can directly view the results the next day.

In this case, you can set the condition for a specific task to control whether it runs at midnight. You could use $(Build.Reason) to judge it.

On the other hand , we recommend that you can set a specific time schedule trigger.

CI triggers cause a pipeline to run whenever you push an update to the specified branches or you push specified tags. The build is only triggered when the code changes.

Changes in the pipeline itself and the operating environment will not trigger the build.

But they can sometimes determine whether the project can run successfully.

In this case, the schedule trigger can run the build at a specific time to ensure that the project is executable.

I will share what we do and maybe help you:

We have three build tiers, one to cover a case like the Push example you pointed, other with a set of PowerShell tests, and a Scheduled one with full set of tests that takes around 5 hours.

As you can picture each case have their one scenario based on time a number of tests.

Related