Skip to content

Commit fc2fc04

Browse files
author
Rami Bououni
committed
upstream config
1 parent 4e614fc commit fc2fc04

File tree

2 files changed

+60
-58
lines changed

2 files changed

+60
-58
lines changed
42.1 KB
Loading

docs/artifacts/tutorials/protect-oss-packages-with-upstream-sources.md

Lines changed: 60 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -23,90 +23,66 @@ This tutorial walks you through enabling upstream sources in your feed and consu
2323

2424
## Create a feed and enable upstream sources
2525

26-
::: moniker range="<=azure-devops"
27-
2826
1. Sign in to your Azure DevOps organization, and then navigate to your project.
2927

3028
1. Select **Artifacts**, and then select **Create Feed** to create a new feed.
3129

32-
:::image type="content" source="../media/new-feed-button-azure-devops-newnav.png" alt-text="Screenshot showing the create feed button.":::
33-
34-
1. Provide a name for your feed, and choose its visibility. Make sure you check the **Include packages from common public sources** checkbox to enable upstream sources, and then select **Create** when you're done.
30+
1. Provide a **Name** for your feed, choose its **Visibility** and **Scop**, and make sure you check the **Include packages from common public sources** checkbox to enable upstream sources.
3531

36-
:::image type="content" source="../media/new-feed-dialog.png" alt-text="Screenshot showing the create a new feed window.":::
32+
1. Select **Create** when you're done.
3733

38-
::: moniker-end
34+
:::image type="content" source="../media/new-feed-with-upstream-source.png" alt-text="a Screenshot displaying how to create a new feed and enable upstream sources in Azure Artifacts.":::
3935

40-
> [!NOTE]
36+
> [!IMPORTANT]
4137
> To add a feed from a different organization as an upstream source, the target feed owner must share the target view with **All feeds and people in organizations associated with my Microsoft Entra tenant** by navigating to **Feed Settings** > **Views** > Select the ellipsis button on the right for the specified view > **Edit** .
4238
43-
## Set up the configuration file
39+
## Authenticate with the feed
4440

45-
Now that we created our feed, we need to update the config file to point to our feed. To do this we must:
46-
47-
1. Get the source's URL
48-
1. Update the configuration file
41+
Now that you've created your feed, select the appropriata tab based on the technology you're using and follow the instructions to set up your configuration file and connect to your feed:
4942

5043
#### [npm](#tab/npm/)
5144

52-
::: moniker range="<=azure-devops"
53-
54-
1. Select **Artifacts**, and then select **Connect to feed**.
55-
56-
:::image type="content" source="../media/connect-to-feed-azure-devops-newnav.png" alt-text="Screenshot showing how to connect to a feed.":::
57-
58-
1. On the left side of the page, select the **npm** tab.
59-
60-
1. Follow the instructions in the **Project setup** section to set up your config file.
45+
1. Sign in to your Azure DevOps organization, and then navigate to your project.
6146

62-
:::image type="content" source="../media/connect-to-feed-npm-registry-azure-devops-newnav.png" alt-text="Screenshot showing how to set up your project.":::
47+
1. Select **Artifacts**, select your feed from the dropdown menu, and then select **Connect to feed**.
6348

64-
::: moniker-end
49+
1. Select **npm** from the left navigation pane, and follow the provided instructions in the **Project setup** section to set up your config file. If you don’t already have a *.npmrc* file, create a new one in the root of your project (the same folder as your *package.json*). Open your new *.npmrc* file and paste in the provided snippet.
6550

66-
If you don't have a *.npmrc* file already, create a new one in the root of your project (in the same folder as your *package.json*). Open your new *.npmrc* file and paste the snippet you just copied in the previous step.
51+
:::image type="content" source="../media/connect-to-feed-npm-registry-azure-devops-newnav.png" alt-text="A screenshot displaying how to set up your npm project in Azure Artifacts.":::
6752

6853
#### [NuGet](#tab/nuget/)
6954

70-
1. Select **Artifacts**, and then select your feed.
71-
72-
1. Select **Connect to feed**, and then choose **NuGet.exe**.
73-
74-
:::image type="content" source="../media/nuget-connect-to-feed.png" alt-text="Screenshot showing how to connect to NuGet feeds.":::
55+
1. Sign in to your Azure DevOps organization, and then navigate to your project.
7556

76-
1. Copy the XML snippet in the **Project Setup** section.
57+
1. Select **Artifacts**, select your feed from the dropdown menu, and then select **Connect to feed**.
7758

78-
1. Create a new file named *nuget.config* in the root of your project.
59+
1. Select **NuGet.exe** from the left navigation pane, then copy the XML snippet provided in the **Project Setup** section.
7960

80-
1. Paste the XML snippet in your config file.
61+
1. Create a new *nuget.config* file in the root of your project, and paste in the XML snippet you copied in the previous step.
8162

8263
#### [Pip](#tab/pip/)
8364

84-
1. Select **Artifacts**, and then select your feed from the dropdown list.
65+
1. Sign in to your Azure DevOps organization, and then navigate to your project.
8566

86-
1. Select **Connect to feed**, and then select **pip** under the Python section.
67+
1. Select **Artifacts**, select your feed from the dropdown menu,and then select **Connect to feed**.
8768

88-
:::image type="content" source="../media/project-setup-pip.png" alt-text="A screenshot showing how to connect to a feed with pip projects.":::
69+
1. Select **pip** from the left navigation pane.
8970

9071
1. Create a [virtual environment](https://go.microsoft.com/fwlink/?linkid=2103878) if you haven't done so already.
9172

92-
1. Add a pip.ini (Windows) or pip.conf (Mac/Linux) file to your virtualenv and paste the following snippet:
93-
94-
```command
95-
[global]
96-
index-url=https://pkgs.dev.azure.com/ORGANIZATION-NAME/_packaging/FEED-NAME/pypi/simple/
97-
```
73+
1. Add a *pip.ini* (Windows) or *pip.conf* (Mac/Linux) file to your virtualenv and paste in the snippet provided in the **Project setup** secion.
9874

9975
#### [Maven](#tab/maven/)
10076

101-
1. Select **Artifacts**, and then select your feed from the dropdown list.
77+
1. Sign in to your Azure DevOps organization, and then navigate to your project.
10278

103-
1. Select **Connect to feed**, and then select **Maven**.
79+
1. Select **Artifacts**, select your feed from the dropdown menu, and then select **Connect to feed**.
10480

105-
:::image type="content" source="../media/project-setup-maven.png" alt-text="A screenshot showing how to connect to a feed with Maven projects.":::
81+
1. Select **Maven** from the left navigation pane.
10682

107-
1. Add the following snippet to the `<repositories>` and `<distributionManagement>` sections in your pom.xml:
83+
1. Add the snippet provided in the **Project setup** section to the `<repositories>` and `<distributionManagement>` sections in your *pom.xml*. Your file should look similar to the following:
10884

109-
```command
85+
```xml
11086
<repository>
11187
<id>[FEED-NAME]</id>
11288
<url>https://pkgs.dev.azure.com/[ORGANIZATION-NAME]/_packaging/[FEED-NAME]/maven/v1</url>
@@ -119,9 +95,9 @@ If you don't have a *.npmrc* file already, create a new one in the root of your
11995
</repository>
12096
```
12197

122-
1. Add a `<server>` to your settings.xml file:
98+
1. Paste the provided `<server>` snippet into your *settings.xml* file. You file should look similar to this:
12399

124-
```command
100+
```xml
125101
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
126102
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
127103
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
@@ -136,19 +112,19 @@ If you don't have a *.npmrc* file already, create a new one in the root of your
136112
</settings>
137113
```
138114

139-
1. Create a [personal access token](../../organizations/accounts/use-personal-access-tokens-to-authenticate.md#create-a-pat) with **Packaging** > **Read & write** scopes and paste your personal access token into the `<password>` tag in your settings.xml file.
115+
1. Create a [personal access token](../../organizations/accounts/use-personal-access-tokens-to-authenticate.md#create-a-pat) with **Packaging** > **Read & write** scopes and paste your personal access token into the `<password>` tag in your *settings.xml* file.
140116

141117
#### [Gradle](#tab/gradle/)
142118

143-
1. Select **Artifacts**, and then select your feed from the dropdown list.
119+
1. Sign in to your Azure DevOps organization, and then navigate to your project.
144120

145-
1. Select **Connect to feed**, and then select **Gradle**.
121+
1. Select **Artifacts**, select your feed from the dropdown menu, and then select **Connect to feed**.
146122

147-
:::image type="content" source="../media/project-setup-gradle.png" alt-text="A screenshot showing how to connect to a feed with Gradle projects.":::
123+
1. Select **Gradle** from the left navigation pane.
148124

149-
1. Add the following snippet to the *repositories* and *publishing* sections in your build.gradle file:
125+
1. Add the snippet provided in the **Project setup** section to the *repositories* and *publishing* sections in your *build.gradle* file. Your file should resemble the following:
150126

151-
```command
127+
```
152128
maven {
153129
url 'https://pkgs.dev.azure.com/[ORGANIZATION-NAME]/_packaging/[FEED-NAME]/maven/v1'
154130
name '[FEED-NAME]'
@@ -158,9 +134,9 @@ If you don't have a *.npmrc* file already, create a new one in the root of your
158134
}
159135
```
160136

161-
1. Add a `<server>` to your settings.xml file:
137+
1. Paste the provided `<server>` snippet into your *settings.xml* file. Your file should resemble the following:
162138

163-
```command
139+
```xml
164140
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
165141
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
166142
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
@@ -175,7 +151,33 @@ If you don't have a *.npmrc* file already, create a new one in the root of your
175151
</settings>
176152
```
177153

178-
1. Create a [personal access token](../../organizations/accounts/use-personal-access-tokens-to-authenticate.md#create-a-pat) with **Packaging** > **Read & write** scopes. Paste your personal access token into the `<password>` tag in your settings.xml file.
154+
1. Create a [personal access token](../../organizations/accounts/use-personal-access-tokens-to-authenticate.md#create-a-pat) with **Packaging** > **Read & write** scopes. Paste your personal access token into the `<password>` tag in your *settings.xml* file.
155+
156+
#### [Cargo](#tab/cargo/)
157+
158+
1. Sign in to your Azure DevOps organization, and navigate to your project.
159+
160+
1. Select **Artifacts**, select your feed from the dropdown menu, and then select **Connect to feed**.
161+
162+
1. Select **Cargo** from the left navigation pane.
163+
164+
1. Add the snippet provided in the **Project setup** section to your *cargo/config.toml* file in your source repository. Your *config.toml* file should resemble the following:
165+
166+
```
167+
[registries]
168+
FEED_NAME = { index = "sparse+https://pkgs.dev.azure.com/ORGANIZATION_NAME/PROJECT_NAME/_packaging/FEED_NAME/Cargo/index/" }
169+
```
170+
171+
1. Add the second snippet provided in the **Project setup** section to your *cargo/config.toml* file to replace the *crates.io* source with your feed. Your file should resemble the following:
172+
173+
```
174+
[source.crates-io]
175+
replace-with = "FEED_NAME"
176+
```
177+
178+
1. [Configure a credential provider](../cargo/project-setup-cargo.md#configure-a-credential-provider)
179+
180+
1. [Log in to the registry](../cargo/project-setup-cargo.md#log-in-to-the-registry)
179181

180182
- - -
181183

0 commit comments

Comments
 (0)