<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>15578</bug_id>
          
          <creation_ts>2024-08-19 03:13:08 +0000</creation_ts>
          <short_desc>[RRS] Add a script to create new Release and Milestones (from e.g. a YAML file)</short_desc>
          <delta_ts>2026-02-20 17:44:07 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>6</classification_id>
          <classification>Yocto Project Subprojects</classification>
          <product>Recipe Reporting System (RRS)</product>
          <component>Recipe Reporting System (RRS)</component>
          <version>5.1</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>6.1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Tim Orling">tim.orling</reporter>
          <assigned_to name="Tim Orling">tim.orling</assigned_to>
          
          
          <qa_contact name="apoorv sangal">apoorvsangal</qa_contact>
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Yes (doc changes required)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>99548</commentid>
    <comment_count>0</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2024-08-19 03:13:08 +0000</bug_when>
    <thetext>Currently, a new Release and Milestones must be manually entered through the Admin interface. This is a bit tedious and error prone.

Add a script to rrs/tools to create a new release (from e.g. a YAML file).

Such a YAML file might look like:

styhead.yml
release:
  plan: &quot;OE-Core&quot;
  name: 5.1
  start_date: 2024-04-30
  end_date: 2024-10-25
  milestones:
    - name: M1
      start_date: 2024-04-30
      end_date: 2024-05-31
    - name: M2
      start_date: 2024-06-03
      end_date: 2024-07-19
    - name: M3
      start_date: 2024-07-22
      end_date: 2024-09-06
    - name: M4
      start_date: 2024-09-09
      end_date: 2024-10-25


Unfortunately, it is non-trivial to add a django.forms.DateField (to create a Release or Milestone object via start_date and end_date fields). Somehow the check for length in truncate_charfield_values from layerindex/models.py is being called (even though it is a DateField? maybe this has to do with the Admin form showing a CharField next to the Caldendar widget?)


layers@shelllayers:/opt/layerindex$ ./rrs/tools/rrs_create_release_and_milestones.py --debug -f ./scripts/styhead.yml --dry-run
DEBUG: {&apos;release&apos;: {&apos;plan&apos;: &apos;OE-Core&apos;, &apos;name&apos;: 5.1, &apos;start_date&apos;: datetime.date(2024, 4, 30), &apos;end_date&apos;: datetime.date(2024, 10, 25), &apos;milestones&apos;: [{&apos;name&apos;: &apos;M1&apos;, &apos;start_date&apos;: datetime.date(2024, 4, 30), &apos;end_date&apos;: datetime.date(2024, 5, 31)}, {&apos;name&apos;: &apos;M2&apos;, &apos;start_date&apos;: datetime.date(2024, 6, 3), &apos;end_date&apos;: datetime.date(2024, 7, 19)}, {&apos;name&apos;: &apos;M3&apos;, &apos;start_date&apos;: datetime.date(2024, 7, 22), &apos;end_date&apos;: datetime.date(2024, 9, 6)}, {&apos;name&apos;: &apos;M4&apos;, &apos;start_date&apos;: datetime.date(2024, 9, 9), &apos;end_date&apos;: datetime.date(2024, 10, 25)}]}}
DEBUG: start_date: 2024-04-30 type(start_date): &lt;class &apos;datetime.date&apos;&gt;
DEBUG: end_date: 2024-10-25 type(end_date): &lt;class &apos;datetime.date&apos;&gt;
DEBUG: start_date: 2024-04-30 type(start_date): &lt;class &apos;datetime.date&apos;&gt;
DEBUG: end_date: 2024-10-25 type(end_date): &lt;class &apos;datetime.date&apos;&gt;
Traceback (most recent call last):
  File &quot;/opt/layerindex/./rrs/tools/rrs_create_release_and_milestones.py&quot;, line 177, in &lt;module&gt;
    main()
  File &quot;/opt/layerindex/./rrs/tools/rrs_create_release_and_milestones.py&quot;, line 171, in main
    create_from_yaml_file( from_file=args.from_file, dryrun=args.dryrun )
  File &quot;/opt/layerindex/./rrs/tools/rrs_create_release_and_milestones.py&quot;, line 158, in create_from_yaml_file
    create_release_and_milestones(plan, release, start_date, end_date, milestones, dryrun)
  File &quot;/opt/layerindex/./rrs/tools/rrs_create_release_and_milestones.py&quot;, line 115, in create_release_and_milestones
    release_obj.save()
  File &quot;/usr/local/lib/python3.10/dist-packages/django/db/models/base.py&quot;, line 814, in save
    self.save_base(
  File &quot;/usr/local/lib/python3.10/dist-packages/django/db/models/base.py&quot;, line 861, in save_base
    pre_save.send(
  File &quot;/usr/local/lib/python3.10/dist-packages/django/dispatch/dispatcher.py&quot;, line 176, in send
    return [
  File &quot;/usr/local/lib/python3.10/dist-packages/django/dispatch/dispatcher.py&quot;, line 177, in &lt;listcomp&gt;
    (receiver, receiver(signal=self, sender=sender, **named))
  File &quot;/opt/layerindex/layerindex/models.py&quot;, line 37, in truncate_charfield_values
    if value and len(value) &gt; field.max_length:
TypeError: object of type &apos;datetime.date&apos; has no len()</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99549</commentid>
    <comment_count>1</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2024-08-19 03:14:14 +0000</bug_when>
    <thetext>Work in progress, but need to get past the len() issue and then more validation of CLI entry of milestones (as a dict()).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104372</commentid>
    <comment_count>2</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2026-02-20 17:44:07 +0000</bug_when>
    <thetext>Merged:
https://git.yoctoproject.org/layerindex-web/commit/?id=5d4f119e0ea06452cf5a88af86f85841135b01f7</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>