diff mbox series

[yocto-autobuilder2,2/3] yocto_console_view: Keep known revision mappings

Message ID 20250211-mathieu-console_view_colspan-v1-2-d94a8c55acf9@bootlin.com
State New
Headers show
Series yocto_console_view: Fix various small issues after migration | expand

Commit Message

Mathieu Dubois-Briand Feb. 11, 2025, 2:48 p.m. UTC
The yp_build_revision property disappears from the build instance once
the build is done. There is no reason for its value to change, so keep
the last seen value in revision mapping. This will prevent finished
builds to jump back to "Unresolved Revision".

Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
---
 .../src/views/ConsoleView/ConsoleView.tsx          | 25 +++-------------------
 1 file changed, 3 insertions(+), 22 deletions(-)

Comments

Richard Purdie Feb. 12, 2025, 12:01 a.m. UTC | #1
On Tue, 2025-02-11 at 15:48 +0100, Mathieu Dubois-Briand via lists.yoctoproject.org wrote:
> The yp_build_revision property disappears from the build instance once
> the build is done. There is no reason for its value to change, so keep
> the last seen value in revision mapping. This will prevent finished
> builds to jump back to "Unresolved Revision".
> 
> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
> ---
>  .../src/views/ConsoleView/ConsoleView.tsx          | 25 +++-------------------
>  1 file changed, 3 insertions(+), 22 deletions(-)
> 
> diff --git a/yocto_console_view/src/views/ConsoleView/ConsoleView.tsx b/yocto_console_view/src/views/ConsoleView/ConsoleView.tsx
> index 973c26424233..93c51b340b17 100644
> --- a/yocto_console_view/src/views/ConsoleView/ConsoleView.tsx
> +++ b/yocto_console_view/src/views/ConsoleView/ConsoleView.tsx
> @@ -208,6 +208,9 @@ function selectChangeForBuild(build: Build, buildset: Buildset,
>    return fakeChange
>  }
>  
> +const revMapping = new Map<int, string>();
> +const branchMapping = new Map<int, string>();
> +
>  export const ConsoleView = observer(() => {
>    const accessor = useDataAccessor([]);
>  
> @@ -263,8 +266,6 @@ export const ConsoleView = observer(() => {
>      builderIdsWithBuilds.add(build.builderid);
>    }
>  
> -  const revMapping = new Map<int, string>();
> -  const branchMapping = new Map<int, string>();
>    for (const build of buildsQuery.array) {
>      let change = false;
>      let {
> @@ -278,26 +279,6 @@ export const ConsoleView = observer(() => {
>        branchMapping[build.buildid] = build.properties.yp_build_branch[0];
>        change = true;
>      }
> -    if ((!revMapping[buildid] || !branchMapping[buildid]) && !build.complete_at) {
> -      build.getProperties().onChange = properties => {
> -        change = false;
> -        buildid = properties.endpoint.split('/')[1];
> -        if (!revMapping[buildid]) {
> -          const rev = getBuildProperty(properties[0], 'yp_build_revision');
> -          if (rev != null) {
> -            revMapping[buildid] = rev;
> -            change = true;
> -          }
> -        }
> -        if (!branchMapping[buildid]) {
> -          const branch = getBuildProperty(properties[0], 'yp_build_branch');
> -          if (branch != null) {
> -            branchMapping[buildid] = branch;
> -            change = true;
> -          }
> -        }
> -      };
> -    }
>    }
>  
>    function getBuildProperty(properties, property) {

When you start a build, it gets "Unresolved Revision" and I think by
removing this code, it remains there even when the revision becomes
known. The code would have allowed it to move to the correct line in
the display. This therefore may fix one issue at the expense of
another...

Cheers,

Richard
Mathieu Dubois-Briand Feb. 12, 2025, 8:14 a.m. UTC | #2
On Wed Feb 12, 2025 at 1:01 AM CET, Richard Purdie wrote:
> On Tue, 2025-02-11 at 15:48 +0100, Mathieu Dubois-Briand via lists.yoctoproject.org wrote:
> > The yp_build_revision property disappears from the build instance once
> > the build is done. There is no reason for its value to change, so keep
> > the last seen value in revision mapping. This will prevent finished
> > builds to jump back to "Unresolved Revision".
> > 
> > Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
> > ---
> >  .../src/views/ConsoleView/ConsoleView.tsx          | 25 +++-------------------
> >  1 file changed, 3 insertions(+), 22 deletions(-)
> > 
> > diff --git a/yocto_console_view/src/views/ConsoleView/ConsoleView.tsx b/yocto_console_view/src/views/ConsoleView/ConsoleView.tsx
> > index 973c26424233..93c51b340b17 100644
> > --- a/yocto_console_view/src/views/ConsoleView/ConsoleView.tsx
> > +++ b/yocto_console_view/src/views/ConsoleView/ConsoleView.tsx
> > @@ -208,6 +208,9 @@ function selectChangeForBuild(build: Build, buildset: Buildset,
> >    return fakeChange
> >  }
> >  
> > +const revMapping = new Map<int, string>();
> > +const branchMapping = new Map<int, string>();
> > +
> >  export const ConsoleView = observer(() => {
> >    const accessor = useDataAccessor([]);
> >  
> > @@ -263,8 +266,6 @@ export const ConsoleView = observer(() => {
> >      builderIdsWithBuilds.add(build.builderid);
> >    }
> >  
> > -  const revMapping = new Map<int, string>();
> > -  const branchMapping = new Map<int, string>();
> >    for (const build of buildsQuery.array) {
> >      let change = false;
> >      let {
> > @@ -278,26 +279,6 @@ export const ConsoleView = observer(() => {
> >        branchMapping[build.buildid] = build.properties.yp_build_branch[0];
> >        change = true;
> >      }
> > -    if ((!revMapping[buildid] || !branchMapping[buildid]) && !build.complete_at) {
> > -      build.getProperties().onChange = properties => {
> > -        change = false;
> > -        buildid = properties.endpoint.split('/')[1];
> > -        if (!revMapping[buildid]) {
> > -          const rev = getBuildProperty(properties[0], 'yp_build_revision');
> > -          if (rev != null) {
> > -            revMapping[buildid] = rev;
> > -            change = true;
> > -          }
> > -        }
> > -        if (!branchMapping[buildid]) {
> > -          const branch = getBuildProperty(properties[0], 'yp_build_branch');
> > -          if (branch != null) {
> > -            branchMapping[buildid] = branch;
> > -            change = true;
> > -          }
> > -        }
> > -      };
> > -    }
> >    }
> >  
> >    function getBuildProperty(properties, property) {
>
> When you start a build, it gets "Unresolved Revision" and I think by
> removing this code, it remains there even when the revision becomes
> known. The code would have allowed it to move to the correct line in
> the display. This therefore may fix one issue at the expense of
> another...
>

The issue is this part of the code actually did nothing. I believe I
imported this from the previous version of the plugin but never really
tested it.

I've been trying a few variations, yesterday but it looks like we never
get the property update.
Richard Purdie Feb. 12, 2025, 10:08 a.m. UTC | #3
On Wed, 2025-02-12 at 09:14 +0100, Mathieu Dubois-Briand wrote:
> On Wed Feb 12, 2025 at 1:01 AM CET, Richard Purdie wrote:
> > On Tue, 2025-02-11 at 15:48 +0100, Mathieu Dubois-Briand via
> > lists.yoctoproject.org wrote:
> > > The yp_build_revision property disappears from the build instance
> > > once
> > > the build is done. There is no reason for its value to change, so
> > > keep
> > > the last seen value in revision mapping. This will prevent
> > > finished
> > > builds to jump back to "Unresolved Revision".
> > > 
> > > Signed-off-by: Mathieu Dubois-Briand
> > > <mathieu.dubois-briand@bootlin.com>
> > > ---
> > >  .../src/views/ConsoleView/ConsoleView.tsx          | 25 +++-----
> > > --------------
> > >  1 file changed, 3 insertions(+), 22 deletions(-)
> > > 
> > > diff --git
> > > a/yocto_console_view/src/views/ConsoleView/ConsoleView.tsx
> > > b/yocto_console_view/src/views/ConsoleView/ConsoleView.tsx
> > > index 973c26424233..93c51b340b17 100644
> > > --- a/yocto_console_view/src/views/ConsoleView/ConsoleView.tsx
> > > +++ b/yocto_console_view/src/views/ConsoleView/ConsoleView.tsx
> > > @@ -208,6 +208,9 @@ function selectChangeForBuild(build: Build,
> > > buildset: Buildset,
> > >    return fakeChange
> > >  }
> > >  
> > > +const revMapping = new Map<int, string>();
> > > +const branchMapping = new Map<int, string>();
> > > +
> > >  export const ConsoleView = observer(() => {
> > >    const accessor = useDataAccessor([]);
> > >  
> > > @@ -263,8 +266,6 @@ export const ConsoleView = observer(() => {
> > >      builderIdsWithBuilds.add(build.builderid);
> > >    }
> > >  
> > > -  const revMapping = new Map<int, string>();
> > > -  const branchMapping = new Map<int, string>();
> > >    for (const build of buildsQuery.array) {
> > >      let change = false;
> > >      let {
> > > @@ -278,26 +279,6 @@ export const ConsoleView = observer(() => {
> > >        branchMapping[build.buildid] =
> > > build.properties.yp_build_branch[0];
> > >        change = true;
> > >      }
> > > -    if ((!revMapping[buildid] || !branchMapping[buildid]) &&
> > > !build.complete_at) {
> > > -      build.getProperties().onChange = properties => {
> > > -        change = false;
> > > -        buildid = properties.endpoint.split('/')[1];
> > > -        if (!revMapping[buildid]) {
> > > -          const rev = getBuildProperty(properties[0],
> > > 'yp_build_revision');
> > > -          if (rev != null) {
> > > -            revMapping[buildid] = rev;
> > > -            change = true;
> > > -          }
> > > -        }
> > > -        if (!branchMapping[buildid]) {
> > > -          const branch = getBuildProperty(properties[0],
> > > 'yp_build_branch');
> > > -          if (branch != null) {
> > > -            branchMapping[buildid] = branch;
> > > -            change = true;
> > > -          }
> > > -        }
> > > -      };
> > > -    }
> > >    }
> > >  
> > >    function getBuildProperty(properties, property) {
> > 
> > When you start a build, it gets "Unresolved Revision" and I think
> > by
> > removing this code, it remains there even when the revision becomes
> > known. The code would have allowed it to move to the correct line
> > in
> > the display. This therefore may fix one issue at the expense of
> > another...
> > 
> 
> The issue is this part of the code actually did nothing. I believe I
> imported this from the previous version of the plugin but never
> really tested it.
> 
> I've been trying a few variations, yesterday but it looks like we
> never get the property update.

I know it was one of the more problematic elements in the code in the
past and can result in a lot more queries. The idea was that when the
property became available, we'd update the UI. I'd probably have to
replicate a test environment to be able to offer much help at this
point...

Cheers,

Richard
diff mbox series

Patch

diff --git a/yocto_console_view/src/views/ConsoleView/ConsoleView.tsx b/yocto_console_view/src/views/ConsoleView/ConsoleView.tsx
index 973c26424233..93c51b340b17 100644
--- a/yocto_console_view/src/views/ConsoleView/ConsoleView.tsx
+++ b/yocto_console_view/src/views/ConsoleView/ConsoleView.tsx
@@ -208,6 +208,9 @@  function selectChangeForBuild(build: Build, buildset: Buildset,
   return fakeChange
 }
 
+const revMapping = new Map<int, string>();
+const branchMapping = new Map<int, string>();
+
 export const ConsoleView = observer(() => {
   const accessor = useDataAccessor([]);
 
@@ -263,8 +266,6 @@  export const ConsoleView = observer(() => {
     builderIdsWithBuilds.add(build.builderid);
   }
 
-  const revMapping = new Map<int, string>();
-  const branchMapping = new Map<int, string>();
   for (const build of buildsQuery.array) {
     let change = false;
     let {
@@ -278,26 +279,6 @@  export const ConsoleView = observer(() => {
       branchMapping[build.buildid] = build.properties.yp_build_branch[0];
       change = true;
     }
-    if ((!revMapping[buildid] || !branchMapping[buildid]) && !build.complete_at) {
-      build.getProperties().onChange = properties => {
-        change = false;
-        buildid = properties.endpoint.split('/')[1];
-        if (!revMapping[buildid]) {
-          const rev = getBuildProperty(properties[0], 'yp_build_revision');
-          if (rev != null) {
-            revMapping[buildid] = rev;
-            change = true;
-          }
-        }
-        if (!branchMapping[buildid]) {
-          const branch = getBuildProperty(properties[0], 'yp_build_branch');
-          if (branch != null) {
-            branchMapping[buildid] = branch;
-            change = true;
-          }
-        }
-      };
-    }
   }
 
   function getBuildProperty(properties, property) {