runway.cfngin.hooks.staticsite.build_staticsite module

CFNgin hook for building static website.

pydantic model runway.cfngin.hooks.staticsite.build_staticsite.HookArgs[source]

Bases: HookArgsBaseModel

Hook arguments.

Show JSON schema
{
   "title": "HookArgs",
   "description": "Hook arguments.",
   "type": "object",
   "properties": {
      "tags": {
         "additionalProperties": {
            "type": "string"
         },
         "default": {},
         "title": "Tags",
         "type": "object"
      },
      "artifact_bucket_rxref_lookup": {
         "title": "Artifact Bucket Rxref Lookup",
         "type": "string"
      },
      "options": {
         "$ref": "#/$defs/HookArgsOptions"
      }
   },
   "$defs": {
      "HookArgsOptions": {
         "description": "Hook arguments ``options`` block.",
         "properties": {
            "tags": {
               "additionalProperties": {
                  "type": "string"
               },
               "default": {},
               "title": "Tags",
               "type": "object"
            },
            "build_output": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Build Output"
            },
            "build_steps": {
               "default": [],
               "items": {
                  "anyOf": [
                     {
                        "type": "string"
                     },
                     {
                        "items": {
                           "type": "string"
                        },
                        "type": "array"
                     },
                     {
                        "additionalProperties": {
                           "anyOf": [
                              {
                                 "type": "string"
                              },
                              {
                                 "items": {
                                    "type": "string"
                                 },
                                 "type": "array"
                              }
                           ]
                        },
                        "type": "object"
                     }
                  ]
               },
               "title": "Build Steps",
               "type": "array"
            },
            "name": {
               "default": "undefined",
               "title": "Name",
               "type": "string"
            },
            "namespace": {
               "title": "Namespace",
               "type": "string"
            },
            "path": {
               "title": "Path",
               "type": "string"
            },
            "pre_build_steps": {
               "default": [],
               "items": {
                  "anyOf": [
                     {
                        "type": "string"
                     },
                     {
                        "items": {
                           "type": "string"
                        },
                        "type": "array"
                     },
                     {
                        "additionalProperties": {
                           "anyOf": [
                              {
                                 "type": "string"
                              },
                              {
                                 "items": {
                                    "type": "string"
                                 },
                                 "type": "array"
                              }
                           ]
                        },
                        "type": "object"
                     }
                  ]
               },
               "title": "Pre Build Steps",
               "type": "array"
            },
            "source_hashing": {
               "$ref": "#/$defs/RunwayStaticSiteSourceHashingDataModel",
               "default": {
                  "directories": [
                     {
                        "exclusions": [],
                        "path": "."
                     }
                  ],
                  "enabled": true,
                  "parameter": null
               }
            }
         },
         "required": [
            "namespace",
            "path"
         ],
         "title": "HookArgsOptions",
         "type": "object"
      },
      "RunwayStaticSiteSourceHashingDataModel": {
         "additionalProperties": false,
         "description": "Model for Runway static site Module source_hashing option.",
         "properties": {
            "directories": {
               "default": [
                  {
                     "exclusions": [],
                     "path": "."
                  }
               ],
               "items": {
                  "$ref": "#/$defs/RunwayStaticSiteSourceHashingDirectoryDataModel"
               },
               "title": "Directories",
               "type": "array"
            },
            "enabled": {
               "default": true,
               "title": "Enabled",
               "type": "boolean"
            },
            "parameter": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Parameter"
            }
         },
         "title": "Runway static site Module source_hashing option",
         "type": "object"
      },
      "RunwayStaticSiteSourceHashingDirectoryDataModel": {
         "additionalProperties": false,
         "description": "Model for Runway static site Module source_hashing.directory option item.",
         "properties": {
            "exclusions": {
               "default": [],
               "items": {
                  "type": "string"
               },
               "title": "Exclusions",
               "type": "array"
            },
            "path": {
               "format": "path",
               "title": "Path",
               "type": "string"
            }
         },
         "required": [
            "path"
         ],
         "title": "Runway static site Module source_hashing.directories option item",
         "type": "object"
      }
   },
   "required": [
      "artifact_bucket_rxref_lookup",
      "options"
   ]
}

field artifact_bucket_rxref_lookup: str = PydanticUndefined

Query for RxrefLookup to get artifact bucket.

field options: HookArgsOptions = PydanticUndefined

Hook options block.

pydantic model runway.cfngin.hooks.staticsite.build_staticsite.HookArgsOptions[source]

Bases: HookArgsBaseModel

Hook arguments options block.

