Skip to content

Commit

Permalink
Make sourceContext optional (#427)
Browse files Browse the repository at this point in the history
In cases where a self-hosted runner is being used, the source code may
be baked into the runner. In those cases, an additional source step is
unnecessary.
  • Loading branch information
komalali authored Oct 24, 2024
1 parent b5b3c56 commit 3633bde
Show file tree
Hide file tree
Showing 13 changed files with 184 additions and 51 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
### Improvements

- Make SourceContext optional in DeploymentSettings [#427](https://github.com/pulumi/pulumi-pulumiservice/pulls/427)

In some advanced use cases, for example if your source code is baked into a custom image, or you are obtaining
the source code from a different source, you may not want to specify a `SourceContext` in your `DeploymentSettings`.

### Bug Fixes

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

func TestYamlDeploymentSettingsNoSourceExample(t *testing.T) {

// Set up tmpdir with a Pulumi.yml with no resources
// mimicking the deletion of resource
newProgram := YamlProgram{
Name: "yaml-deployment-settings-example-no-source",
Runtime: "yaml",
}

tmpdir := writePulumiYaml(t, newProgram)

cwd, _ := os.Getwd()
digits := generateRandomFiveDigits()

integration.ProgramTest(t, &integration.ProgramTestOptions{
Quick: true,
Dir: path.Join(cwd, ".", "yaml-deployment-settings-no-source"),
StackName: "test-stack-" + digits,
Config: map[string]string{
"digits": digits,
},
PrepareProject: func(_ *engine.Projinfo) error {
return nil
},
EditDirs: []integration.EditDir{
{
Dir: tmpdir,
},
// Reapply the same thing again, except this time we expect there to be no changes
{
Dir: tmpdir,
ExpectNoChanges: true,
},
},
})
}

func TestYamlTeamAccessTokenExample(t *testing.T) {
cwd, _ := os.Getwd()
integration.ProgramTest(t, &integration.ProgramTestOptions{
Expand Down
16 changes: 16 additions & 0 deletions examples/yaml-deployment-settings-no-source/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: yaml-deployment-settings-example
runtime: yaml
description: Deployment settings test
resources:
my_settings:
type: pulumiservice:DeploymentSettings
properties:
organization: service-provider-test-org
project: yaml-deployment-settings-example
stack: test-stack-${digits}
operationContext:
preRunCommands:
- yarn
- ls -al
environmentVariables:
TEST_VAR: "test-value"
Empty file.
Empty file.
8 changes: 3 additions & 5 deletions provider/cmd/pulumi-resource-pulumiservice/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@
"value": "admin"
}
]
},
},
"pulumiservice:index:TemplateSourceDestination": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -1070,8 +1070,7 @@
"required": [
"organization",
"project",
"stack",
"sourceContext"
"stack"
],
"inputProperties": {
"organization": {
Expand Down Expand Up @@ -1110,8 +1109,7 @@
"requiredInputs": [
"organization",
"project",
"stack",
"sourceContext"
"stack"
]
},
"pulumiservice:index:StackTag": {
Expand Down
6 changes: 3 additions & 3 deletions sdk/dotnet/DeploymentSettings.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 5 additions & 8 deletions sdk/go/pulumiservice/deploymentSettings.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

87 changes: 87 additions & 0 deletions sdk/go/pulumiservice/pulumiTypes.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions sdk/nodejs/deploymentSettings.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3633bde

Please sign in to comment.