Remove use of /opt/pulumi for nuget packages

Stop using /opt/pulumi/nuget, this makes some progress towards fixing

There are three main changes here:
1) We no longer pack on build, instead requiring an explicit pack command
(which runs in relase configuration). This should be a small speed improvement
for standard builds.
2) The integration tests no longer rely on a nuget package, instead we just
reference the project directly. This removes the need for a local nuget feed
that had to be setup and installed into.
3) As we've got rid of the local nuget feed `make install` simply runs "dotnet
pack" and `make publish` picks up the .nupkg from the sdk bin folder.

The one workflow this changes is if people have pulumi programs outside
pulumi/pulumi that they we're using `make install` to get a build of the
dotnet sdk into. Anyone using that workflow instead needs to either:
1) Manually copy the .nupkg from the build folder to wherever they have
setup their local nuget feed.
2) Change that project to refer to Pulumi via a project reference.
This commit is contained in:
Fraser Waters 2021-11-10 10:04:53 +00:00
parent 0d4fb3e340
commit 385b5c5212
10 changed files with 12 additions and 69 deletions

View file

@ -160,8 +160,6 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}
- run: mkdir -p ${{ runner.temp }}/opt/pulumi/nuget
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
@ -230,8 +228,6 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}
- run: mkdir -p ${{ runner.temp }}/opt/pulumi/nuget
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
@ -266,7 +262,6 @@ jobs:
make dist
env:
PULUMI_NODE_MODULES: ${{ runner.temp }}/opt/pulumi/node_modules
PULUMI_LOCAL_NUGET: ${{ runner.temp }}/opt/pulumi/nuget
PULUMI_ROOT: ${{ runner.temp }}/opt/pulumi
- name: Install
run: |
@ -276,14 +271,12 @@ jobs:
python -m pip install -e sdk/python/env/src
env:
PULUMI_NODE_MODULES: ${{ runner.temp }}/opt/pulumi/node_modules
PULUMI_LOCAL_NUGET: ${{ runner.temp }}/opt/pulumi/nuget
PULUMI_ROOT: ${{ runner.temp }}/opt/pulumi
- name: Test
run: |
make TEST_ALL_DEPS= test_all
env:
PULUMI_NODE_MODULES: ${{ runner.temp }}/opt/pulumi/node_modules
PULUMI_LOCAL_NUGET: ${{ runner.temp }}/opt/pulumi/nuget
PULUMI_ROOT: ${{ runner.temp }}/opt/pulumi
windows-build:
name: Windows Build + Test + Publish
@ -296,7 +289,6 @@ jobs:
runs-on: windows-latest
env:
GOPATH: ${{ github.workspace }}
PULUMI_LOCAL_NUGET: "D:\\Pulumi\\nuget"
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_LEGACY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_LEGACY }}
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
@ -305,10 +297,6 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet }}
- name: Create Local Nuget
run: mkdir -p "${{ env.PULUMI_LOCAL_NUGET }}"
shell: bash
- run: dotnet nuget add source ${{ env.PULUMI_LOCAL_NUGET }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:

View file

@ -143,8 +143,6 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}
- run: mkdir -p ${{ runner.temp }}/opt/pulumi/nuget
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
@ -207,8 +205,6 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}
- run: mkdir -p ${{ runner.temp }}/opt/pulumi/nuget
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
@ -243,7 +239,6 @@ jobs:
make dist
env:
PULUMI_NODE_MODULES: ${{ runner.temp }}/opt/pulumi/node_modules
PULUMI_LOCAL_NUGET: ${{ runner.temp }}/opt/pulumi/nuget
PULUMI_ROOT: ${{ runner.temp }}/opt/pulumi
- name: Install
run: |
@ -253,14 +248,12 @@ jobs:
python -m pip install -e sdk/python/env/src
env:
PULUMI_NODE_MODULES: ${{ runner.temp }}/opt/pulumi/node_modules
PULUMI_LOCAL_NUGET: ${{ runner.temp }}/opt/pulumi/nuget
PULUMI_ROOT: ${{ runner.temp }}/opt/pulumi
- name: Test
run: |
make test_all
env:
PULUMI_NODE_MODULES: ${{ runner.temp }}/opt/pulumi/node_modules
PULUMI_LOCAL_NUGET: ${{ runner.temp }}/opt/pulumi/nuget
PULUMI_ROOT: ${{ runner.temp }}/opt/pulumi
windows-build:
name: Windows Build
@ -273,7 +266,6 @@ jobs:
runs-on: windows-latest
env:
GOPATH: ${{ github.workspace }}
PULUMI_LOCAL_NUGET: "D:\\Pulumi\\nuget"
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_LEGACY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_LEGACY }}
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
@ -282,10 +274,6 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet }}
- name: Create Local Nuget
run: mkdir -p "${{ env.PULUMI_LOCAL_NUGET }}"
shell: bash
- run: dotnet nuget add source ${{ env.PULUMI_LOCAL_NUGET }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:

View file

@ -236,8 +236,6 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}
- run: mkdir -p ${{ runner.temp }}/opt/pulumi/nuget
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
@ -306,8 +304,6 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}
- run: mkdir -p ${{ runner.temp }}/opt/pulumi/nuget
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
@ -347,7 +343,6 @@ jobs:
make dist
env:
PULUMI_NODE_MODULES: ${{ runner.temp }}/opt/pulumi/node_modules
PULUMI_LOCAL_NUGET: ${{ runner.temp }}/opt/pulumi/nuget
PULUMI_ROOT: ${{ runner.temp }}/opt/pulumi
- name: Check worktree is clean
run: ./ci-scripts/ci/check-worktree-is-clean
@ -359,14 +354,12 @@ jobs:
python -m pip install -e sdk/python/env/src
env:
PULUMI_NODE_MODULES: ${{ runner.temp }}/opt/pulumi/node_modules
PULUMI_LOCAL_NUGET: ${{ runner.temp }}/opt/pulumi/nuget
PULUMI_ROOT: ${{ runner.temp }}/opt/pulumi
- name: Test
run: |
make TEST_ALL_DEPS= test_all
env:
PULUMI_NODE_MODULES: ${{ runner.temp }}/opt/pulumi/node_modules
PULUMI_LOCAL_NUGET: ${{ runner.temp }}/opt/pulumi/nuget
PULUMI_ROOT: ${{ runner.temp }}/opt/pulumi
windows-build:
name: Windows Build
@ -379,7 +372,6 @@ jobs:
runs-on: windows-latest
env:
GOPATH: ${{ github.workspace }}
PULUMI_LOCAL_NUGET: "D:\\Pulumi\\nuget"
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_LEGACY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_LEGACY }}
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
@ -388,10 +380,6 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet }}
- name: Create Local Nuget
run: mkdir -p "${{ env.PULUMI_LOCAL_NUGET }}"
shell: bash
- run: dotnet nuget add source ${{ env.PULUMI_LOCAL_NUGET }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:

View file

@ -82,8 +82,6 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}
- run: mkdir -p ${{ runner.temp }}/opt/pulumi/nuget
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
@ -171,8 +169,6 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}
- run: mkdir -p ${{ runner.temp }}/opt/pulumi/nuget
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
@ -218,7 +214,6 @@ jobs:
make dist
env:
PULUMI_NODE_MODULES: ${{ runner.temp }}/opt/pulumi/node_modules
PULUMI_LOCAL_NUGET: ${{ runner.temp }}/opt/pulumi/nuget
PULUMI_ROOT: ${{ runner.temp }}/opt/pulumi
- name: Install
run: |
@ -228,13 +223,11 @@ jobs:
python -m pip install -e sdk/python/env/src
env:
PULUMI_NODE_MODULES: ${{ runner.temp }}/opt/pulumi/node_modules
PULUMI_LOCAL_NUGET: ${{ runner.temp }}/opt/pulumi/nuget
PULUMI_ROOT: ${{ runner.temp }}/opt/pulumi
- name: Test
run: make TEST_ALL_DEPS= test_all
env:
PULUMI_NODE_MODULES: ${{ runner.temp }}/opt/pulumi/node_modules
PULUMI_LOCAL_NUGET: ${{ runner.temp }}/opt/pulumi/nuget
PULUMI_ROOT: ${{ runner.temp }}/opt/pulumi
- name: Summarize Test Time by Package
run: |
@ -258,7 +251,6 @@ jobs:
runs-on: windows-latest
env:
GOPATH: ${{ github.workspace }}
PULUMI_LOCAL_NUGET: "D:\\Pulumi\\nuget"
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- name: Install DotNet ${{ matrix.dotnet }}
@ -281,10 +273,6 @@ jobs:
run: |
pip3 install pyenv-win
pip3 install pipenv
- name: Create Local Nuget
run: mkdir -p "${{ env.PULUMI_LOCAL_NUGET }}"
shell: bash
- run: dotnet nuget add source ${{ env.PULUMI_LOCAL_NUGET }}
- name: Set Build Env Vars
shell: bash
run: |

View file

@ -108,7 +108,6 @@ PIP ?= pip3
PULUMI_BIN := $(PULUMI_ROOT)/bin
PULUMI_NODE_MODULES := $(PULUMI_ROOT)/node_modules
PULUMI_NUGET := $(PULUMI_ROOT)/nuget
RUN_TESTSUITE = python3 ${PROJECT_ROOT}/scripts/run-testsuite.py
GO_TEST_FAST = PATH="$(PULUMI_BIN):$(PATH)" python3 ${PROJECT_ROOT}/scripts/go-test.py -short -count=1 -cover -tags=all -timeout 1h -parallel ${TESTPARALLELISM}
@ -170,7 +169,6 @@ install::
$(call STEP_MESSAGE)
@mkdir -p $(PULUMI_BIN)
@mkdir -p $(PULUMI_NODE_MODULES)
@mkdir -p $(PULUMI_NUGET)
dist::
$(call STEP_MESSAGE)

View file

@ -25,6 +25,7 @@ import (
"io/ioutil"
"os"
"os/exec"
"path"
"path/filepath"
"regexp"
"runtime"
@ -2005,27 +2006,25 @@ func (pt *ProgramTester) prepareDotNetProject(projinfo *engine.Projinfo) error {
return err
}
localNuget := os.Getenv("PULUMI_LOCAL_NUGET")
if localNuget == "" {
localNuget = "/opt/pulumi/nuget"
sdkDir, err := filepath.Abs(path.Join("..", "..", "sdk", "dotnet"))
if err != nil {
return err
}
for _, dep := range pt.opts.Dependencies {
// dotnet add package requires a specific version in case of a pre-release, so we have to look it up.
matches, err := filepath.Glob(filepath.Join(localNuget, dep+".?.*.nupkg"))
matches, err := filepath.Glob(filepath.Join(sdkDir, "*", dep+".csproj"))
if err != nil {
return errors.Wrap(err, "failed to find a local Pulumi NuGet package")
return errors.Wrap(err, "failed to find a local Pulumi project")
}
if len(matches) != 1 {
return errors.Errorf("attempting to find a local Pulumi NuGet package yielded %v results", matches)
return errors.Errorf("attempting to find a local Pulumi project yielded %v results", matches)
}
file := filepath.Base(matches[0])
r := strings.NewReplacer(dep+".", "", ".nupkg", "")
version := r.Replace(file)
file := matches[0]
err = pt.runCommand("dotnet-add-package",
[]string{dotNetBin, "add", "package", dep, "-v", version}, cwd)
err = pt.runCommand("dotnet-add-reference",
[]string{dotNetBin, "add", "reference", file}, cwd)
if err != nil {
return errors.Wrapf(err, "failed to add dependency on %s", dep)
}

View file

@ -38,10 +38,7 @@ install_plugin::
GOBIN=$(PULUMI_BIN) go install -ldflags "-X github.com/pulumi/pulumi/sdk/v3/go/common/version.Version=${DOTNET_VERSION}" ${LANGHOST_PKG}
install:: build install_plugin
echo "Copying NuGet packages to ${PULUMI_NUGET}"
[ ! -e "$(PULUMI_NUGET)" ] || rm -rf "$(PULUMI_NUGET)/*"
rm -f $(PULUMI_NUGET)/*.nupkg
find . -name '*${VERSION_PREFIX}*.nupkg' -exec cp -p {} ${PULUMI_NUGET} \;
dotnet pack dotnet.sln --configuration Release /p:Version=${DOTNET_VERSION}
dotnet_test:: $(TEST_ALL_DEPS)
# include the version prefix/suffix to avoid generating a separate nupkg file
@ -66,5 +63,5 @@ brew::
publish:: build install
echo "Publishing .nupkgs to nuget.org:"
find /opt/pulumi/nuget -name 'Pulumi*.nupkg' \
find . -name 'Pulumi*${VERSION_PREFIX}*.nupkg' -path '*/Release/*' \
-exec dotnet nuget push -k ${NUGET_PUBLISH_KEY} -s https://api.nuget.org/v3/index.json {} ';'

View file

@ -3,7 +3,6 @@
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Nullable>enable</Nullable>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Pulumi</Authors>
<Company>Pulumi Corp.</Company>
<Description>Pulumi Automation API, the programmatic interface for driving Pulumi programs without the CLI.</Description>

View file

@ -2,7 +2,6 @@
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Pulumi</Authors>
<Company>Pulumi Corp.</Company>
<Description>F#-specific helpers for the Pulumi .NET SDK.</Description>

View file

@ -3,7 +3,6 @@
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Nullable>enable</Nullable>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Pulumi</Authors>
<Company>Pulumi Corp.</Company>
<Description>The Pulumi .NET SDK lets you write cloud programs in C#, F#, and VB.NET.</Description>