Skip to content

Conversation

@mbilda
Copy link
Contributor

@mbilda mbilda commented Mar 7, 2025

Closes: #1181

  • deleted the new line patterns out of the regex in DockerDesktopUrlUpdater because Pattern.DOTALL already handles this
  • TBH I do not know why this pattern now works, because it also should have worked with the (\n\r...) regex. Maybe both, regex and DOTALL don't work together
  • changed the group to group1 because there is only one group left

With this implementation i was able to create versionized folders in my custom repository for the defined docker versions:
{5977D301-C902-4C5E-B262-B6CA530FBE01}

This still needs to be tested with workflow because test <-> workflow isn't the same environment and so on.

We were also able to test the "real" UrlUpdater via github actions. We created a custom github action for testing the url updater. We checked out the url repository to fetch all existing versions and were able to upload/download the temporarily produced new repo.
The results can be seen here:
https://github.com/mbilda/IDEasy/actions/runs/13834518742
{47ACD727-B566-4E00-95F9-15F00A335179}

- deleted the new line patterns out of the regex in DockerDesktopUrlUpdater because Pattern.DOTALL already handles this
@github-project-automation github-project-automation bot moved this to 🆕 New in IDEasy board Mar 7, 2025
@mbilda mbilda requested a review from jan-vcapgemini March 7, 2025 14:33
@mbilda mbilda added bugfix docker docker and esp. DockerDesktop labels Mar 7, 2025
@mbilda mbilda moved this from 🆕 New to Team Review in IDEasy board Mar 7, 2025
@coveralls
Copy link
Collaborator

coveralls commented Mar 10, 2025

Pull Request Test Coverage Report for Build 18510598572

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 5 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.2%) to 68.597%

Files with Coverage Reduction New Missed Lines %
com/devonfw/tools/ide/url/tool/docker/DockerDesktopUrlUpdater.java 5 81.82%
Totals Coverage Status
Change from base Build 18493975671: 0.2%
Covered Lines: 9040
Relevant Lines: 12687

💛 - Coveralls

jan-vcapgemini and others added 3 commits March 11, 2025 09:56
- Added a fallback for "*" (Latest) - Version to be found in the filesystem
- Added a fallback to name the downloadcache file to latest if version is "*" (latest)
@mbilda mbilda changed the title #692 : UrlUpdater fetches every defined version #692 : UrlUpdater fetches every defined version for Docker Mar 11, 2025
@mbilda mbilda changed the title #692 : UrlUpdater fetches every defined version for Docker #692 : UrlUpdater fetches every defined version for Docker and latest version is now accepted as well Mar 11, 2025
mbilda added 5 commits March 11, 2025 16:34
- Changed order to prevent nullpointer
- changed structure to if-else
- Refactored UrlUpdaterMockSingle to modify the verion which should be tested
- deleted temporary test case
@mbilda mbilda moved this from Team Review to 👀 In review in IDEasy board Mar 13, 2025
@mbilda mbilda requested a review from hohwille March 13, 2025 13:08
@hohwille hohwille added this to the urls milestone Mar 14, 2025
Copy link
Member

@hohwille hohwille left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mbilda thank you very much for your PR. You did a great job and very well analysed the problem. Even you tested the URL Updater via GHA in your fork. Excellent 🚀

However, I checked the logs of your test run and found e.g. this line:

12:28:42.793 [com.devonfw.tools.ide.url.UpdateInitiator.main()] - WARN  - c.d.t.i.u.updater.AbstractUrlUpdater - For tool docker and version 4.33.2 the download verification failed with status code 403 for URL https://desktop.docker.com/win/main/amd64/179689/Docker%20Desktop%20Installer.exe.

It seems that there are a lot of such errors and I can also reproduce this in my browser:
image

My assumption is that after merging this we get dedicated versions of docker desktop but no URL for Windows and therefore we will entirely break it for Windows users.
Could you confirm my observations and maybe find a solution to improve your PR?

@hohwille
Copy link
Member

See also this final summary:

docker/docker versions added: 0 failed, 98 succeeded, 98 total, 0.00% error - versions verified: 17 failed, 56 succeeded, 73 total, 23.29% error

@mbilda
Copy link
Contributor Author

mbilda commented Mar 17, 2025

@hohwille good point.
So the error occurs because there is no version to download for windows at all. We still find the version because it is listed in the release notes, but there is no download link provided for windows - only for mac.
See here (example for 179689 - 4.33.2):
{5C2B37A7-0B6A-4159-93CF-8267C2480F8A}
That means there is no download link at all and thats why we receive this error, even when we directly pasting the download url into the browser.

Why do we even try to download this version?
The regex:

String regex = "href=#" + version
        // .....................................................(Group.1.)..........
        + ".{8,12}.{0,350}href=https://desktop\\.docker\\.com.*?(\\d{5,6}).*\\.exe";

