Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix refresh on agent pools #395

Merged
merged 4 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@

- Fixes a bug where the `Environment` resource would print its contents on error. [#390](https://github.com/pulumi/pulumi-pulumiservice/pull/390)
- Fixes a bug where the `Environment` resource would error if a FileAsset was used. [#391](https://github.com/pulumi/pulumi-pulumiservice/pull/391)
- Fixes a bug where the `AgentPool` resource lost some outputs on `refresh`. [#395](https://github.com/pulumi/pulumi-pulumiservice/pull/395)

### Miscellaneous
14 changes: 14 additions & 0 deletions examples/examples_yaml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,20 @@ func TestYamlEnvironmentsExample(t *testing.T) {
})
}

func TestYamlAgentPoolsExample(t *testing.T) {
cwd := getCwd(t)
digits := generateRandomFiveDigits()
integration.ProgramTest(t, &integration.ProgramTestOptions{
Dir: path.Join(cwd, ".", "yaml-agent-pools"),
Config: map[string]string{
"digits": digits,
},
PrepareProject: func(p *engine.Projinfo) error {
return nil
},
})
}

func TestYamlTemplateSourcesExample(t *testing.T) {
cwd := getCwd(t)
integration.ProgramTest(t, &integration.ProgramTestOptions{
Expand Down
2 changes: 1 addition & 1 deletion examples/yaml-agent-pools/Pulumi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ resources:
type: pulumiservice:index:AgentPool
properties:
organizationName: service-provider-test-org
name: test-agent-pool
name: test-agent-pool-${digits}
description: Test agent pool

outputs:
Expand Down
8 changes: 8 additions & 0 deletions provider/pkg/provider/agent_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,14 @@ func (ap *PulumiServiceAgentPoolResource) Read(req *pulumirpc.ReadRequest) (*pul
return &pulumirpc.ReadResponse{}, nil
}

propertyMap, err := plugin.UnmarshalProperties(req.GetProperties(), plugin.MarshalOptions{KeepSecrets: true})
if err != nil {
return nil, err
}
if propertyMap["tokenValue"].HasValue() {
agentPool.TokenValue = getSecretOrStringValue(propertyMap["tokenValue"])
}

input := PulumiServiceAgentPoolInput{
OrgName: orgName,
Description: agentPool.Description,
Expand Down
Loading