#9835 FTI script: Print everything to stdout, so it's easy to do 2> ticket
Merged 3 months ago by kevin. Opened 3 months ago by churchyard.
churchyard/releng fti-script-miro  into  master

@@ -55,7 +55,6 @@ 

      if diff < datetime.timedelta(weeks=1):

          print(

              f"→ Week did not pass since bug started to block tracker ({start_time}), skipping…",

-             file=sys.stderr,

          )

          return

  
@@ -88,7 +87,6 @@ 

          except StopIteration:

              print(

                  f"→ Week did not pass since first needinfo ({_bzdate_to_python(needinfos[0]['when'])}), skipping…",

-                 file=sys.stderr,

              )

              return

          try:
@@ -100,11 +98,10 @@ 

              )

              if NOW - needinfo_after_four_weeks >= datetime.timedelta(weeks=4):

                  print("Opening releng ticket")

-                 # TODO: Implement

+                 print(f' * `{bug.component}` ([bug](https://bugzilla.redhat.com/show_bug.cgi?id={bug.id}))', file=sys.stderr)

              else:

                  print(

                      f"→ 4 weeks did not pass since second needinfo ({needinfo_after_four_weeks}), skipping…",

-                     file=sys.stderr,

                  )

                  return

          except StopIteration:
@@ -121,7 +118,6 @@ 

              else:

                  print(

                      f"→ 3 weeks did not pass since first needinfo ({needinfo_after_week}), skipping…",

-                     file=sys.stderr,

                  )

                  return

  
@@ -223,7 +219,7 @@ 

  @click.option(

      "--release",

      type=click.Choice(sorted(set(t[1:3] for t in TRACKERS.keys()))),

-     default="33",

+     default="34",

      show_default=True,

      help="Fedora release",

  )
@@ -306,7 +302,6 @@ 

          if src in current_ftis:

              print(

                  f"Skipping {src} because bug already exists: {current_ftis[src].id}",

-                 file=sys.stderr,

              )

              continue

  
@@ -337,7 +332,6 @@ 

              continue

          print(

              f"Checking {b.id} if it was submitted as an update to appropriate release",

-             file=sys.stderr,

          )

          comments = b.getcomments()

          try:
@@ -374,7 +368,7 @@ 

              src: b for src, b in current_ftis.items() if src not in fixed_ftis

          }

      else:

-         print("No FTI bugs to close, everything is still broken", file=sys.stderr)

+         print("No FTI bugs to close, everything is still broken")

  

      # Update bugs for orphaned packages

      orphaned = {
@@ -383,7 +377,7 @@ 

          if pkg_owners["rpms"][src]["fedora"] == "orphan"

      }

      for src, b in orphaned.items():

-         click.echo(f"Checking if need to send notice to the orphaned package: {src} ({b.id})", err=True)

+         click.echo(f"Checking if need to send notice to the orphaned package: {src} ({b.id})")

          comments = b.getcomments()

          update = False

          try:

file modified
+1 -1
@@ -1,3 +1,3 @@ 

  Hello,

  

- Please note that this comment was generated automatically. If you feel that this output has mistakes, please contact me via email (ignatenkobrain@fedoraproject.org).

+ Please note that this comment was generated automatically. If you feel that this output has mistakes, please contact me via email (mhroncok@redhat.com).

Also, bump the default release to 34 and use my email address.

Signed-off-by: Miro Hrončok miro@hroncok.cz

So, my policy toward cron jobs:

When everything is working as expected/normally, there's no output.
When anything at all goes wrong, output galore so you can fix it.

Looks like you are just changing stderr to stdout here tho?

And instead of your email, should we use some kind of role based email so we don't need to keep changing it? but not sure what that would best be...

This is now run manually by me. I've changed all the messages to stdout (it was a mixture of both), so I can (ab)use stderr for a markdown output to copy-paste to the releng ticket.

If we want to cron-ize it, I guess we can do that as well and replace the stdout with stderr. The corn job could email the generated markdown content to a list, right?

We could ask to open a releng ticket instead, once the script runs in a cron job.

Yeah, for those we use the 'releng-cron' list.

But sure, this is fine as is... just thinking ahead.

Pull-Request has been merged by kevin

3 months ago