File tree Expand file tree Collapse file tree 10 files changed +84
-150
lines changed
test_data/component_directories_metadata/component_valid Expand file tree Collapse file tree 10 files changed +84
-150
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ name : scripts-unit-tests
2+ env :
3+ PYTHON_VERSION : 3.11
4+ on :
5+ pull_request :
6+ paths :
7+ - ' scripts/validate_metadata/**'
8+ jobs :
9+ execute-scripts-unit-tests :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - uses : actions/checkout@v5
13+ with :
14+ fetch-depth : 0
15+
16+ - name : Set up Python
17+ uses : actions/setup-python@v6
18+ with :
19+ python-version : ${{ env.PYTHON_VERSION }}
20+
21+ - name : Install test dependencies
22+ run : |
23+ pip install -r scripts/validate_metadata/requirements.txt
24+
25+ - name : Install Test dependencies
26+ run : |
27+ pip install -r scripts/validate_metadata/requirements.txt
28+
29+ - name : Run tests
30+ run : pytest scripts/validate_metadata
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ name : validate-metadata-schema
2+ env :
3+ PYTHON_VERSION : 3.11
4+ RETRIEVAL_SCRIPT_PATH : $GITHUB_WORKSPACE/.github/resources/scripts/get_items_for_validation.sh
5+ VALIDATION_SCRIPT_PATH : $GITHUB_WORKSPACE/scripts/validate_metadata/validate_metadata.py
6+ on :
7+ pull_request :
8+ paths :
9+ - ' components/**'
10+ - ' pipelines/**'
11+ - ' scripts/**'
12+ - ' third_party/components/**'
13+ - ' third_party/pipelines/**'
14+
15+ jobs :
16+ validate-metadata-schema :
17+ runs-on : ubuntu-latest
18+ steps :
19+ - uses : actions/checkout@v5
20+ with :
21+ fetch-depth : 0
22+
23+ - name : Set up Python
24+ uses : actions/setup-python@v6
25+ with :
26+ python-version : ${{ env.PYTHON_VERSION }}
27+
28+ - name : Install Test dependencies
29+ run : |
30+ pip install -r scripts/validate_metadata/requirements.txt
31+
32+ - name : Retrieve new components and/or pipelines
33+ id : get-new-items
34+ run : ${{ env.RETRIEVAL_SCRIPT_PATH }} "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" validate_metadata
35+
36+ # ToDo: Utilize .github/scripts/find-changed-components-and-pipelines.sh script once merged in from https://github.com/kubeflow/pipelines-components/pull/7
37+ - name : Validate new core/third-party components and/or pipelines
38+ if : ${{ steps.get-new-items.outputs.new_items_list != '' }}
39+ run : |
40+ NEW_ITEMS_ARRAY="${{ steps.get-new-items.outputs.new_items_list }}"
41+
42+ # Set IFS to a comma, so that the shell will split the string by commas.
43+ IFS=','
44+
45+ for item in $NEW_ITEMS_ARRAY; do
46+ FILE_PATH="$GITHUB_WORKSPACE/$item"
47+ echo "Processing item: $item"
48+ python "${{ env.VALIDATION_SCRIPT_PATH }}" --item $FILE_PATH
49+ done
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11PyYAML == 6.0.3
22semver == 3.0.4
3+ pytest == 7.1.2
Original file line number Diff line number Diff line change 11name : component_valid
2- tier : third-party
2+ tier : third_party
33stability : alpha
44dependencies :
55 kubeflow :
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ def parse_args() -> argparse.Namespace:
5757 parser .add_argument (
5858 '--component' ,
5959 type = validate_component_directory ,
60+ required = True ,
6061 help = 'Path to the component directory (must contain component.py and metadata.yaml)'
6162 )
6263
@@ -290,25 +291,22 @@ def get_invalid_versions(dependencies: list[dict]) -> list[dict]:
290291def main ():
291292 """Main entry point for the CLI."""
292293 args = parse_args ()
293- if not args .component :
294- raise ValidationError ("Error: --component must be specified." )
295-
296294 component_dir = args .component
297295
298296 # Validate OWNERS
299297 try :
300298 owners_file_path = component_dir / OWNERS
301299 validate_owners_file (owners_file_path )
302300 except ValidationError as e :
303- logging .error ("Validation Error: {} " , e )
301+ logging .error ("Validation Error: %s " , e )
304302 sys .exit (1 )
305303
306304 # Validate metadata.yaml
307305 try :
308306 metadata_file_path = component_dir / METADATA
309307 validate_metadata_yaml (metadata_file_path )
310308 except ValidationError as e :
311- logging .error ("Validation Error: {} " , e )
309+ logging .error ("Validation Error: %s " , e )
312310 sys .exit (1 )
313311
314312 # Validation successful.
You can’t perform that action at this time.
0 commit comments