Uploaded image for project: 'Docs for Red Hat Developers'
  1. Docs for Red Hat Developers
  2. RHDEVDOCS-4539

New release notes single-sourcing (after failed generate-release-notes.py)

XMLWordPrintable

      Discovering the issue

      `./tools/devspaces/generate-release-notes.py` ceased to work with following error:

      ./tools/devspaces/generate-release-notes.py 
      project = CRW AND level is EMPTY AND "Release Notes Docs Status" = "Documented as Feature Request" AND resolution != Unresolved AND fixVersion ~ "3.2.*.GA" order by key
      Traceback (most recent call last):
        File "/home/ffloreth/src/gl-cee/ffloreth/red-hat-devtools/./tools/devspaces/generate-release-notes.py", line 110, in <module>
          issues = jira.search_issues(query)
        File "/usr/lib/python3.10/site-packages/jira/client.py", line 2848, in search_issues
          issues = self._fetch_pages(
        File "/usr/lib/python3.10/site-packages/jira/client.py", line 698, in _fetch_pages
          resource = self._get_json(request_path, params=page_params, base=base)
        File "/usr/lib/python3.10/site-packages/jira/client.py", line 3543, in _get_json
          r = self._session.get(url, params=params)
        File "/usr/lib/python3.10/site-packages/jira/resilientsession.py", line 195, in get
          return self.__verb("GET", str(url), **kwargs)
        File "/usr/lib/python3.10/site-packages/jira/resilientsession.py", line 189, in __verb
          raise_on_error(response, verb=verb, **kwargs)
        File "/usr/lib/python3.10/site-packages/jira/resilientsession.py", line 64, in raise_on_error
          raise JIRAError(
      jira.exceptions.JIRAError: JiraError HTTP 400 url: https://issues.redhat.com/rest/api/2/search?jql=project+%3D+CRW+AND+level+is+EMPTY+AND+%22Release+Notes+Docs+Status%22+%3D+%22Documented+as+Feature+Request%22+AND+resolution+%21%3D+Unresolved+AND+fixVersion+~+%223.2.%2A.GA%22+order+by+key&startAt=0&validateQuery=True&maxResults=50
              text: Field 'Release Notes Docs Status' does not exist or this field cannot be viewed by anonymous users.
              
              response headers = {'x-arequestid': '785x10849380x5', 'x-anodeid': 'rh1-jira-prod-0', 'referrer-policy': 'strict-origin-when-cross-origin', 'x-xss-protection': '1; mode=block', 'x-content-type-options': 'nosniff', 'x-frame-options': 'SAMEORIGIN', 'Content-Security-Policy': 'sandbox', 'strict-transport-security': 'max-age=31536000', 'x-ausername': 'anonymous', 'Content-Encoding': 'gzip', 'Vary': 'User-Agent, Accept-Encoding', 'Content-Type': 'application/json;charset=UTF-8', 'Content-Length': '137', 'Expires': 'Fri, 07 Oct 2022 13:05:46 GMT', 'Cache-Control': 'max-age=0, no-cache, no-store', 'Pragma': 'no-cache', 'Date': 'Fri, 07 Oct 2022 13:05:46 GMT', 'Connection': 'keep-alive', 'x-rh-edge-request-id': 'c56e512', 'x-rh-edge-reference-id': '0.2519dd58.1665147946.c56e512', 'x-rh-edge-cache-status': 'Miss from child, Miss from parent'}
              response text = {"errorMessages":["Field 'Release Notes Docs Status' does not exist or this field cannot be viewed by anonymous users."],"errors":{}}
      

      First round of investigation: auth issue?

      As we are using Kerberos authentication, it probably means our Jira instance stopped Kerberos support on the API.

      jira = JIRA(
          server="https://issues.redhat.com",
          kerberos=True
      )
      

      Therefore, we need to implement another authentication mechanism.

      See: https://jira.readthedocs.io/examples.html#authentication

      This may feel annoying now, but implementing an OAuth or token based authentication is an enabler to run the script in GitLab.

      OAuth

      Starts with "Log in to JIRA as a user with 'JIRA Administrator' permissions." -> not for us.

      Token Auth == Using Personal Access Token

      Create a PAT

      1. Go to https://issues.redhat.com/secure/ViewProfile.jspa
      2. Go to the "Personal Access Tokens" tab
      3. Click the "Create Token" button
      4. Fill the form: set Token name and days until expiry (max is 365).
      5. Copy the token and store it in a safe space.

      Set the JIRA_TOKEN environment variable

      JIRA_TOKEN='XXXXXX'
      export JIRA_TOKEN
      

      Authenticating with a PAT doesn't solve the problem.
      In fact, the script don't require authentication at all. => Dropping auth.


      Second roud of invsetigation: Jira field renamed

      The "Release Notes Docs Status" field has been replaces by the field name is "Release Note Status". The search in our Jira dashboard was fixed, but not this script. -> THAT WAS THE ISSUE

      • The main Jira filter adapted automagically.
      • Modified python script.
      • Modified Jira Smart Filters.

      Third round of investigation: "Release Note Status" has different values.

      • Done => Done filter
      • Rejected => Done filter
      • Upstream only => Done filter
      • Proposed => Todo filter
      • In progress => Todo filter
      • None values => Todo filter

      New "Release Note Type" field with values:

      • [None]
      • Bug Fix
      • CVE - Common Vulnerabilities and Exposures
      • Deprecated Functionality
      • Developer Preview
      • Enhancement
      • Feature
      • Known Issue
      • Rebase
      • Removed Functionality
      • Technology Preview
      • Unspecified Release Note Type - Unknown
      • Adapt Jira
      • Adapt python script

              ffloreth@redhat.com Fabrice Flore-Thébault
              ffloreth@redhat.com Fabrice Flore-Thébault
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: