Ensuring dotnet package sources are correct for local packages (#6476)

When passing a package source as part of a `dotnet add package` in
our acceptance testing framework, dotnet was then trying to use that
package source for the restoration of other packages in the csproj
file.

We have removed passing the source to dotnet add package add
and replaced it with adding a machine level package source via
dotnet nuget add source command

this is the more correct way to work and will allow us to be able
to search multiple locations as part of the dotnet restore command
This commit is contained in:
Paul Stack 2021-03-09 14:57:24 +00:00 committed by GitHub
parent 0ad6f9b63b
commit 0d5b3d375d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 23 additions and 9 deletions

View file

@ -147,6 +147,7 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
@ -212,6 +213,7 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet }}
- run: dotnet nuget add source ${{ env.PULUMI_LOCAL_NUGET }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
@ -226,6 +228,9 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Clean
run: dotnet nuget locals all --clear
- name: Create Local Nuget
run: mkdir -p "D:\\Pulumi\\nuget"
shell: bash
- name: Install Python Deps
run: |
pip3 install pyenv-win

View file

@ -146,6 +146,7 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
@ -211,6 +212,7 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet }}
- run: dotnet nuget add source ${{ env.PULUMI_LOCAL_NUGET }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
@ -225,6 +227,9 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Clean
run: dotnet nuget locals all --clear
- name: Create Local Nuget
run: mkdir -p "D:\\Pulumi\\nuget"
shell: bash
- name: Install Python Deps
run: |
pip3 install pyenv-win

View file

@ -242,6 +242,7 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
@ -307,6 +308,7 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet }}
- run: dotnet nuget add source ${{ env.PULUMI_LOCAL_NUGET }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
@ -321,6 +323,9 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Clean
run: dotnet nuget locals all --clear
- name: Create Local Nuget
run: mkdir -p "D:\\Pulumi\\nuget"
shell: bash
- name: Install Python Deps
run: |
pip3 install pyenv-win

View file

@ -68,6 +68,7 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
@ -107,8 +108,7 @@ jobs:
PULUMI_LOCAL_NUGET: ${{ runner.temp }}/opt/pulumi/nuget
PULUMI_ROOT: ${{ runner.temp }}/opt/pulumi
- name: Test
run: |
make test_all
run: make test_all
env:
PULUMI_NODE_MODULES: ${{ runner.temp }}/opt/pulumi/node_modules
PULUMI_LOCAL_NUGET: ${{ runner.temp }}/opt/pulumi/nuget
@ -148,6 +148,7 @@ jobs:
run: |
pip3 install pyenv-win
pip3 install pipenv
- run: dotnet nuget add source ${{ env.PULUMI_LOCAL_NUGET }}
- name: Set Build Env Vars
shell: bash
run: |
@ -163,6 +164,9 @@ jobs:
cd ./src/github.com/${{ github.repository }} && git fetch --quiet --prune --unshallow --tags
- name: Clean
run: dotnet nuget locals all --clear
- name: Create Local Nuget
run: mkdir -p "D:\\Pulumi\\nuget"
shell: bash
- name: Get dependencies
run: |
cd src\github.com\${{ github.repository }}
@ -190,5 +194,3 @@ jobs:
run: |
cd src\github.com\${{ github.repository }}
dotnet msbuild /t:Tests /v:Detailed build.proj /p:PulumiRoot="D:\\Pulumi"

View file

@ -1990,7 +1990,7 @@ func (pt *ProgramTester) prepareDotNetProject(projinfo *engine.Projinfo) error {
version := r.Replace(file)
err = pt.runCommand("dotnet-add-package",
[]string{dotNetBin, "add", "package", dep, "-s", localNuget, "-v", version}, cwd)
[]string{dotNetBin, "add", "package", dep, "-v", version}, cwd)
if err != nil {
return errors.Wrapf(err, "failed to add dependency on %s", dep)
}

View file

@ -5,9 +5,6 @@
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Pulumi.Random" Version="2.*" />
</ItemGroup>

View file

@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Pulumi.Random" Version="1.6.0-preview" />
<PackageReference Include="Pulumi.Random" Version="2.*" />
</ItemGroup>
</Project>