web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

How to prevent bad code check-in to source code?

(0) ShareShare
ReportReport
Posted on by 596

Hi guys,

Sorry for a bit out of track, but this is regarding F&O development, can we prevent some bad codes from check-in before it is deployed ?

The deployment is for Testing environment only or the topmost is for UAT environment, but there many times we hit error which because there are some bad code checked-in.

Is there any policy / feature, etc to prevent developers to check-in bad code ? 

Thanks,

I have the same question (0)
  • Suggested answer
    GirishS Profile Picture
    27,827 Moderator on at

    Hi Lars Volt,

    I think you can create devops check in policies to restrict developer to do certain steps before check in.

    Refer to the below microsoft documentation.

    learn.microsoft.com/.../add-check-policies

    Thanks,

    Girish S.

  • Suggested answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at

    Hi Lars, You can explore Gated check-ins. It won't prevent bad code from check-in but it will prevent situations like if dependent object is not checked-in.

    www.atomicax.com/.../why-gated-check-ins-are-awesome

  • Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    It really depends on what you mean "bad" code, but I also think that may be interested in gated builds. It'll guarantee that checked-in code is compilable, and you can optionally add some custom validations.

  • Voltes Profile Picture
    596 on at

    Hi Martin,

    In my case, bad code can also as some developers check-in some code that still have errors. Or perhaps he/she forgot to check all the necessary objects. Sometime we got this situation whereby in their VM there is no error, only to find out there is some new/changed object they forgot to included in. Noted about the gated build, however currently we are on manual deployment.

    Thanks,

  • Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    Gated check-in is exactly what you need.

    It's not about a deployment. When you try to check in code, the system will compile the application with your changes and commits them only if the build succceeded.

  • Voltes Profile Picture
    596 on at

    Hi Martin,

    Noted. So if I understand correctly from the blog shared by Mohit above, this gated check-in, when we activate it, all developer's box, before he/she can check-in their development, all new changes in Source Code will be downloaded to their VM (just like auto-get latest)

    Is there anything "Gated-check in" will do ? as in the blog only saying this "Just check that, commit something and watch what happens!"

    May I get more detail on this ? because before I'm asking my administrator to activate it, I need to explain something and give more realistic reason.

    Thanks

  • Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    No, your understanding isn't correct. It won't download anything to developer VM. It'll create a shelveset with changes that you want to check in, runs a build of the current codebase (from source control) together with your changes (using either a Microsoft-hosted build server or your own build server) and if the builds succeeds, you changes are actually checked into source control.

  • Voltes Profile Picture
    596 on at

    Noted with thanks.

    Btw, one last thing, this option will apply even if we're not using DevOps Build Pipeline, right ?

    Thanks again.

  • Verified answer
    Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    Well, it seems that you still didn't get it works. Let me try it once more.

    Your goal is making sure that checked-in code must be compilable. The solution is running a build to verify that and to0 check code in only if it compiled.

    You also found that compiling code on developer's VM doesn't guarantee anything. (You said: "Sometime we got this situation whereby in their VM there is no error, only to find out there is some new/changed object they forgot to included in."). Therefore you need a build server downloading all code from source control, including the proposed changes and running the build. That's what build pipelines are for.

    You can't run build automatically automatically without having a build pipelines to build your code.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 522 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans