Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pantaris integration #39

Merged
merged 7 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"python.testing.pytestArgs": [
"--ignore=desired_state_generator/test/integration",
"--ignore=runtime_k3d/test/integration",
"--ignore=runtime_kanto/test/integration",
"--ignore=runtime_local/test/integration",
"."
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"python.pythonPath": "/usr/bin/python3",
"python.defaultInterpreterPath": "/usr/bin/python3",
// Only Flake8 is used as linter and static code analyzer, as faster tool
Expand All @@ -33,12 +45,10 @@
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"dbaeumer.vscode-eslint",
"ms-azuretools.vscode-dapr",
"ms-azuretools.vscode-docker",
"ms-python.python",
"cschleiden.vscode-github-actions",
"pspester.pester-test",
"rpdswtk.vsmqtt",
"dotjoshjohnson.xml",
"ms-kubernetes-tools.vscode-kubernetes-tools",
Expand All @@ -49,6 +59,7 @@
]
}
},
"onCreateCommand": "bash .devcontainer/scripts/post-create.sh",
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
32 changes: 32 additions & 0 deletions .devcontainer/scripts/post-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
# Copyright (c) 2023 Robert Bosch GmbH
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available 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.
#
# SPDX-License-Identifier: Apache-2.0

echo "#######################################################"
echo "### Install python requirements ###"
echo "#######################################################"
# Update pip before installing requirements
pip3 install --upgrade pip
for package in runtime_k3d runtime_kanto runtime_local desired_state_generator; do

REQUIREMENTS="$package/src/requirements.txt"
if [ -f $REQUIREMENTS ]; then
pip3 install -r $REQUIREMENTS
fi
REQUIREMENTS="$package/test/requirements.txt"
if [ -f $REQUIREMENTS ]; then
pip3 install -r $REQUIREMENTS
fi

done
44 changes: 21 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,17 @@ jobs:

- name: Install required packages
run: |
pip install -e velocitas_lib
pip install -r runtime-k3d/src/requirements.txt
pip install -r runtime-k3d/test/requirements.txt
pip install -r runtime-local/test/requirements.txt
pip install -r velocitas_lib/test/requirements.txt
pip install -r runtime_k3d/src/requirements.txt
pip install -r runtime_k3d/test/requirements.txt
pip install -r runtime_local/test/requirements.txt
- name: unit tests
shell: bash
run: |
pytest --ignore-glob='*integration*' --override-ini junit_family=xunit1 --junit-xml=./results/UnitTest/junit.xml \
--cov . \
--cov-report=xml:results/CodeCoverage/cobertura-coverage.xml \
--cov-branch ./runtime-k3d/test ./runtime-local/test ./velocitas_lib/test
--cov-branch ./runtime_k3d/test ./runtime_local/test ./desired_state_generator/test
- name: Publish Unit Test Results
uses: mikepenz/action-junit-report@v3
Expand Down Expand Up @@ -96,8 +94,8 @@ jobs:

- name: Set commit id
run: |
NEW_CONFIG="$(jq --arg GITHUB_SHA "$GITHUB_SHA" '.packages[0].version |= $GITHUB_SHA' runtime-local/test/.velocitas.json)"
echo "${NEW_CONFIG}" > runtime-local/test/.velocitas.json
NEW_CONFIG="$(jq --arg GITHUB_SHA "$GITHUB_SHA" '.packages[0].version |= $GITHUB_SHA' runtime_local/test/.velocitas.json)"
echo "${NEW_CONFIG}" > runtime_local/test/.velocitas.json
- name: Install required packages
run: |
Expand All @@ -106,12 +104,12 @@ jobs:
- name: Init velocitas project
run: |
cd runtime-local/test
cd runtime_local/test
velocitas init -v
- name: Run integration tests for runtime-local
- name: Run integration tests for runtime_local
run: |
cd runtime-local/test
cd runtime_local/test
pip install -r requirements.txt
pytest -s ./integration/integration_test.py
Expand All @@ -120,7 +118,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: "Log files local"
path: runtime-local/test/logs/runtime-local
path: runtime_local/test/logs

run-k3d-integration-tests:
name: Run Integration Tests for k3d
Expand All @@ -137,8 +135,8 @@ jobs:

- name: Set commit id
run: |
NEW_CONFIG="$(jq --arg GITHUB_SHA "$GITHUB_SHA" '.packages[0].version |= $GITHUB_SHA' runtime-k3d/test/.velocitas.json)"
echo "${NEW_CONFIG}" > runtime-k3d/test/.velocitas.json
NEW_CONFIG="$(jq --arg GITHUB_SHA "$GITHUB_SHA" '.packages[0].version |= $GITHUB_SHA' runtime_k3d/test/.velocitas.json)"
echo "${NEW_CONFIG}" > runtime_k3d/test/.velocitas.json
- name: Install required packages
run: |
Expand All @@ -149,12 +147,12 @@ jobs:
- name: Init velocitas project
run: |
cd runtime-k3d/test
cd runtime_k3d/test
velocitas init -v
- name: Run integration tests for k3d
run: |
cd runtime-k3d/test
cd runtime_k3d/test
pip install -r requirements.txt
pytest -s ./integration/integration_test.py
Expand All @@ -163,7 +161,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: "Log files K3D"
path: runtime-k3d/test/logs/runtime-k3d
path: runtime_k3d/test/logs

