Skip to content

Commit

Permalink
Merge branch 'master' into apeabody-patch-11
Browse files Browse the repository at this point in the history
  • Loading branch information
apeabody authored Jul 16, 2024
2 parents 85f91e0 + 2883b3f commit b4bb26b
Show file tree
Hide file tree
Showing 5 changed files with 154 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cli/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
SHELL := /bin/bash

# Changing this value will trigger a new release
VERSION=v1.3.6
VERSION=v1.4.0
BINARY=bin/cft
GITHUB_REPO=github.com/GoogleCloudPlatform/cloud-foundation-toolkit
PLATFORMS := linux windows darwin
Expand Down
98 changes: 97 additions & 1 deletion cli/bpmetadata/schema/gcp-blueprint-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,18 @@
"pageUrl"
]
},
"BlueprintConnection": {
"properties": {
"source": {
"$ref": "#/$defs/ConnectionSource"
},
"spec": {
"$ref": "#/$defs/ConnectionSpec"
}
},
"additionalProperties": false,
"type": "object"
},
"BlueprintContent": {
"properties": {
"architecture": {
Expand Down Expand Up @@ -357,7 +369,8 @@
},
"description": {
"type": "string"
}
},
"type": true
},
"additionalProperties": false,
"type": "object",
Expand Down Expand Up @@ -426,6 +439,12 @@
"type": "string"
},
"type": "array"
},
"versions": {
"items": {
"$ref": "#/$defs/ProviderVersion"
},
"type": "array"
}
},
"additionalProperties": false,
Expand Down Expand Up @@ -597,6 +616,12 @@
"defaultValue": true,
"required": {
"type": "boolean"
},
"connections": {
"items": {
"$ref": "#/$defs/BlueprintConnection"
},
"type": "array"
}
},
"additionalProperties": false,
Expand Down Expand Up @@ -645,6 +670,30 @@
"title"
]
},
"ConnectionSource": {
"properties": {
"source": {
"type": "string"
},
"version": {
"type": "string"
}
},
"additionalProperties": false,
"type": "object"
},
"ConnectionSpec": {
"properties": {
"outputExpr": {
"type": "string"
},
"inputPath": {
"type": "string"
}
},
"additionalProperties": false,
"type": "object"
},
"DisplayOutput": {
"properties": {
"openInNewTab": {
Expand All @@ -655,6 +704,16 @@
},
"label": {
"type": "string"
},
"visibility": {
"oneOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
}
},
"additionalProperties": false,
Expand Down Expand Up @@ -745,6 +804,12 @@
},
"booleanGroup": {
"type": "string"
},
"altDefaults": {
"items": {
"$ref": "#/$defs/DisplayVariable_AlternateDefault"
},
"type": "array"
}
},
"additionalProperties": false,
Expand All @@ -754,6 +819,25 @@
"title"
]
},
"DisplayVariable_AlternateDefault": {
"properties": {
"type": {
"oneOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
},
"value": {
"$ref": "#/$defs/Value"
}
},
"additionalProperties": false,
"type": "object"
},
"GCEDiskSizeExtension": {
"properties": {
"diskTypeVariable": {
Expand Down Expand Up @@ -1060,6 +1144,18 @@
"roles"
]
},
"ProviderVersion": {
"properties": {
"source": {
"type": "string"
},
"version": {
"type": "string"
}
},
"additionalProperties": false,
"type": "object"
},
"ResourceTypeMeta": {
"properties": {
"name": {
Expand Down
6 changes: 6 additions & 0 deletions cli/bpmetadata/schema/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ func GenerateSchema() ([]byte, error) {
if defExists {
vDef.Properties.Set("defaultValue", jsonschema.TrueSchema)
}
// JSON schema seems to infer google.protobuf.Value as object type
// so we use the same workaround as above.
oDef, defExists := s.Definitions["BlueprintOutput"]
if defExists {
oDef.Properties.Set("type", jsonschema.TrueSchema)
}

sData, err := json.MarshalIndent(s, "", " ")
if err != nil {
Expand Down
5 changes: 5 additions & 0 deletions cli/bpmetadata/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ func TestValidateMetadata(t *testing.T) {
path: "valid-metadata.yaml",
wantErr: false,
},
{
name: "valid metadata with connections",
path: "valid-metadata-connections.yaml",
wantErr: false,
},
{
name: "invalid metadata - title missing",
path: "invalid-metadata.yaml",
Expand Down
45 changes: 45 additions & 0 deletions cli/testdata/bpmetadata/schema/valid-metadata-connections.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
apiVersion: blueprints.cloud.google.com/v1alpha1
kind: BlueprintMetadata
metadata:
name: terraform-google-module
spec:
info:
title: Terraform Google Module
source:
repo: https://github.com/GoogleCloudPlatform/terraform-google-module.git
sourceType: git
interfaces:
variables:
- name: foo
connections:
- source:
source: "GoogleCloudPlatform/terraform-google-module1"
version: "~> v1"
spec:
outputExpr: "field1"
inputPath: "nested.field"
- name: bar
connections:
- source:
source: "GoogleCloudPlatform/terraform-google-module1"
version: "~> v1"
spec:
outputExpr: "field1"
- source:
source: "GoogleCloudPlatform/terraform-google-module1"
version: "~> v2"
spec:
outputExpr: "field2"
- name: baz
outputs:
- name: qux
type: [
"object",
{
"VAR1": "string",
"VAR2": "number"
}
]



0 comments on commit b4bb26b

Please sign in to comment.