Added kintree cli fork as a submodule.

Added 'inventree' stage to CI, which runs ki-ntree cli on all the boms
it can find in the artifacts dir
This commit is contained in:
andrewc
2024-10-01 15:00:34 +10:00
parent 9d7ea27a94
commit 6e23ebcc3a
3 changed files with 38 additions and 2 deletions

View File

@@ -15,6 +15,7 @@ variables:
stages:
- gen_mech
- gen_fab
- inventree
- upload
- release
@@ -33,6 +34,8 @@ image:
- if: $CI_COMMIT_BRANCH == "dev"
.commands:
get_tag:
- TAG=$(echo ${CI_COMMIT_MESSAGE} | tr -d \\n)
get_files:
- FILES=$(find . -name *$SEARCH -not -path "./.gitlab/*")
get_dirs:
@@ -124,12 +127,29 @@ image:
python3 $CI_PROJECT_DIR/.gitlab/.scripts/neo.py $d
done
boms:
- cd $CI_PROJECT_DIR/.gitlab/.scripts/ki-ntree/
- poetry install
- cd $CI_PROJECT_DIR/Fabrication
- 'SEARCH="bom.csv"'
- !reference [.commands, get_tag]
- !reference [.commands, get_files]
- cd $CI_PROJECT_DIR/.gitlab/.scripts/ki-ntree/
- |
for f in $FILES
do
echo $f
name=$(echo $f | cut -d'-' -f1)A
poetry run python -m kintree_cli -p $f --assembly "{'ipn': '$name', 'rev': '$TAG'}" --settings_inv $KINTREE_SETT_INV --settings_ipn $KINTREE_SETT_IPN
done
git_tag:
- !reference [.commands, get_tag]
- |
if [[ $GITLAB_CI == 'true' && $CI_COMMIT_BRANCH == "main" ]]; then
TAG=$(echo ${CI_COMMIT_MESSAGE} | tr -d \\n)
echo "running git tag"
git tag $CI_COMMIT_MESSAGE
git tag $TAG
elif [[ $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" && "$CI_MERGE_REQUEST_TITLE" =~ [^a-zA-Z0-9.-_] ]]; then
exit 1
fi
@@ -230,6 +250,17 @@ outputs_all:
- !reference [.commands, neo]
- ls Fabrication/
inventree_job:
stage: inventree
needs:
- job: outputs_all
artifacts: true
rules:
- if: $CI_COMMIT_TAG
when: never # Do not run this job when a tag is created manually
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run this job when commits are pushed or merged to the default branch
script:
- !reference [.commands, boms]
upload_job:
stage: upload