run-kanto-integration-tests:
name: Run Integration Tests for kanto
Expand All @@ -180,8 +178,8 @@ jobs:

- name: Set commit id
run: |
NEW_CONFIG="$(jq --arg GITHUB_SHA "$GITHUB_SHA" '.packages[0].version |= $GITHUB_SHA' runtime-kanto/test/.velocitas.json)"
echo "${NEW_CONFIG}" > runtime-kanto/test/.velocitas.json
NEW_CONFIG="$(jq --arg GITHUB_SHA "$GITHUB_SHA" '.packages[0].version |= $GITHUB_SHA' runtime_kanto/test/.velocitas.json)"
echo "${NEW_CONFIG}" > runtime_kanto/test/.velocitas.json
- name: Install required packages
run: |
Expand All @@ -192,7 +190,7 @@ jobs:
wget https://github.com/eclipse-kanto/kanto/releases/download/v0.1.0-M3/kanto_0.1.0-M3_linux_x86_64.deb && \
sudo apt install ./kanto_0.1.0-M3_linux_x86_64.deb
pip install -r runtime-kanto/test/requirements.txt
pip install -r runtime_kanto/test/requirements.txt
- name: Stop Kanto services
run: |
Expand All @@ -208,12 +206,12 @@ jobs:
- name: Init velocitas project
run: |
cd runtime-kanto/test
cd runtime_kanto/test
velocitas init -v
- name: Run integration tests for kanto
run: |
cd runtime-kanto/test
cd runtime_kanto/test
# the socket on the ci is different to the devcontainer
sudo ln -s /run/containerd/containerd.sock /run/docker/containerd/containerd.sock
pytest -s -x ./integration/integration_test.py
Expand All @@ -224,4 +222,4 @@ jobs:
with:
name: "Log files Kanto"
path: |
runtime-kanto/test/logs
runtime_kanto/test/logs
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
.DS_Store
__pycache__

runtime-k3d/src/runtime/deployment/config/helm/templates/values.yaml
runtime_k3d/src/runtime/deployment/config/helm/templates/values.yaml
*.egg-info
dist
build
logs
results
helm
.coverage
tmp
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repos:
- id: end-of-file-fixer
- id: check-yaml
args: [--allow-multiple-documents]
exclude: ^runtime-k3d/src/runtime/deployment/config/helm/templates/|^runtime-k3d/src/app_deployment/config/helm/templates/|^config/feedercan/
exclude: ^runtime_k3d/src/runtime/deployment/config/helm/templates/|^runtime_k3d/src/app_deployment/config/helm/templates/|^config/feedercan/
- id: check-added-large-files

- repo: https://github.com/PyCQA/isort
Expand Down Expand Up @@ -42,11 +42,11 @@ repos:
# rev: "v1.2.0"
# hooks:
# - id: mypy
# args: [runtime-k3d, runtime-local]
# args: [runtime_k3d, runtime_local]
# language: system
# pass_filenames: false

# - repo: https://github.com/pycqa/pydocstyle
# rev: 6.3.0
# hooks:
# - id: pydocstyle
- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
19 changes: 19 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Debug Tests",
"type": "python",
"request": "launch",
"program": "${file}",
"purpose": [
"debug-test"
],
"console": "integratedTerminal",
"justMyCode": false
}
]
}
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ A Velocitas CLI package containing all available and supported Velocitas runtime

This package contains the following runtimes:

* [Local](./runtime-local/README.md)
* [Kubernetes (K3D)](./runtime-k3d/README.md)
* [Kanto](./runtime-kanto/README.md)
* [Local](./runtime_local/README.md)
* [Kubernetes (K3D)](./runtime_k3d/README.md)
* [Kanto](./runtime_kanto/README.md)

## Runtime Configuration: `runtime.json`

Expand Down Expand Up @@ -54,6 +54,12 @@ Function | Description
:---|:---
`$pathInWorkspaceOrPackage( <relative_path> )` | Resolves a path dynamically either to the local project workspace, if the file is available or falls back to a file in the package repository. If none of these files is available an exception is raised.

## Deployment spec generators

This package contains the following generators:

* [Desired State Generator](./desired_state_generator/README.md)

## Development hints

To create a better local environment, you can execute `source ./set_cli_env.sh` to export all CLI provided variables to test your scripts without invoking them via CLI exec.
3 changes: 3 additions & 0 deletions desired_state_generator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Desired State Generator

Generate a desired state manifest to be used by [ETAS' PANTARIS](https://www.etas.com/en/products/pantaris-products.php) solution.
File renamed without changes.
File renamed without changes.
Loading