The crucial part of this is the following:
.*\\.exe
It matches as many characters as needed until it finds .exe
The next match which will be found is actually the next version where a windows version exists.
See here (regex101 example matching two versions)
https://regex101.com/r/hEmRX3/2
At this point we do not know the "actual docker version" (179689) - thats why we use the regex above to extract it.
Even though it is working, we receive lots of errors with 403, because we try to download a non-existing file.

TODO:

  • We need a more specific regex to match exactly the stuff we need - not more, not less.
    • How could we do that?
      • We could delete the .exe of the regex to match the first finding of the docker-version-number. As we see in the above example, it doesn't matter if we have the .exe in the regex. It just searches for anything until it finds .exe - which will definitely be the case at some time. But at this point we already have what we want - the docker-version-number
      • We then could use the found group-match to execute a new regex but with specific windows urls or mac urls and so on (we actually do this in a different kind of way - we just try to download it - which is kinda finding it - but it fails)
      • After another regex, we can then download it, if it exists or not

Furthermore, if the download of the non-existing windows version fails, we return out of the addVersions()-function and skipping the "maybe existing" other versions for mac.

Questions:
Should we provide versions only for one OS at all?

  • Like in the example above, if we wouldn't return out of the function we would just download the 4.33.2 versions for mac and failing with windows. But then only mac-versions would exist in ide - good or bad?

Copy link
Member

@hohwille hohwille left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so far we do not have dedicated versions of docker-desktop:
https://github.com/devonfw/ide-urls/tree/master/docker/docker/

That means this PR is adding this as a new feature.
I found that the web-site you are crawling (https://docs.docker.com/desktop/release-notes/) also contains checksum links pointing to SHA256 checksums.
You should also use these checksums since otherwise our fallback applies to compute them ourselves what requires that we download every entire release and compute the checksum ourselves what causes gigabytes of wasted bandwidth and makes the process also much slower.
See here for an existing example:

String cs = getCheckSum(checkSumLink);
doAddVersion(url, link, os, systemArchitecture, cs);

@mbilda
Copy link
Contributor Author

mbilda commented Mar 27, 2025

This PR extends on the fly because there are several open points to discuss to handle the new url updater for docker desktop.
Open points:

  • the more regexes and compiles of the regexes, the more ide loses performance
  • We need the checksum check as well
  • Do we really need docker desktop? Isn't it enough to install docker (cli)
  • Should we really pull all versions? (There are versions which only fixes bugs for mac -> only download links for mac)

This PR handles two individual things. The first one is the fix for the actual bug. IDE could not handle latest version. Because it is resolved to " * ". The second one is the improvement of the url updater which throws a lot of open questions.
I will split this PR into two parts.
First part: Fix the actual bug
Second part: Url updater improvement

To get things done, i will exclude the first part of this PR and create a new PR for this fix only. (#1182)
I also will detach the issue from this PR and create a new issue for all open points and improvement of the url updater and link it to this PR. (#1181)

@mbilda mbilda changed the title #692 : UrlUpdater fetches every defined version for Docker and latest version is now accepted as well #1181: UrlUpdater fetches every defined version for Docker Mar 27, 2025
mbilda added 5 commits March 27, 2025 08:38
…essary versions

- removed test for different issue
…essary versions

- added checksum curl to get checksum for specific version
- added checksum result to addVersion to prevent url updater to calculate checksum by itself
@mbilda
Copy link
Contributor Author

mbilda commented Mar 27, 2025

You should also use these checksums since otherwise our fallback applies to compute them ourselves what requires that we download every entire release and compute the checksum ourselves what causes gigabytes of wasted bandwidth and makes the process also much slower.

I added the checksum to the addVersion method.
For each checksum we need to curl the checksum url and get the first part out of it.
We only do this if the version exists, a check that we are already doing.

Copy link
Contributor

@jan-vcapgemini jan-vcapgemini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the checksum check too. I've added a small suggestion, please check.

mbilda and others added 2 commits April 7, 2025 11:43
…essary versions

- added review remarks
- introduced constants to remove hardcoded filename
@mbilda mbilda requested a review from hohwille April 7, 2025 10:15
Copy link
Contributor

@jan-vcapgemini jan-vcapgemini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@mbilda mbilda removed their assignment Apr 22, 2025
# Conflicts:
#	url-updater/src/main/java/com/devonfw/tools/ide/url/tool/docker/DockerDesktopUrlUpdater.java
fixed the regex for the download urls (made sure that all versions can be found)
made sure that a dynamic base URL can be used by WireMock
added a test for the DockerDesktopUrlUpdater (using an old download URL pattern and a new one)
added a test resource file based on the original website
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix docker docker and esp. DockerDesktop

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

Improve url updater for docker desktop to pull all necessary versions

4 participants