spaceforge 0.1.0.dev0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- spaceforge-0.1.0.dev0/.github/workflows/release.yml +95 -0
- spaceforge-0.1.0.dev0/.gitignore +196 -0
- spaceforge-0.1.0.dev0/LICENSE +21 -0
- spaceforge-0.1.0.dev0/MANIFEST.in +6 -0
- spaceforge-0.1.0.dev0/PKG-INFO +163 -0
- spaceforge-0.1.0.dev0/README.md +120 -0
- spaceforge-0.1.0.dev0/full_plugin_example.yaml +170 -0
- spaceforge-0.1.0.dev0/plugins/wiz/plugin.py +161 -0
- spaceforge-0.1.0.dev0/plugins/wiz/plugin.yaml +206 -0
- spaceforge-0.1.0.dev0/pyproject.toml +85 -0
- spaceforge-0.1.0.dev0/requirements.txt +3 -0
- spaceforge-0.1.0.dev0/setup.cfg +4 -0
- spaceforge-0.1.0.dev0/setup.py +71 -0
- spaceforge-0.1.0.dev0/spaceforge/README.md +279 -0
- spaceforge-0.1.0.dev0/spaceforge/__init__.py +23 -0
- spaceforge-0.1.0.dev0/spaceforge/__main__.py +33 -0
- spaceforge-0.1.0.dev0/spaceforge/_version.py +81 -0
- spaceforge-0.1.0.dev0/spaceforge/cls.py +198 -0
- spaceforge-0.1.0.dev0/spaceforge/cls_test.py +17 -0
- spaceforge-0.1.0.dev0/spaceforge/generator.py +362 -0
- spaceforge-0.1.0.dev0/spaceforge/generator_test.py +671 -0
- spaceforge-0.1.0.dev0/spaceforge/plugin.py +275 -0
- spaceforge-0.1.0.dev0/spaceforge/plugin_test.py +621 -0
- spaceforge-0.1.0.dev0/spaceforge/runner.py +115 -0
- spaceforge-0.1.0.dev0/spaceforge/runner_test.py +605 -0
- spaceforge-0.1.0.dev0/spaceforge/schema.json +371 -0
- spaceforge-0.1.0.dev0/spaceforge.egg-info/PKG-INFO +163 -0
- spaceforge-0.1.0.dev0/spaceforge.egg-info/SOURCES.txt +31 -0
- spaceforge-0.1.0.dev0/spaceforge.egg-info/dependency_links.txt +1 -0
- spaceforge-0.1.0.dev0/spaceforge.egg-info/entry_points.txt +2 -0
- spaceforge-0.1.0.dev0/spaceforge.egg-info/not-zip-safe +1 -0
- spaceforge-0.1.0.dev0/spaceforge.egg-info/requires.txt +12 -0
- spaceforge-0.1.0.dev0/spaceforge.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
name: Release to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
id-token: write # Required for trusted publishing to PyPI
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
strategy:
|
|
16
|
+
matrix:
|
|
17
|
+
python-version: ['3.10', '3.11']
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
with:
|
|
22
|
+
fetch-depth: 0 # Fetch full history for setuptools-scm
|
|
23
|
+
|
|
24
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
25
|
+
uses: actions/setup-python@v5
|
|
26
|
+
with:
|
|
27
|
+
python-version: ${{ matrix.python-version }}
|
|
28
|
+
|
|
29
|
+
- name: Install dependencies
|
|
30
|
+
run: |
|
|
31
|
+
python -m pip install --upgrade pip
|
|
32
|
+
pip install -e .[dev]
|
|
33
|
+
|
|
34
|
+
- name: Run tests
|
|
35
|
+
run: |
|
|
36
|
+
python -m pytest spaceforge/ -v
|
|
37
|
+
|
|
38
|
+
- name: Run type checking
|
|
39
|
+
run: |
|
|
40
|
+
python -m mypy spaceforge/
|
|
41
|
+
|
|
42
|
+
- name: Check code formatting
|
|
43
|
+
run: |
|
|
44
|
+
python -m black --check spaceforge/
|
|
45
|
+
python -m isort --check-only spaceforge/
|
|
46
|
+
|
|
47
|
+
build:
|
|
48
|
+
needs: test
|
|
49
|
+
runs-on: ubuntu-latest
|
|
50
|
+
|
|
51
|
+
steps:
|
|
52
|
+
- uses: actions/checkout@v4
|
|
53
|
+
with:
|
|
54
|
+
fetch-depth: 0 # Fetch full history for setuptools-scm
|
|
55
|
+
|
|
56
|
+
- name: Set up Python
|
|
57
|
+
uses: actions/setup-python@v5
|
|
58
|
+
with:
|
|
59
|
+
python-version: '3.11'
|
|
60
|
+
|
|
61
|
+
- name: Install build dependencies
|
|
62
|
+
run: |
|
|
63
|
+
python -m pip install --upgrade pip
|
|
64
|
+
pip install build setuptools-scm[toml]
|
|
65
|
+
|
|
66
|
+
- name: Build package
|
|
67
|
+
run: python -m build
|
|
68
|
+
|
|
69
|
+
- name: Check distribution
|
|
70
|
+
run: |
|
|
71
|
+
pip install twine
|
|
72
|
+
twine check dist/*
|
|
73
|
+
|
|
74
|
+
- name: Upload build artifacts
|
|
75
|
+
uses: actions/upload-artifact@v4
|
|
76
|
+
with:
|
|
77
|
+
name: distribution-files
|
|
78
|
+
path: dist/
|
|
79
|
+
|
|
80
|
+
release:
|
|
81
|
+
needs: build
|
|
82
|
+
runs-on: ubuntu-latest
|
|
83
|
+
environment: release
|
|
84
|
+
|
|
85
|
+
steps:
|
|
86
|
+
- name: Download build artifacts
|
|
87
|
+
uses: actions/download-artifact@v4
|
|
88
|
+
with:
|
|
89
|
+
name: distribution-files
|
|
90
|
+
path: dist/
|
|
91
|
+
|
|
92
|
+
- name: Publish to PyPI
|
|
93
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
94
|
+
with:
|
|
95
|
+
print-hash: true
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
#uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
|
|
110
|
+
# pdm
|
|
111
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
112
|
+
#pdm.lock
|
|
113
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
114
|
+
# in version control.
|
|
115
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
116
|
+
.pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
121
|
+
__pypackages__/
|
|
122
|
+
|
|
123
|
+
# Celery stuff
|
|
124
|
+
celerybeat-schedule
|
|
125
|
+
celerybeat.pid
|
|
126
|
+
|
|
127
|
+
# SageMath parsed files
|
|
128
|
+
*.sage.py
|
|
129
|
+
|
|
130
|
+
# Environments
|
|
131
|
+
.env
|
|
132
|
+
.venv
|
|
133
|
+
env/
|
|
134
|
+
venv/
|
|
135
|
+
ENV/
|
|
136
|
+
env.bak/
|
|
137
|
+
venv.bak/
|
|
138
|
+
|
|
139
|
+
# Spyder project settings
|
|
140
|
+
.spyderproject
|
|
141
|
+
.spyproject
|
|
142
|
+
|
|
143
|
+
# Rope project settings
|
|
144
|
+
.ropeproject
|
|
145
|
+
|
|
146
|
+
# mkdocs documentation
|
|
147
|
+
/site
|
|
148
|
+
|
|
149
|
+
# mypy
|
|
150
|
+
.mypy_cache/
|
|
151
|
+
.dmypy.json
|
|
152
|
+
dmypy.json
|
|
153
|
+
|
|
154
|
+
# Pyre type checker
|
|
155
|
+
.pyre/
|
|
156
|
+
|
|
157
|
+
# pytype static type analyzer
|
|
158
|
+
.pytype/
|
|
159
|
+
|
|
160
|
+
# Cython debug symbols
|
|
161
|
+
cython_debug/
|
|
162
|
+
|
|
163
|
+
# PyCharm
|
|
164
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
165
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
166
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
167
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
168
|
+
#.idea/
|
|
169
|
+
|
|
170
|
+
# Abstra
|
|
171
|
+
# Abstra is an AI-powered process automation framework.
|
|
172
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
173
|
+
# Learn more at https://abstra.io/docs
|
|
174
|
+
.abstra/
|
|
175
|
+
|
|
176
|
+
# Visual Studio Code
|
|
177
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
178
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
179
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
180
|
+
# you could uncomment the following to ignore the enitre vscode folder
|
|
181
|
+
# .vscode/
|
|
182
|
+
|
|
183
|
+
# Ruff stuff:
|
|
184
|
+
.ruff_cache/
|
|
185
|
+
|
|
186
|
+
# PyPI configuration file
|
|
187
|
+
.pypirc
|
|
188
|
+
|
|
189
|
+
# Cursor
|
|
190
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
191
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
192
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
193
|
+
.cursorignore
|
|
194
|
+
.cursorindexingignore
|
|
195
|
+
CLAUDE.md
|
|
196
|
+
.claude/**
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Spacelift
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: spaceforge
|
|
3
|
+
Version: 0.1.0.dev0
|
|
4
|
+
Summary: A Python framework for building Spacelift plugins
|
|
5
|
+
Home-page: https://github.com/spacelift-io/plugins
|
|
6
|
+
Author: Spacelift
|
|
7
|
+
Author-email: Spacelift <support@spacelift.io>
|
|
8
|
+
Maintainer-email: Spacelift <support@spacelift.io>
|
|
9
|
+
License: MIT
|
|
10
|
+
Project-URL: Homepage, https://github.com/spacelift-io/plugins
|
|
11
|
+
Project-URL: Documentation, https://github.com/spacelift-io/plugins#readme
|
|
12
|
+
Project-URL: Repository, https://github.com/spacelift-io/plugins
|
|
13
|
+
Project-URL: Bug Reports, https://github.com/spacelift-io/plugins/issues
|
|
14
|
+
Keywords: spacelift,plugin,framework,infrastructure,devops,spaceforge
|
|
15
|
+
Classifier: Development Status :: 3 - Alpha
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Classifier: Topic :: System :: Systems Administration
|
|
25
|
+
Requires-Python: >=3.9
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: PyYAML>=6.0
|
|
29
|
+
Requires-Dist: click>=8.0.0
|
|
30
|
+
Requires-Dist: pydantic>=2.11.7
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: pytest>=6.0; extra == "dev"
|
|
33
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
34
|
+
Requires-Dist: black; extra == "dev"
|
|
35
|
+
Requires-Dist: isort; extra == "dev"
|
|
36
|
+
Requires-Dist: mypy; extra == "dev"
|
|
37
|
+
Requires-Dist: types-PyYAML; extra == "dev"
|
|
38
|
+
Requires-Dist: setuptools-scm[toml]>=6.2; extra == "dev"
|
|
39
|
+
Dynamic: author
|
|
40
|
+
Dynamic: home-page
|
|
41
|
+
Dynamic: license-file
|
|
42
|
+
Dynamic: requires-python
|
|
43
|
+
|
|
44
|
+
# Spacelift Plugins
|
|
45
|
+
|
|
46
|
+
A monorepo for Spacelift plugins built with the **spaceforge** framework.
|
|
47
|
+
|
|
48
|
+
## Overview
|
|
49
|
+
|
|
50
|
+
This repository contains:
|
|
51
|
+
- **spaceforge/** - The core Python framework for building Spacelift plugins
|
|
52
|
+
- **plugins/wiz/** - Wiz security scanning plugin
|
|
53
|
+
- Plugin management and generation tools
|
|
54
|
+
|
|
55
|
+
## Quick Start
|
|
56
|
+
|
|
57
|
+
### Installation
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Install the spaceforge framework
|
|
61
|
+
pip install -e .
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Creating a Plugin
|
|
65
|
+
|
|
66
|
+
1. Create a new directory for your plugin
|
|
67
|
+
2. Implement your plugin by inheriting from `SpacepyPlugin`:
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
from spaceforge import SpaceforgePlugin, Parameter, Variable, Context
|
|
71
|
+
|
|
72
|
+
class MyPlugin(SpaceforgePlugin):
|
|
73
|
+
__plugin_name__ = "my-plugin"
|
|
74
|
+
__version__ = "1.0.0"
|
|
75
|
+
__author__ = "Your Name"
|
|
76
|
+
|
|
77
|
+
# Define parameters using pydantic dataclasses
|
|
78
|
+
__parameters__ = [
|
|
79
|
+
Parameter(
|
|
80
|
+
name="api_key",
|
|
81
|
+
description="API key for authentication",
|
|
82
|
+
required=True,
|
|
83
|
+
sensitive=True
|
|
84
|
+
)
|
|
85
|
+
]
|
|
86
|
+
|
|
87
|
+
# Define contexts using pydantic dataclasses
|
|
88
|
+
__contexts__ = [
|
|
89
|
+
Context(
|
|
90
|
+
name="main",
|
|
91
|
+
description="Main plugin context",
|
|
92
|
+
env=[
|
|
93
|
+
Variable(
|
|
94
|
+
key="API_KEY",
|
|
95
|
+
value_from_parameter="api_key",
|
|
96
|
+
sensitive=True
|
|
97
|
+
)
|
|
98
|
+
]
|
|
99
|
+
)
|
|
100
|
+
]
|
|
101
|
+
|
|
102
|
+
def after_plan(self):
|
|
103
|
+
self.logger.info("Running after plan hook")
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
3. Generate the plugin YAML:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
python -m spaceforge generate my_plugin.py
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Testing Plugins
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# Set plugin parameters
|
|
116
|
+
export SPACEFORGE_PARAM_NAME="value"
|
|
117
|
+
|
|
118
|
+
# Test specific hooks
|
|
119
|
+
python -m spaceforge runner after_plan
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Architecture
|
|
123
|
+
|
|
124
|
+
The spaceforge framework uses a hook-based architecture where plugins:
|
|
125
|
+
- Inherit from `SpaceforgePlugin` base class
|
|
126
|
+
- Override hook methods (`after_plan`, `before_apply`, etc.)
|
|
127
|
+
- Define parameters, contexts, webhooks, and policies using pydantic dataclasses
|
|
128
|
+
- Include automatic validation of data structures (e.g., Variables must have either `value` or `value_from_parameter`)
|
|
129
|
+
- Are automatically converted to Spacelift plugin YAML format with JSON schema validation
|
|
130
|
+
|
|
131
|
+
## Available Plugins
|
|
132
|
+
|
|
133
|
+
- **wiz** - Security scanning plugin for infrastructure as code
|
|
134
|
+
|
|
135
|
+
## Development
|
|
136
|
+
|
|
137
|
+
### Commands
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# Generate plugin YAML
|
|
141
|
+
python -m spaceforge generate [plugin_file.py] [-o output.yaml]
|
|
142
|
+
|
|
143
|
+
# Test plugin execution
|
|
144
|
+
python -m spaceforge runner [--plugin-file plugin.py] hook_name
|
|
145
|
+
|
|
146
|
+
# Get help
|
|
147
|
+
python -m spaceforge --help
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Framework Documentation
|
|
151
|
+
|
|
152
|
+
See [spaceforge/README.md](spaceforge/README.md) for detailed framework documentation.
|
|
153
|
+
|
|
154
|
+
## Contributing
|
|
155
|
+
|
|
156
|
+
1. Create your plugin in a new directory
|
|
157
|
+
2. Follow the plugin development patterns shown in existing plugins
|
|
158
|
+
3. Generate and test your plugin YAML
|
|
159
|
+
4. Submit a pull request
|
|
160
|
+
|
|
161
|
+
## License
|
|
162
|
+
|
|
163
|
+
MIT License
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Spacelift Plugins
|
|
2
|
+
|
|
3
|
+
A monorepo for Spacelift plugins built with the **spaceforge** framework.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This repository contains:
|
|
8
|
+
- **spaceforge/** - The core Python framework for building Spacelift plugins
|
|
9
|
+
- **plugins/wiz/** - Wiz security scanning plugin
|
|
10
|
+
- Plugin management and generation tools
|
|
11
|
+
|
|
12
|
+
## Quick Start
|
|
13
|
+
|
|
14
|
+
### Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Install the spaceforge framework
|
|
18
|
+
pip install -e .
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Creating a Plugin
|
|
22
|
+
|
|
23
|
+
1. Create a new directory for your plugin
|
|
24
|
+
2. Implement your plugin by inheriting from `SpacepyPlugin`:
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
from spaceforge import SpaceforgePlugin, Parameter, Variable, Context
|
|
28
|
+
|
|
29
|
+
class MyPlugin(SpaceforgePlugin):
|
|
30
|
+
__plugin_name__ = "my-plugin"
|
|
31
|
+
__version__ = "1.0.0"
|
|
32
|
+
__author__ = "Your Name"
|
|
33
|
+
|
|
34
|
+
# Define parameters using pydantic dataclasses
|
|
35
|
+
__parameters__ = [
|
|
36
|
+
Parameter(
|
|
37
|
+
name="api_key",
|
|
38
|
+
description="API key for authentication",
|
|
39
|
+
required=True,
|
|
40
|
+
sensitive=True
|
|
41
|
+
)
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
# Define contexts using pydantic dataclasses
|
|
45
|
+
__contexts__ = [
|
|
46
|
+
Context(
|
|
47
|
+
name="main",
|
|
48
|
+
description="Main plugin context",
|
|
49
|
+
env=[
|
|
50
|
+
Variable(
|
|
51
|
+
key="API_KEY",
|
|
52
|
+
value_from_parameter="api_key",
|
|
53
|
+
sensitive=True
|
|
54
|
+
)
|
|
55
|
+
]
|
|
56
|
+
)
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
def after_plan(self):
|
|
60
|
+
self.logger.info("Running after plan hook")
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
3. Generate the plugin YAML:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
python -m spaceforge generate my_plugin.py
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Testing Plugins
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Set plugin parameters
|
|
73
|
+
export SPACEFORGE_PARAM_NAME="value"
|
|
74
|
+
|
|
75
|
+
# Test specific hooks
|
|
76
|
+
python -m spaceforge runner after_plan
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Architecture
|
|
80
|
+
|
|
81
|
+
The spaceforge framework uses a hook-based architecture where plugins:
|
|
82
|
+
- Inherit from `SpaceforgePlugin` base class
|
|
83
|
+
- Override hook methods (`after_plan`, `before_apply`, etc.)
|
|
84
|
+
- Define parameters, contexts, webhooks, and policies using pydantic dataclasses
|
|
85
|
+
- Include automatic validation of data structures (e.g., Variables must have either `value` or `value_from_parameter`)
|
|
86
|
+
- Are automatically converted to Spacelift plugin YAML format with JSON schema validation
|
|
87
|
+
|
|
88
|
+
## Available Plugins
|
|
89
|
+
|
|
90
|
+
- **wiz** - Security scanning plugin for infrastructure as code
|
|
91
|
+
|
|
92
|
+
## Development
|
|
93
|
+
|
|
94
|
+
### Commands
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Generate plugin YAML
|
|
98
|
+
python -m spaceforge generate [plugin_file.py] [-o output.yaml]
|
|
99
|
+
|
|
100
|
+
# Test plugin execution
|
|
101
|
+
python -m spaceforge runner [--plugin-file plugin.py] hook_name
|
|
102
|
+
|
|
103
|
+
# Get help
|
|
104
|
+
python -m spaceforge --help
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Framework Documentation
|
|
108
|
+
|
|
109
|
+
See [spaceforge/README.md](spaceforge/README.md) for detailed framework documentation.
|
|
110
|
+
|
|
111
|
+
## Contributing
|
|
112
|
+
|
|
113
|
+
1. Create your plugin in a new directory
|
|
114
|
+
2. Follow the plugin development patterns shown in existing plugins
|
|
115
|
+
3. Generate and test your plugin YAML
|
|
116
|
+
4. Submit a pull request
|
|
117
|
+
|
|
118
|
+
## License
|
|
119
|
+
|
|
120
|
+
MIT License
|