DevOps.Util.DotNet/Triage/TriageContextUtil.cs
/// <summary>
/// There are times when the AzDO API will not provide a Timeline for a Bulid. In those cases we still need to create 
/// a <see cref="ModelBuildAttempt"/> entry. The assumption is this is for the first attempt and all of the values will 
/// be
/// </summary>
/// <param name="modelBuild"></param>
/// <param name="build"></param>
/// <returns></returns>
There are times when the AzDO API will not provide a Timeline for a Bulid. In those cases we still need to create
a  entry. The assumption is this is for the first attempt and all of the values will
be
There are times when the AzDO API will not provide a Timeline for a Bulid . In those cases we still need to create a entry . The assumption is this is for the first attempt and all of the values will be
public async Task<ModelBuildAttempt> EnsureBuildAttemptWithoutTimelineAsync(ModelBuild modelBuild, Build build)
        {
            const int attempt = 1;
            var modelBuildAttempt = await Context.ModelBuildAttempts
                .Where(x => x.ModelBuildId == modelBuild.Id && x.Attempt == attempt)
                .FirstOrDefaultAsync().ConfigureAwait(false);
            if (modelBuildAttempt is object)
            {
                return modelBuildAttempt;
            }
            modelBuildAttempt = new ModelBuildAttempt()
            {
                Attempt = attempt,
                BuildResult = build.Result,
                StartTime = modelBuild.StartTime,
                FinishTime = modelBuild.FinishTime,
                ModelBuild = modelBuild,
                IsTimelineMissing = false,
            };
            Context.ModelBuildAttempts.Add(modelBuildAttempt);
            await Context.SaveChangesAsync().ConfigureAwait(false);
            return modelBuildAttempt;
        }
public async Task < ModelBuildAttempt > EnsureBuildAttemptWithoutTimelineAsync ( ModelBuild modelBuild , Build build ) { const int attempt = 1 ; var modelBuildAttempt = await Context . ModelBuildAttempts . Where ( x => x . ModelBuildId == modelBuild . Id && x . Attempt == attempt ) . FirstOrDefaultAsync ( ) . ConfigureAwait ( false ) ; if ( modelBuildAttempt is object ) { return modelBuildAttempt ; } modelBuildAttempt = new ModelBuildAttempt ( ) { Attempt = attempt , BuildResult = build . Result , StartTime = modelBuild . StartTime , FinishTime = modelBuild . FinishTime , ModelBuild = modelBuild , IsTimelineMissing = false , } ; Context . ModelBuildAttempts . Add ( modelBuildAttempt ) ; await Context . SaveChangesAsync ( ) . ConfigureAwait ( false ) ; return modelBuildAttempt ; }
There are times when the AzDO API will not provide a Timeline for a Bulid.
There are times when the AzDO API will not provide a Timeline for a Bulid .
None
modelBuild
ModelBuild
None
build
Build
None