Skip to content

Commit

Permalink
Fix RunPlugin and CI jobs (#396)
Browse files Browse the repository at this point in the history
Since pulumi/pulumi#17763 the pwd property is
the working directory, not the program directory. We need to fix up
RunPlugin to use both directories correctly, loading the csproj from the
program directory, but then setting the working directory to pwd.

This also updates the CI jobs to always use the latest version of the
CLI. We were running into issues because different runners happened to
have different CLI versions installed.

For now I've also disabled fail-fast on the integration tests to make
re-running them with flaky tests more likely to pass.
  • Loading branch information
Frassle authored Nov 20, 2024
1 parent e105d32 commit ef1d1af
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Bug Fixes-395.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
component: runtime
kind: Bug Fixes
body: Fix RunPlugin with new versions of the pulumi cli
time: 2024-11-20T08:26:38.629389Z
custom:
PR: "395"
5 changes: 5 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ jobs:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Install Pulumi CLI
uses: pulumi/actions@v5
with:
pulumi-version: latest
- name: Build Pulumi SDK
run: dotnet run build-sdk
- name: Workspace clean (are xml doc file updates committed?)
Expand All @@ -69,6 +71,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
integration-tests:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-12]
dotnet-version: [6.0.x, 8.0.x]
Expand All @@ -86,6 +89,8 @@ jobs:
go-version: 1.22.x
- name: Install Pulumi CLI
uses: pulumi/actions@v5
with:
pulumi-version: latest
- name: Install gotestsum
uses: jaxxstorm/[email protected]
env:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ jobs:
dotnet-quality: ga
- name: Install Pulumi CLI
uses: pulumi/actions@v5
with:
pulumi-version: latest
- name: Build Pulumi SDK
run: dotnet run build-sdk
- name: Test Pulumi SDK
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ install::
build::
cd pulumi-language-dotnet && ${GO} build .

test_integration::
test_integration:: build
cd integration_tests && gotestsum -- --parallel 1 --timeout 30m ./...

.PHONY: install build
9 changes: 6 additions & 3 deletions pulumi-language-dotnet/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -960,9 +960,12 @@ func (host *dotnetLanguageHost) RunPlugin(
default:
// Run from source.
args = append(args, "run")
if req.Program != "" {
args = append(args, "--project", req.Program)

project := req.Info.ProgramDirectory
if req.Info.EntryPoint != "" {
project = filepath.Join(project, req.Info.EntryPoint)
}
args = append(args, "--project", project)
}

// Add on all the request args to start this plugin
Expand All @@ -978,7 +981,7 @@ func (host *dotnetLanguageHost) RunPlugin(
cmd.Dir = req.Pwd
cmd.Env = req.Env
cmd.Stdout, cmd.Stderr = stdout, stderr
if err := cmd.Run(); err != nil {
if err = cmd.Run(); err != nil {
if exiterr, ok := err.(*exec.ExitError); ok {
// If the program ran, but exited with a non-zero error code. This will happen often, since user
// errors will trigger this. So, the error message should look as nice as possible.
Expand Down

0 comments on commit ef1d1af

Please sign in to comment.