Unverified Commit 7fa5daf7 authored by copilot-swe-agent[bot]'s avatar copilot-swe-agent[bot] Committed by GitHub
Browse files

Support Microsoft OpenJDK 25.0.5.0.2 with bundled manifest fallback

parent 50e0e851
Loading
Loading
Loading
Loading
+9
Changes for .github/workflows/e2e-versions.yml: 9 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -51,6 +51,15 @@ jobs:
          - distribution: microsoft
            os: macos-latest
            version: 25
          - distribution: microsoft
            os: windows-latest
            version: '25.0.5+0.2'
          - distribution: microsoft
            os: ubuntu-latest
            version: '25.0.5+0.2'
          - distribution: microsoft
            os: macos-latest
            version: '25.0.5+0.2'
          - distribution: kona
            os: windows-latest
            version: 25
+1
Changes for README.md: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -225,6 +225,7 @@ Additional distribution notes:

- Oracle OpenJDK builds are archived after a limited number of releases and no longer receive security updates. To continue receiving security patches, use Oracle JDK or another vendor.
- Azul Zulu maps `arm64` to `aarch64` when querying the Azul Metadata API.
- Microsoft Build of OpenJDK uses Microsoft's live version manifest, falling back to the bundled version list when no release matches. Version `25.0.5.0.2` can also be requested as `25.0.5+0.2`.
- GraalVM Community is available as `distribution: graalvm-community` for stable JDK 17 and later releases.
- On Ubuntu runners, commands executed with `sudo` do not inherit the `JAVA_HOME` and `PATH` set by `setup-java` and may fall back to the system-default JDK.

+84
Changes for __tests__/distributors/microsoft-installer.test.ts: 84 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -216,6 +216,90 @@ describe('findPackageForDownload', () => {
    expect(result.signatureUrl).toBe(`${url}.sig`);
  });

  describe.each(['25.0.5.0.2', '25.0.5+0.2', '25.0.5'])(
    'version %s missing from the live manifest',
    version => {
      it.each([
        ['darwin', 'x64', 'macos', 'tar.gz'],
        ['linux', 'x64', 'linux', 'tar.gz'],
        ['win32', 'x64', 'windows', 'zip'],
        ['darwin', 'aarch64', 'macos', 'tar.gz'],
        ['linux', 'aarch64', 'linux', 'tar.gz'],
        ['win32', 'aarch64', 'windows', 'zip']
      ])(
        'resolves the bundled release for %s/%s',
        async (platform, architecture, osType, extension) => {
          mockOsPlatform.mockReturnValue(platform);
          const distro = new MicrosoftDistributions({
            version,
            architecture,
            packageType: 'jdk',
            checkLatest: false
          });

          const result = await distro['findPackageForDownload'](
            distro['version']
          );
          const url = `https://aka.ms/download-jdk/microsoft-jdk-25.0.5.0.2-${osType}-${architecture}.${extension}`;

          expect(result).toEqual({
            version: '25.0.5+0.2',
            url,
            signatureUrl: `${url}.sig`,
            checksum: {
              algorithm: 'sha256',
              value: MICROSOFT_CHECKSUM,
              source: `${url}.sha256sum.txt`
            }
          });
          expect(spyHttpClientGet).toHaveBeenCalledWith(`${url}.sha256sum.txt`);
        }
      );
    }
  );

  it('prefers the live manifest when it contains the requested release', async () => {
    mockOsPlatform.mockReturnValue('linux');
    const url =
      'https://example.test/microsoft-jdk-25.0.5.0.2-linux-x64.tar.gz';
    spyGetManifestFromRepo.mockResolvedValue({
      result: [
        {
          version: '25.0.5+0.2',
          stable: true,
          release_url: 'https://aka.ms/download-jdk',
          files: [
            {
              filename: 'microsoft-jdk-25.0.5.0.2-linux-x64.tar.gz',
              arch: 'x64',
              platform: 'linux',
              download_url: url
            }
          ]
        }
      ],
      statusCode: 200,
      headers: {}
    });

    const result = await distribution['findPackageForDownload']('25.0.5+0.2');

    expect(result.version).toBe('25.0.5+0.2');
    expect(result.url).toBe(url);
    expect(spyGetManifestFromRepo).toHaveBeenCalledWith(
      'https://aka.ms/download-jdk/microsoft-openjdk-versions.json',
      {accept: 'application/json'}
    );
  });

  it('preserves the error when the live manifest cannot be loaded', async () => {
    spyGetManifestFromRepo.mockRejectedValue(new Error('Network error'));

    await expect(
      distribution['findPackageForDownload']('25.0.5+0.2')
    ).rejects.toThrow('Could not load manifest for Microsoft Build of OpenJDK');
  });

  it.each([
    ['amd64', 'x64'],
    ['arm64', 'aarch64']
−330

File deleted.

+334

File added.

Preview size limit exceeded, changes collapsed.

Loading