Search code examples
azureazure-devopsazure-artifacts

Add public upstream source to azure feed


We would like to have

https://repository.jboss.org/nexus/content/repositories/public/ 

as an upstream sources for our org level azure artifact feed. As far as I understand we can only have public upstream sources from npm, nuget, maven and pypi.

Can anyone give any leads on how should we go about it.


Solution

  • Azure Artifacts supports only public package managers (npmjs.com, NuGet.org, Maven Central, and PyPI) as public upstream source.

    Custom upstream sources are currently only supported for NPM.

    enter image description here

    https://learn.microsoft.com/en-us/azure/devops/artifacts/concepts/upstream-sources?view=azure-devops

    You can use JBoss Maven repositories directly in your builds by configuring Azure DevOps Pipeline. Example:

    - task: MavenAuthenticate@0
      displayName: 'Maven Authenticate'
      inputs:
        MavenServiceConnections: central,MavenOrg
    

    The MavenAuthenticate task updates the settings.xml file present in the agent users' .m2 directory located at {user.home}/.m2/settings.xml to add two entries inside the element.

    settings.xml

    <servers>
      <server>
        <id>central</id>
        <username>centralUsername</username>
        <password>****</password>
      </server>
      <server>
        <id>MavenOrg</id>
        <username>mavenOrgUsername</username>
        <password>****</password>
      </server>
    </servers>
    

    You should set the repositories in your project's pom.xml to have the same as the name specified in the task for Maven to be able to correctly authenticate the task.

    pom.xml

    <repository>
      <id>central</id>
      <url>https://repo1.maven.org/maven2/</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
    

    https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/package/maven-authenticate?view=azure-devops#authenticate-maven-feeds-outside-your-organization

    https://developer.jboss.org/docs/DOC-15170