-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
130 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,5 @@ const ( | |
File = "FILE" | ||
Function = "FUNCTION" | ||
Password = "PASSWORD" | ||
Enum = "ENUM" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package pr_test | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/pluralsh/plural-cli/pkg/pr" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestBuildCRD(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
path string | ||
envs map[string]string | ||
expectedCtx map[string]interface{} | ||
}{ | ||
{ | ||
name: "test PR automation", | ||
path: "../../test/prautomation/prautomations.yaml", | ||
envs: map[string]string{"PLURAL__NAME": "test", "PLURAL__REGION": "eu-central-1", "PLURAL__TYPE": "s3"}, | ||
expectedCtx: map[string]interface{}{ | ||
"name": "test", "region": "eu-central-1", "type": "s3", | ||
}, | ||
}, | ||
} | ||
for _, test := range tests { | ||
t.Run(test.name, func(t *testing.T) { | ||
for k, v := range test.envs { | ||
os.Setenv(k, v) | ||
} | ||
|
||
prTemplate, err := pr.BuildCRD(test.path, "") | ||
assert.NoError(t, err) | ||
assert.Equal(t, test.expectedCtx, prTemplate.Context) | ||
|
||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
apiVersion: deployments.plural.sh/v1alpha1 | ||
kind: PrAutomation | ||
metadata: | ||
name: blob-creator | ||
spec: | ||
name: blob-creator | ||
documentation: | | ||
Sets up a PR to provision a blobstore with a given type (eg s3) and region | ||
creates: | ||
templates: | ||
- source: templates/blob/stack.yaml | ||
destination: "services/blobstores/{{ context.type }}/{{ context.name }}.yaml" | ||
external: false | ||
- source: templates/blob/service.yaml | ||
destination: "bootstrap/blobstores.yaml" | ||
external: false | ||
scmConnectionRef: | ||
name: github | ||
title: "Adding a {{ context.type }} bucket {{ context.name }}" | ||
message: "Setup a stack to manage the {{ context.name }} {{ context.type }} bucket" | ||
identifier: your-org/your-plural-up-repo | ||
configuration: | ||
- name: name | ||
type: STRING | ||
documentation: the name of this blob store (if using s3, this would become an s3 bucket name) | ||
validation: | ||
regex: "[a-z][a-z-0-9]+" | ||
- name: type | ||
type: ENUM | ||
documentation: the type of blob storage to provision | ||
values: | ||
- s3 | ||
- name: region | ||
type: STRING | ||
documentation: the region your blobstore will live in |