Commit Graph

114 Commits

Author SHA1 Message Date
Marc Wrobel
7b90c02f62 Try to fix fetch_urls when ChunkedEncodingError occurs (#188) 2023-11-26 13:58:27 +01:00
Hugo van Kemenade
1022d8f816 Fix some lint warnings (#189)
Remove unused imports or variable, and apply suggestions from https://adamj.eu/tech/2019/09/12/how-i-import-pythons-datetime-module/.
2023-11-26 13:25:04 +01:00
Marc Wrobel
f59390815c Try to fix fetch_urls when ChunkedEncodingError occurs (#188)
Intermittent ChunkedEncodingErrors occurs while fetching URLs. This change try to fix it by retrying.
According to https://stackoverflow.com/a/44511691/374236, most servers transmit all data, but that's not what was observed.

For future reference the traceback was:

```
  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/home/runner/work/release-data/release-data/src/firefox.py", line 36, in <module>
      for response in endoflife.fetch_urls(urls):
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/runner/work/release-data/release-data/src/common/endoflife.py", line 55, in fetch_urls
      return [future.result() for future in as_completed(futures)]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/runner/work/release-data/release-data/src/common/endoflife.py", line 55, in <listcomp>
      return [future.result() for future in as_completed(futures)]
              ^^^^^^^^^^^^^^^
    File "/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/concurrent/futures/_base.py", line 449, in result
      return self.__get_result()
             ^^^^^^^^^^^^^^^^^^^
    File "/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
      raise self._exception
    File "/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/concurrent/futures/thread.py", line 58, in run
      result = self.fn(*self.args, **self.kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
      resp = self.send(prep, **send_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/requests/sessions.py", line 747, in send
      r.content
    File "/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/requests/models.py", line 899, in content
      self._content = b"".join(self.iter_content(CONTENT_CHUNK_SIZE)) or b""
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/requests/models.py", line 818, in generate
      raise ChunkedEncodingError(e)
  requests.exceptions.ChunkedEncodingError: ("Connection broken: InvalidChunkLength(got length b'', 0 bytes read)", InvalidChunkLength(got length b'', 0 bytes read))
```
2023-11-26 13:23:17 +01:00
Marc Wrobel
ca689dc373 Support parallel URL fetching via endoflife.fetch_urls (#184)
Move the parallel URL fetching from firefox.py to endoflife.py to make available parallel URL fetching for all scripts.

Also a a fix found on https://stackoverflow.com/a/44511691/374236 to avoid ChunkedEncodingError.
2023-11-26 11:34:18 +01:00
Marc Wrobel
f0324372d9 Use request instead of urllib for HTTP requests
It's simpler to use, and provides better retry capabilities.
2023-11-25 00:08:47 +01:00
Marc Wrobel
2e83befe93 [aws-lambda] Add automation (#166)
The purpose of this new script is to be alerted of new runtimes, while not making updates to the original product file (because release dates cannot be fetched from AWS documentation).
2023-11-23 22:02:51 +01:00
Marc Wrobel
600e77e212 Sort versions by date then version for all products (#179) 2023-11-15 22:30:31 +01:00
Marc Wrobel
701c2899d5 [git] Migrate git method from Ruby to Python (#178)
The main reason for doing this is to have some common code between scripts, so that it is easier to change the JSON schema globally and normalize a few things (such as release order).

The Ruby code was kept as is so we can quickly roll back if necessary.
2023-11-12 20:33:29 +01:00
Marc Wrobel
94e04f3b4f Increase the default timeout value
Recently links to web.archive.org were added for various products. Such links are very long to load. This increases the default timeout value so that such links do not make the update fail.
2023-09-11 23:00:51 +02:00
Marc Wrobel
4aa7047fe1 Increase default retry count and timeout for python scripts
Frequent 'update data' workflow failures were observed lately, some due to timeout while fetching URLs.
2023-08-01 22:46:56 +02:00
Daniel
897d514e7f Add red-hat-openshift script (#119)
The script only get versions 4.x and above, see script comments for more informations.

Note that the code related to git has been extracted to a common script so that it can be reused for the Debian script.
2023-07-15 18:26:11 +02:00
Marc Wrobel
6ba7828f96 Refactor product releases writing
Create a common function to write resulting JSON files to the releases directory.
It makes this task simpler to read and maintain, while making it modifiable at a central point in the future.
One example of such modification could be the sorting of the versions in a uniform way for all the scripts.
2023-06-11 12:45:59 +02:00
Marc Wrobel
a16d9090d3 Refactor HTTP URL fetching scripts
This creates a common function to fetch HTTP URLs, with enhanced capabilities (retry, use of a known User-Agent).
It makes scripts that need those capabilities simpler, while improving other scripts.

This commit also fixes some scripts that did not log properly (cos.py, eks.py, haproxy.py, palo-alto-networks.py, rhel.py, ros.py, unrealircd.py).
2023-06-11 12:45:59 +02:00
Marc Wrobel
5176abd4d4 Refactor product filtering and loading for generic scripts
Generic scripts are scripts that handle multiple product based on some identifier (URL, coordinates...).
This creates a common function to list and load product configurations for those scripts.

It makes them simpler to read and maintain, while making the way they work much more consistent.
2023-06-11 12:45:59 +02:00