Remove blueprint metadata validation (#3200)
This commit is contained in:
5
.github/workflows/linting.yml
vendored
5
.github/workflows/linting.yml
vendored
@@ -98,11 +98,6 @@ jobs:
|
||||
blueprints \
|
||||
fast
|
||||
|
||||
- name: Check blueprint metadata
|
||||
id: metadata
|
||||
run: |
|
||||
python tools/validate_metadata.py -v --failed-only blueprints
|
||||
|
||||
- name: Check modules versions
|
||||
id: versions
|
||||
run: |
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2024 Google LLC
|
||||
# Copyright 2025 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -62,12 +62,6 @@ repos:
|
||||
files: (versions.tofu|^default-versions.tofu)$
|
||||
pass_filenames: false
|
||||
entry: /usr/bin/find . -type f -name 'versions.tofu' -exec cp default-versions.tofu {} \;
|
||||
- id: validate_metadata
|
||||
name: Validate blueprints metadata
|
||||
language: system
|
||||
pass_filenames: false
|
||||
files: ^blueprints
|
||||
entry: tools/validate_metadata.py -v --failed-only blueprints
|
||||
- id: check-names
|
||||
name: Check name lengths for FAST
|
||||
language: system
|
||||
|
||||
@@ -1,174 +0,0 @@
|
||||
# Copyright 2023 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
apiVersion: blueprints.cloud.google.com/v1alpha1
|
||||
kind: BlueprintMetadata
|
||||
metadata:
|
||||
name: vertex-mlops
|
||||
spec:
|
||||
info:
|
||||
title: MLOps with Vertex AI
|
||||
source:
|
||||
repo: https://github.com/GoogleCloudPlatform/cloud-foundation-fabric.git
|
||||
dir: blueprints/data-solutions/vertex-mlops
|
||||
sourceType: git
|
||||
version: 21.0.0
|
||||
actuationTool:
|
||||
type: Terraform
|
||||
version: '>= 1.3.0'
|
||||
description:
|
||||
tagline: Create a Vertex AI environment needed for MLOps.
|
||||
detailed: |-
|
||||
This example implements the infrastructure required to deploy an end-to-end MLOps process using Vertex AI platform.
|
||||
architecture:
|
||||
- Vertex Workbench (for the experimentation environment).
|
||||
- GCP Project (optional) to host all the resources.
|
||||
- Isolated VPC network and a subnet to be used by Vertex and Dataflow. Alternatively, an external Shared VPC can be configured using the `network_config`variable.
|
||||
- Firewall rule to allow the internal subnet communication required by Dataflow.
|
||||
- Cloud NAT required to reach the internet from the different computing resources (Vertex and Dataflow).
|
||||
- GCS buckets to host Vertex AI and Cloud Build Artifacts. By default the buckets will be regional and should match the Vertex AI region for the different resources (i.e. Vertex Managed Dataset) and processes (i.e. Vertex trainining).
|
||||
- BigQuery Dataset where the training data will be stored. This is optional, since the training data could be already hosted in an existing BigQuery dataset.
|
||||
- Artifact Registry Docker repository to host the custom images.
|
||||
- Service account (`PREFIX-sa-mlops`) with the minimum permissions required by Vertex AI and Dataflow (if this service is used inside of the Vertex AI Pipeline).
|
||||
- Service account (`PREFIX-sa-github@`) to be used by Workload Identity Federation, to federate Github identity (Optional).
|
||||
- Secret Manager to store the Github SSH key to get access the CICD code repo.
|
||||
content:
|
||||
documentation:
|
||||
- title: Architecture Diagram
|
||||
url: https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/blob/master/blueprints/data-solutions/vertex-mlops/images/mlops_projects.png
|
||||
interfaces:
|
||||
variables:
|
||||
- name: notebooks
|
||||
description: Vertex AI workbenches to be deployed. Service Account runtime/instances deployed.
|
||||
type: |-
|
||||
map(object({
|
||||
type = string
|
||||
machine_type = optional(string, "n1-standard-4")
|
||||
internal_ip_only = optional(bool, true)
|
||||
idle_shutdown = optional(bool, false)
|
||||
owner = optional(string)
|
||||
}))
|
||||
required: true
|
||||
- name: project_config
|
||||
description: Provide 'billing_account_id' value if project creation is needed, uses existing 'project_id' if null. Parent is in 'folders/nnn' or 'organizations/nnn' format.
|
||||
type: |-
|
||||
object({
|
||||
billing_account_id = optional(string)
|
||||
parent = optional(string)
|
||||
project_id = string
|
||||
})
|
||||
required: true
|
||||
- name: bucket_name
|
||||
description: GCS bucket name to store the Vertex AI artifacts.
|
||||
type: string
|
||||
default: null
|
||||
required: false
|
||||
- name: dataset_name
|
||||
description: BigQuery Dataset to store the training data.
|
||||
type: string
|
||||
default: null
|
||||
required: false
|
||||
- name: groups
|
||||
description: Name of the groups (group_name@domain.org) to apply opinionated IAM permissions.
|
||||
type: |-
|
||||
object({
|
||||
gcp-ml-ds = optional(string),
|
||||
gcp-ml-eng = optional(string),
|
||||
gcp-ml-viewer = optional(string)
|
||||
})
|
||||
default: {}
|
||||
required: false
|
||||
- name: identity_pool_claims
|
||||
description: "Claims to be used by Workload Identity Federation (i.e.: attribute.repository/ORGANIZATION/REPO). If a not null value is provided, then google_iam_workload_identity_pool resource will be created."
|
||||
type: string
|
||||
default: null
|
||||
required: false
|
||||
- name: labels
|
||||
description: Labels to be assigned at project level.
|
||||
type: map(string)
|
||||
required: false
|
||||
default: {}
|
||||
- name: location
|
||||
description: Location used for multi-regional resources.
|
||||
type: string
|
||||
default: eu
|
||||
required: false
|
||||
- name: network_config
|
||||
description: Shared VPC network configurations to use. If null networks will be created in projects with preconfigured values.
|
||||
type: |-
|
||||
object({
|
||||
host_project = string
|
||||
network_self_link = string
|
||||
subnet_self_link = string
|
||||
})
|
||||
default: null
|
||||
required: false
|
||||
- name: prefix
|
||||
description: Prefix used for the project id.
|
||||
type: string
|
||||
default: null
|
||||
required: false
|
||||
- name: region
|
||||
description: Region used for regional resources.
|
||||
type: string
|
||||
default: europe-west4
|
||||
required: false
|
||||
- name: repo_name
|
||||
description: Cloud Source Repository name. null to avoid to create it.
|
||||
type: string
|
||||
default: null
|
||||
required: false
|
||||
- name: service_encryption_keys
|
||||
description: Cloud KMS to use to encrypt different services. Key location should match service region.
|
||||
type: |-
|
||||
object({
|
||||
aiplatform = optional(string)
|
||||
bq = optional(string)
|
||||
notebooks = optional(string)
|
||||
secretmanager = optional(string)
|
||||
storage = optional(string)
|
||||
})
|
||||
default: {}
|
||||
required: false
|
||||
outputs:
|
||||
- name: github
|
||||
description: Github Configuration.
|
||||
- name: notebook
|
||||
description: Vertex AI notebooks ids.
|
||||
- name: project
|
||||
description: The project resource as return by the project module.
|
||||
requirements:
|
||||
roles:
|
||||
- level: Project
|
||||
roles:
|
||||
- roles/owner
|
||||
services:
|
||||
- aiplatform.googleapis.com
|
||||
- artifactregistry.googleapis.com
|
||||
- bigquery.googleapis.com
|
||||
- bigquerystorage.googleapis.com
|
||||
- cloudbuild.googleapis.com
|
||||
- compute.googleapis.com
|
||||
- datacatalog.googleapis.com
|
||||
- dataflow.googleapis.com
|
||||
- iam.googleapis.com
|
||||
- ml.googleapis.com
|
||||
- monitoring.googleapis.com
|
||||
- notebooks.googleapis.com
|
||||
- secretmanager.googleapis.com
|
||||
- servicenetworking.googleapis.com
|
||||
- serviceusage.googleapis.com
|
||||
- stackdriver.googleapis.com
|
||||
- storage.googleapis.com
|
||||
- storage-component.googleapis.com
|
||||
@@ -1,966 +0,0 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://github.com/GoogleCloudPlatform/cloud-foundation-toolkit/cli/bpmetadata/blueprint-metadata",
|
||||
"$ref": "#/$defs/BlueprintMetadata",
|
||||
"$defs": {
|
||||
"BlueprintActuationTool": {
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object"
|
||||
},
|
||||
"BlueprintArchitecture": {
|
||||
"properties": {
|
||||
"diagram": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"diagram",
|
||||
"description"
|
||||
]
|
||||
},
|
||||
"BlueprintAuthor": {
|
||||
"properties": {
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"url": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"title"
|
||||
]
|
||||
},
|
||||
"BlueprintCloudProduct": {
|
||||
"properties": {
|
||||
"productId": {
|
||||
"type": "string"
|
||||
},
|
||||
"pageUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
"label": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"pageUrl"
|
||||
]
|
||||
},
|
||||
"BlueprintContent": {
|
||||
"properties": {
|
||||
"architecture": {
|
||||
"$ref": "#/$defs/BlueprintArchitecture"
|
||||
},
|
||||
"diagrams": {
|
||||
"items": {
|
||||
"$ref": "#/$defs/BlueprintDiagram"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"documentation": {
|
||||
"items": {
|
||||
"$ref": "#/$defs/BlueprintListContent"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"subBlueprints": {
|
||||
"items": {
|
||||
"$ref": "#/$defs/BlueprintMiscContent"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"examples": {
|
||||
"items": {
|
||||
"$ref": "#/$defs/BlueprintMiscContent"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object"
|
||||
},
|
||||
"BlueprintCostEstimate": {
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"url": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"description",
|
||||
"url"
|
||||
]
|
||||
},
|
||||
"BlueprintDescription": {
|
||||
"properties": {
|
||||
"tagline": {
|
||||
"type": "string"
|
||||
},
|
||||
"detailed": {
|
||||
"type": "string"
|
||||
},
|
||||
"preDeploy": {
|
||||
"type": "string"
|
||||
},
|
||||
"html": {
|
||||
"type": "string"
|
||||
},
|
||||
"eulaUrls": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"architecture": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object"
|
||||
},
|
||||
"BlueprintDiagram": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"altText": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
]
|
||||
},
|
||||
"BlueprintInfo": {
|
||||
"properties": {
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"source": {
|
||||
"$ref": "#/$defs/BlueprintRepoDetail"
|
||||
},
|
||||
"version": {
|
||||
"type": "string"
|
||||
},
|
||||
"actuationTool": {
|
||||
"$ref": "#/$defs/BlueprintActuationTool"
|
||||
},
|
||||
"description": {
|
||||
"$ref": "#/$defs/BlueprintDescription"
|
||||
},
|
||||
"icon": {
|
||||
"type": "string"
|
||||
},
|
||||
"deploymentDuration": {
|
||||
"$ref": "#/$defs/BlueprintTimeEstimate"
|
||||
},
|
||||
"costEstimate": {
|
||||
"$ref": "#/$defs/BlueprintCostEstimate"
|
||||
},
|
||||
"cloudProducts": {
|
||||
"items": {
|
||||
"$ref": "#/$defs/BlueprintCloudProduct"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"quotaDetails": {
|
||||
"items": {
|
||||
"$ref": "#/$defs/BlueprintQuotaDetail"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"author": {
|
||||
"$ref": "#/$defs/BlueprintAuthor"
|
||||
},
|
||||
"softwareGroups": {
|
||||
"items": {
|
||||
"$ref": "#/$defs/BlueprintSoftwareGroup"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"supportInfo": {
|
||||
"$ref": "#/$defs/BlueprintSupport"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"title",
|
||||
"source"
|
||||
]
|
||||
},
|
||||
"BlueprintInterface": {
|
||||
"properties": {
|
||||
"variables": {
|
||||
"items": {
|
||||
"$ref": "#/$defs/BlueprintVariable"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"variableGroups": {
|
||||
"items": {
|
||||
"$ref": "#/$defs/BlueprintVariableGroup"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"outputs": {
|
||||
"items": {
|
||||
"$ref": "#/$defs/BlueprintOutput"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object"
|
||||
},
|
||||
"BlueprintListContent": {
|
||||
"properties": {
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"url": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"title"
|
||||
]
|
||||
},
|
||||
"BlueprintMetadata": {
|
||||
"properties": {
|
||||
"apiVersion": {
|
||||
"type": "string"
|
||||
},
|
||||
"kind": {
|
||||
"type": "string"
|
||||
},
|
||||
"metadata": {
|
||||
"$ref": "#/$defs/ObjectMeta"
|
||||
},
|
||||
"spec": {
|
||||
"$ref": "#/$defs/BlueprintMetadataSpec"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"spec"
|
||||
]
|
||||
},
|
||||
"BlueprintMetadataSpec": {
|
||||
"properties": {
|
||||
"info": {
|
||||
"$ref": "#/$defs/BlueprintInfo"
|
||||
},
|
||||
"content": {
|
||||
"$ref": "#/$defs/BlueprintContent"
|
||||
},
|
||||
"interfaces": {
|
||||
"$ref": "#/$defs/BlueprintInterface"
|
||||
},
|
||||
"requirements": {
|
||||
"$ref": "#/$defs/BlueprintRequirements"
|
||||
},
|
||||
"ui": {
|
||||
"$ref": "#/$defs/BlueprintUI"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object"
|
||||
},
|
||||
"BlueprintMiscContent": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"location": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
]
|
||||
},
|
||||
"BlueprintOutput": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
]
|
||||
},
|
||||
"BlueprintQuotaDetail": {
|
||||
"properties": {
|
||||
"variable": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"GCE_INSTANCE",
|
||||
"GCE_DISK"
|
||||
]
|
||||
},
|
||||
"quotaType": {
|
||||
"patternProperties": {
|
||||
".*": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"type",
|
||||
"quotaType"
|
||||
]
|
||||
},
|
||||
"BlueprintRepoDetail": {
|
||||
"properties": {
|
||||
"repo": {
|
||||
"type": "string"
|
||||
},
|
||||
"sourceType": {
|
||||
"type": "string"
|
||||
},
|
||||
"dir": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"repo",
|
||||
"sourceType"
|
||||
]
|
||||
},
|
||||
"BlueprintRequirements": {
|
||||
"properties": {
|
||||
"roles": {
|
||||
"items": {
|
||||
"$ref": "#/$defs/BlueprintRoles"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"services": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object"
|
||||
},
|
||||
"BlueprintRoles": {
|
||||
"properties": {
|
||||
"level": {
|
||||
"type": "string"
|
||||
},
|
||||
"roles": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"level",
|
||||
"roles"
|
||||
]
|
||||
},
|
||||
"BlueprintSoftware": {
|
||||
"properties": {
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"type": "string"
|
||||
},
|
||||
"url": {
|
||||
"type": "string"
|
||||
},
|
||||
"licenseUrl": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"title"
|
||||
]
|
||||
},
|
||||
"BlueprintSoftwareGroup": {
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"UNSPECIFIED",
|
||||
"OS"
|
||||
]
|
||||
},
|
||||
"software": {
|
||||
"items": {
|
||||
"$ref": "#/$defs/BlueprintSoftware"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object"
|
||||
},
|
||||
"BlueprintSupport": {
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"url": {
|
||||
"type": "string"
|
||||
},
|
||||
"entity": {
|
||||
"type": "string"
|
||||
},
|
||||
"showSupportId": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"description"
|
||||
]
|
||||
},
|
||||
"BlueprintTimeEstimate": {
|
||||
"properties": {
|
||||
"configuration": {
|
||||
"type": "integer"
|
||||
},
|
||||
"deployment": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object"
|
||||
},
|
||||
"BlueprintUI": {
|
||||
"properties": {
|
||||
"input": {
|
||||
"$ref": "#/$defs/BlueprintUIInput"
|
||||
},
|
||||
"runtime": {
|
||||
"$ref": "#/$defs/BlueprintUIOutput"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object"
|
||||
},
|
||||
"BlueprintUIInput": {
|
||||
"properties": {
|
||||
"variables": {
|
||||
"patternProperties": {
|
||||
".*": {
|
||||
"$ref": "#/$defs/DisplayVariable"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"sections": {
|
||||
"items": {
|
||||
"$ref": "#/$defs/DisplaySection"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object"
|
||||
},
|
||||
"BlueprintUIOutput": {
|
||||
"properties": {
|
||||
"outputMessage": {
|
||||
"type": "string"
|
||||
},
|
||||
"suggestedActions": {
|
||||
"items": {
|
||||
"$ref": "#/$defs/UIActionItem"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object"
|
||||
},
|
||||
"BlueprintVariable": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"default": true,
|
||||
"required": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object"
|
||||
},
|
||||
"BlueprintVariableGroup": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"variables": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
]
|
||||
},
|
||||
"DisplaySection": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"tooltip": {
|
||||
"type": "string"
|
||||
},
|
||||
"subtext": {
|
||||
"type": "string"
|
||||
},
|
||||
"parent": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
]
|
||||
},
|
||||
"DisplayVariable": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"invisible": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"tooltip": {
|
||||
"type": "string"
|
||||
},
|
||||
"placeholder": {
|
||||
"type": "string"
|
||||
},
|
||||
"regexValidation": {
|
||||
"type": "string"
|
||||
},
|
||||
"minItems": {
|
||||
"type": "integer"
|
||||
},
|
||||
"maxItems": {
|
||||
"type": "integer"
|
||||
},
|
||||
"minLength": {
|
||||
"type": "integer"
|
||||
},
|
||||
"maxLength": {
|
||||
"type": "integer"
|
||||
},
|
||||
"min": {
|
||||
"type": "integer"
|
||||
},
|
||||
"max": {
|
||||
"type": "integer"
|
||||
},
|
||||
"section": {
|
||||
"type": "string"
|
||||
},
|
||||
"x-googleProperty": {
|
||||
"$ref": "#/$defs/GooglePropertyExtension"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
]
|
||||
},
|
||||
"GCEDiskSizeExtension": {
|
||||
"properties": {
|
||||
"diskTypeVariable": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"diskTypeVariable"
|
||||
]
|
||||
},
|
||||
"GCEExternalIPExtension": {
|
||||
"properties": {
|
||||
"networkVariable": {
|
||||
"type": "string"
|
||||
},
|
||||
"externalIpType": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"networkVariable"
|
||||
]
|
||||
},
|
||||
"GCEFirewallExtension": {
|
||||
"properties": {
|
||||
"networkVariable": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"networkVariable"
|
||||
]
|
||||
},
|
||||
"GCEFirewallRangeExtension": {
|
||||
"properties": {
|
||||
"firewallVariable": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"firewallVariable"
|
||||
]
|
||||
},
|
||||
"GCEGPUCountExtension": {
|
||||
"properties": {
|
||||
"machineTypeVariable": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"machineTypeVariable"
|
||||
]
|
||||
},
|
||||
"GCEGPUTypeExtension": {
|
||||
"properties": {
|
||||
"machineType": {
|
||||
"type": "string"
|
||||
},
|
||||
"gpuType": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"machineType"
|
||||
]
|
||||
},
|
||||
"GCEGenericResourceExtension": {
|
||||
"properties": {
|
||||
"resourceVariable": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"resourceVariable"
|
||||
]
|
||||
},
|
||||
"GCEIPForwardingExtension": {
|
||||
"properties": {
|
||||
"networkVariable": {
|
||||
"type": "string"
|
||||
},
|
||||
"notConfigurable": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"networkVariable"
|
||||
]
|
||||
},
|
||||
"GCELocationExtension": {
|
||||
"properties": {
|
||||
"allowlistedZones": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"allowlistedRegions": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object"
|
||||
},
|
||||
"GCEMachineTypeExtension": {
|
||||
"properties": {
|
||||
"minCpu": {
|
||||
"type": "integer"
|
||||
},
|
||||
"minRamGb": {
|
||||
"type": "integer"
|
||||
},
|
||||
"disallowCustomMachineTypes": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object"
|
||||
},
|
||||
"GCENetworkExtension": {
|
||||
"properties": {
|
||||
"allowSharedVpcs": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"machineTypeVariable": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"machineTypeVariable"
|
||||
]
|
||||
},
|
||||
"GCESubnetworkExtension": {
|
||||
"properties": {
|
||||
"networkVariable": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"networkVariable"
|
||||
]
|
||||
},
|
||||
"GooglePropertyExtension": {
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"EMAIL_ADDRESS",
|
||||
"MULTI_LINE_STRING",
|
||||
"GCE_DISK_IMAGE",
|
||||
"GCE_DISK_TYPE",
|
||||
"GCE_DISK_SIZE",
|
||||
"GCE_MACHINE_TYPE",
|
||||
"GCE_NETWORK",
|
||||
"GCE_ZONE",
|
||||
"GCE_SUBNETWORK",
|
||||
"GCE_REGION",
|
||||
"GCE_GPU_TYPE",
|
||||
"GCE_GPU_COUNT",
|
||||
"GCE_EXTERNAL_IP",
|
||||
"GCE_IP_FORWARDING",
|
||||
"GCE_FIREWALL",
|
||||
"GCE_FIREWALL_RANGE",
|
||||
"GCE_GENERIC_RESOURCE",
|
||||
"GCS_BUCKET",
|
||||
"IAM_SERVICE_ACCOUNT"
|
||||
]
|
||||
},
|
||||
"zoneProperty": {
|
||||
"type": "string"
|
||||
},
|
||||
"gceMachineType": {
|
||||
"$ref": "#/$defs/GCEMachineTypeExtension"
|
||||
},
|
||||
"gceDiskSize": {
|
||||
"$ref": "#/$defs/GCEDiskSizeExtension"
|
||||
},
|
||||
"gceSubnetwork": {
|
||||
"$ref": "#/$defs/GCESubnetworkExtension"
|
||||
},
|
||||
"gceResource": {
|
||||
"$ref": "#/$defs/GCEGenericResourceExtension"
|
||||
},
|
||||
"gceGpuType": {
|
||||
"$ref": "#/$defs/GCEGPUTypeExtension"
|
||||
},
|
||||
"gceGpuCount": {
|
||||
"$ref": "#/$defs/GCEGPUCountExtension"
|
||||
},
|
||||
"gceNetwork": {
|
||||
"$ref": "#/$defs/GCENetworkExtension"
|
||||
},
|
||||
"gceExternalIp": {
|
||||
"$ref": "#/$defs/GCEExternalIPExtension"
|
||||
},
|
||||
"gceIpForwarding": {
|
||||
"$ref": "#/$defs/GCEIPForwardingExtension"
|
||||
},
|
||||
"gceFirewall": {
|
||||
"$ref": "#/$defs/GCEFirewallExtension"
|
||||
},
|
||||
"gceFirewallRange": {
|
||||
"$ref": "#/$defs/GCEFirewallRangeExtension"
|
||||
},
|
||||
"gceZone": {
|
||||
"$ref": "#/$defs/GCELocationExtension"
|
||||
},
|
||||
"gceRegion": {
|
||||
"$ref": "#/$defs/GCELocationExtension"
|
||||
},
|
||||
"iamServiceAccount": {
|
||||
"$ref": "#/$defs/IAMServiceAccountExtension"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"type"
|
||||
]
|
||||
},
|
||||
"IAMServiceAccountExtension": {
|
||||
"properties": {
|
||||
"roles": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"roles"
|
||||
]
|
||||
},
|
||||
"ObjectMeta": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"namespace": {
|
||||
"type": "string"
|
||||
},
|
||||
"labels": {
|
||||
"patternProperties": {
|
||||
".*": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"annotations": {
|
||||
"patternProperties": {
|
||||
".*": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object"
|
||||
},
|
||||
"UIActionItem": {
|
||||
"properties": {
|
||||
"heading": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"snippet": {
|
||||
"type": "string"
|
||||
},
|
||||
"showIf": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"heading"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,8 +36,5 @@ yapf -p -d -r \
|
||||
tools/*.py \
|
||||
blueprints
|
||||
|
||||
echo -- Blueprint metadata --
|
||||
python3 tools/validate_metadata.py -v blueprints --verbose --failed-only
|
||||
|
||||
echo -- Version checks --
|
||||
find . -type f -name 'versions.tf' -exec diff -I '[[:space:]]*module_name' -ub default-versions.tf {} \;
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright 2023 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
'''Validate a YAML file against the standard blueprint metadata schema[1]
|
||||
|
||||
[1] https://github.com/GoogleCloudPlatform/cloud-foundation-toolkit/blob/master/cli/bpmetadata/schema/bpmetadataschema.json
|
||||
'''
|
||||
|
||||
import enum
|
||||
import json
|
||||
import sys
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
import click
|
||||
import jsonschema
|
||||
import yaml
|
||||
|
||||
SCHEMA_PATH = Path(__file__).parent / 'bpmetadataschema.json'
|
||||
|
||||
|
||||
class State(enum.Enum):
|
||||
INVALID: int = 0
|
||||
OK: int = 1
|
||||
|
||||
|
||||
@dataclass
|
||||
class ValidationResult:
|
||||
state: State
|
||||
errors: dict[str, str]
|
||||
|
||||
|
||||
def _validate(path: Path, validator) -> ValidationResult:
|
||||
with open(path) as f:
|
||||
metadata = yaml.safe_load(f)
|
||||
|
||||
errors = {
|
||||
error.json_path: error.message
|
||||
for error in validator.iter_errors(metadata)
|
||||
}
|
||||
|
||||
state = State.OK if not errors else State.INVALID
|
||||
return ValidationResult(state=state, errors=errors)
|
||||
|
||||
|
||||
@click.command()
|
||||
@click.argument('dirs', type=click.Path(exists=True, file_okay=False), nargs=-1)
|
||||
@click.option('-v', '--verbose', is_flag=True, default=False,
|
||||
help='Print additional validation details.')
|
||||
@click.option('--failed-only', is_flag=True, default=False)
|
||||
def main(dirs: list[str], verbose: bool, failed_only=False) -> int:
|
||||
instances = set()
|
||||
for dir_name in dirs:
|
||||
instances |= set(Path(dir_name).glob("**/metadata.yaml"))
|
||||
|
||||
with open(SCHEMA_PATH) as f:
|
||||
schema = json.load(f)
|
||||
validator = jsonschema.validators.Draft202012Validator(schema)
|
||||
|
||||
failed_files = {}
|
||||
for instance in instances:
|
||||
result = _validate(instance, validator)
|
||||
if result.state == State.OK:
|
||||
if not failed_only:
|
||||
print(f'[✓] {instance}')
|
||||
else:
|
||||
print(f'[✗] {instance}')
|
||||
failed_files[instance] = result.errors
|
||||
|
||||
if verbose:
|
||||
for file_path, errors in failed_files.items():
|
||||
print(f"\n====== {file_path!s} ======")
|
||||
for path, message in errors.items():
|
||||
print(f"{path}: {message}")
|
||||
|
||||
return 0 if not failed_files else 1
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user