Show JSON schema
{
   "title": "HookArgsOptions",
   "description": "Hook arguments ``options`` block.",
   "type": "object",
   "properties": {
      "tags": {
         "additionalProperties": {
            "type": "string"
         },
         "default": {},
         "title": "Tags",
         "type": "object"
      },
      "build_output": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Build Output"
      },
      "build_steps": {
         "default": [],
         "items": {
            "anyOf": [
               {
                  "type": "string"
               },
               {
                  "items": {
                     "type": "string"
                  },
                  "type": "array"
               },
               {
                  "additionalProperties": {
                     "anyOf": [
                        {
                           "type": "string"
                        },
                        {
                           "items": {
                              "type": "string"
                           },
                           "type": "array"
                        }
                     ]
                  },
                  "type": "object"
               }
            ]
         },
         "title": "Build Steps",
         "type": "array"
      },
      "name": {
         "default": "undefined",
         "title": "Name",
         "type": "string"
      },
      "namespace": {
         "title": "Namespace",
         "type": "string"
      },
      "path": {
         "title": "Path",
         "type": "string"
      },
      "pre_build_steps": {
         "default": [],
         "items": {
            "anyOf": [
               {
                  "type": "string"
               },
               {
                  "items": {
                     "type": "string"
                  },
                  "type": "array"
               },
               {
                  "additionalProperties": {
                     "anyOf": [
                        {
                           "type": "string"
                        },
                        {
                           "items": {
                              "type": "string"
                           },
                           "type": "array"
                        }
                     ]
                  },
                  "type": "object"
               }
            ]
         },
         "title": "Pre Build Steps",
         "type": "array"
      },
      "source_hashing": {
         "$ref": "#/$defs/RunwayStaticSiteSourceHashingDataModel",
         "default": {
            "directories": [
               {
                  "exclusions": [],
                  "path": "."
               }
            ],
            "enabled": true,
            "parameter": null
         }
      }
   },
   "$defs": {
      "RunwayStaticSiteSourceHashingDataModel": {
         "additionalProperties": false,
         "description": "Model for Runway static site Module source_hashing option.",
         "properties": {
            "directories": {
               "default": [
                  {
                     "exclusions": [],
                     "path": "."
                  }
               ],
               "items": {
                  "$ref": "#/$defs/RunwayStaticSiteSourceHashingDirectoryDataModel"
               },
               "title": "Directories",
               "type": "array"
            },
            "enabled": {
               "default": true,
               "title": "Enabled",
               "type": "boolean"
            },
            "parameter": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Parameter"
            }
         },
         "title": "Runway static site Module source_hashing option",
         "type": "object"
      },
      "RunwayStaticSiteSourceHashingDirectoryDataModel": {
         "additionalProperties": false,
         "description": "Model for Runway static site Module source_hashing.directory option item.",
         "properties": {
            "exclusions": {
               "default": [],
               "items": {
                  "type": "string"
               },
               "title": "Exclusions",
               "type": "array"
            },
            "path": {
               "format": "path",
               "title": "Path",
               "type": "string"
            }
         },
         "required": [
            "path"
         ],
         "title": "Runway static site Module source_hashing.directories option item",
         "type": "object"
      }
   },
   "required": [
      "namespace",
      "path"
   ]
}

field build_output: str | None = None

Path were the build static site will be stored locally before upload.

field build_steps: list[str | list[str] | dict[str, str | list[str]]] = []

Steps to execute to build the static site.

field name: str = 'undefined'

Static site name.

field namespace: str = PydanticUndefined

Namespace of the static site.

field path: str = PydanticUndefined

Working directory/path to the static site’s source code.

field pre_build_steps: list[str | list[str] | dict[str, str | list[str]]] = []

Steps to run before building the static site.

field source_hashing: RunwayStaticSiteSourceHashingDataModel = RunwayStaticSiteSourceHashingDataModel(directories=[RunwayStaticSiteSourceHashingDirectoryDataModel(exclusions=[], path=PosixPath('.'))], enabled=True, parameter=None)

Settings for tracking the hash of the source code between runs.

class runway.cfngin.hooks.staticsite.build_staticsite.OptionsArgTypeDef[source]

Bases: TypedDict

Options argument type definition.

runway.cfngin.hooks.staticsite.build_staticsite.build(context: CfnginContext, provider: Provider, *, options: OptionsArgTypeDef | None = None, **kwargs: Any) dict[str, Any][source]

Build static site.

Arguments parsed by HookArgs.

runway.cfngin.hooks.staticsite.build_staticsite.zip_and_upload(app_dir: str, bucket: str, key: str, session: Session | None = None) None[source]

Zip built static site and upload to S3.