Skip to content

eng, replace Maven Central with Azure Artifacts feed in automation scripts#49125

Open
XiaofeiCao wants to merge 1 commit intomainfrom
automation/replace-maven-central-with-azure-artifacts-feed
Open

eng, replace Maven Central with Azure Artifacts feed in automation scripts#49125
XiaofeiCao wants to merge 1 commit intomainfrom
automation/replace-maven-central-with-azure-artifacts-feed

Conversation

@XiaofeiCao
Copy link
Copy Markdown
Contributor

@XiaofeiCao XiaofeiCao commented May 8, 2026

Similar to PR #48817 (PowerShell scripts), this updates the Python automation scripts under eng/automation/ to use the Azure Artifacts internal feed instead of Maven Central.

Key Changes

Feed URL Update:

  • Replaced MAVEN_HOST (repo1.maven.org) with Azure Artifacts feed URL (pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-java/maven/v1)

Authentication:

  • Added SYSTEM_ACCESSTOKEN Bearer auth headers to HTTP requests in utils.py and generate_utils.py for CI environments
  • Auth is optional — when SYSTEM_ACCESSTOKEN is unset (local dev), requests proceed without auth

Timeout:

  • Added timeout=30 to all requests.get() calls that were missing timeouts

Pipeline:

  • Exposed SYSTEM_ACCESSTOKEN env var in generation.yml pipeline steps

…scripts

- Updated MAVEN_HOST in parameters.py to use Azure Artifacts feed URL
- Added SYSTEM_ACCESSTOKEN Bearer auth headers to requests in utils.py
  and generate_utils.py for CI environments
- Added timeout=30 to all requests.get() calls missing timeouts
- Exposed SYSTEM_ACCESSTOKEN env var in generation.yml pipeline steps

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@XiaofeiCao XiaofeiCao changed the title [Java] Replace Maven Central with Azure Artifacts feed in automation scripts eng, replace Maven Central with Azure Artifacts feed in automation scripts May 8, 2026
@XiaofeiCao XiaofeiCao marked this pull request as ready for review May 8, 2026 09:23
Copilot AI review requested due to automatic review settings May 8, 2026 09:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates eng/automation Python scripts and pipeline wiring to prefer the Azure Artifacts Maven feed over Maven Central, adding optional CI authentication and request timeouts to improve reliability in restricted build environments.

Changes:

  • Switched MAVEN_HOST to the Azure Artifacts Maven feed URL for automation downloads.
  • Added optional SYSTEM_ACCESSTOKEN bearer authentication for Maven feed HTTP requests (CI-friendly) and added missing timeout=30 on relevant requests.get() calls.
  • Updated eng/automation/generation.yml steps to pass SYSTEM_ACCESSTOKEN into generation scripts.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
eng/automation/utils.py Adds bearer auth + timeout to the Maven lookup used for GA version discovery.
eng/automation/parameters.py Repoints Maven host constant from Maven Central to Azure Artifacts feed.
eng/automation/generation.yml Exposes SYSTEM_ACCESSTOKEN to generation steps.
eng/automation/generate_utils.py Adds bearer auth + timeout to jar download used for changelog/breaking-change comparison.
eng/automation/generate_data.py Adds a timeout to HTTP reads in uri_file_read.
Comments suppressed due to low confidence (1)

eng/automation/utils.py:418

  • get_latest_ga_version currently fetches .../{group}/{artifact} and parses an HTML directory listing (<a href="...">) to discover GA versions. With MAVEN_HOST now pointing at an Azure Artifacts Maven feed, that endpoint may not expose an HTML listing (or may change format), which can break GA version discovery and downstream changelog comparisons. Prefer querying .../{group}/{artifact}/maven-metadata.xml and parsing <version> elements (standard Maven repo behavior) to make this work reliably across Maven Central and Azure Artifacts (similar to how the PowerShell scripts query maven-metadata.xml).
    group_path = group_id.replace(".", "/")

    headers = {}
    token = os.environ.get("SYSTEM_ACCESSTOKEN")
    if token:
        headers["Authorization"] = f"Bearer {token}"

    response = requests.get(f"{MAVEN_HOST}/{group_path}/{module}", headers=headers, timeout=30)

    response.raise_for_status()

    ga_version_pattern = r"<a href=\"(\d+\.\d+\.\d+)\/"
    ga_versions = [v.group(1) for v in re.finditer(ga_version_pattern, response.text, re.S)]

Comment thread eng/automation/utils.py
Comment thread eng/automation/generate_utils.py
Copy link
Copy Markdown
Member

@weidongxu-microsoft weidongxu-microsoft left a comment

Choose a reason for hiding this comment

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

LGTM

but wait for EngSys

Comment on lines +60 to +61
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This pipeline should no longer be used. Update here for consistency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants