Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/OPT-347' into feature/OP…
Browse files Browse the repository at this point in the history
…T-347
  • Loading branch information
daFont-iriusrisk committed Apr 26, 2023
2 parents ff6b772 + c01d1d1 commit 5c9ac7e
Show file tree
Hide file tree
Showing 16 changed files with 50,311 additions and 50 deletions.
19 changes: 19 additions & 0 deletions .github/actions/documentation/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Config documentation environment
description: 'Config documentation environment'

runs:
using: "composite"
steps:

- name: Set up Python 3.8
uses: actions/setup-python@v3
with:
python-version: "3.8"

- name: Configure git username
run: git config user.name 'github-actions[bot]' && git config user.email 'github-actions[bot]@users.noreply.github.com'
shell: bash

- name: Install doc dependencies
run: pip install -r docs/requirements.txt
shell: bash
18 changes: 18 additions & 0 deletions .github/workflows/documentation-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Documentation Check

on: [pull_request]

jobs:

check-documentation:
runs-on: ubuntu-latest

steps:
- name: Checkout the project from Git
uses: actions/checkout@v3

- name: Config documentation environment
uses: ./.github/actions/documentation

- name: Check doc build
run: mkdocs build
21 changes: 21 additions & 0 deletions .github/workflows/documentation-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Documentation Deploy

on:
workflow_dispatch: {}
push:
branches: [ main ]

jobs:

deploy-documentation:
runs-on: ubuntu-latest

steps:
- name: Checkout the project from Git
uses: actions/checkout@v3

- name: Config documentation environment
uses: ./.github/actions/documentation

- name: Publish docs
run: mkdocs gh-deploy --force
20 changes: 0 additions & 20 deletions .github/workflows/documentation.yml

This file was deleted.

12 changes: 5 additions & 7 deletions .github/workflows/startleft-unit-integration-fast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,14 @@ jobs:
with:
python-version: "3.8"

- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v1

- name: Update pip version to 23.0.1
run: python -m pip install --upgrade pip==23.0.1

- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v1

- name: Install dependencies
run: |
pip install -e ".[setup,test]"
run: pip install -e ".[setup,test]"

- name: Test with pytest
run: |
python run_tests.py --log-level debug
run: python run_tests.py --log-level debug
21 changes: 10 additions & 11 deletions .github/workflows/startleft-unit-integration-full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ jobs:
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v1

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
Expand All @@ -37,21 +34,23 @@ jobs:
- name: Update pip version to 23.0.1
run: python -m pip install --upgrade pip==23.0.1

- if: runner.os == 'Windows'
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v1

- name: Configure Graphviz in Windows
if: runner.os == 'Windows'
shell: bash
run: |
pip install --global-option=build_ext --global-option="-IC:\Program files\Graphviz\include" --global-option="-LC:\Program files\Graphviz\lib" pygraphviz
echo "C:\Program Files\Graphviz\bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
pip install -e ".[setup,test]"
run: pip install -e ".[setup,test]"

# This step MUST be after the general installation of StartLeft
- if: runner.os == 'Windows'
run: |
pip install python-magic-bin
- name: Install libmagic in Windows
if: runner.os == 'Windows'
run: pip install python-magic-bin

- name: Test with pytest
run: |
python run_tests.py --log-level debug
run: python run_tests.py --log-level debug
2 changes: 1 addition & 1 deletion deployment/Dockerfile.docs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM squidfunk/mkdocs-material

RUN pip install --upgrade pip

RUN pip install mkdocs-glightbox
RUN pip install -r requirements.txt

COPY /docs ./docs
COPY mkdocs.yml .
6 changes: 3 additions & 3 deletions docs/About.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ Deploy the documentation using the provided `docker-compose.yml` file inside the
- With docker installed from debian/ubuntu packages (docker.io) and the docker-compose plugin
```shell
cd deployment
docker-compose up -d docs
docker-compose up -d startleft-docs
```
- With docker installed from docker.com packages
```shell
cd deployment
docker compose up -d docs
docker compose up -d startleft-docs
```


Expand All @@ -56,7 +56,7 @@ Now you can access the docs in [http://localhost:8000](http://localhost:8000).
## Launch StartLeft documentation by mkdocs serve
Run into StartLeft root folder
```shell
pip install -e ".[doc]"
pip install -r docs/requirements.txt
mkdocs serve
```

Expand Down
2 changes: 1 addition & 1 deletion docs/Troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ library as indicated in the [prerequisites section](Quickstart-Guide-for-Beginne
When trying to launch StartLeft documentation by `mkdocs serve` using IntelliJ, you may get an
error stating that the `glightbox` package is not installed.

This requires re-running the `pip install -e ".[doc]"`
This requires re-running the `pip install -r docs/requirements.txt`
command and restarting the IDE.
---

Expand Down
3 changes: 3 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mkdocs-material==9.1.1
pymdown-extensions==9.10
mkdocs-glightbox==0.3.1
5 changes: 0 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@
'responses==0.22.0',
'deepdiff==6.2.3',
'httpx==0.23.3'
],
"doc": [
'mkdocs-material==9.1.1',
'pymdown-extensions==9.10',
'mkdocs-glightbox==0.3.1'
]
},
entry_points='''
Expand Down
4 changes: 3 additions & 1 deletion slp_tf/slp_tf/validate/tf_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

logger = logging.getLogger(__name__)

MAX_SIZE = 20 * 1024 * 1024
VALID_MIME = ['text/plain', 'application/octet-stream', 'application/json']

MAX_SIZE = 1024 * 1024 # 1MB
MIN_SIZE = 20


Expand Down
12 changes: 12 additions & 0 deletions slp_tf/tests/integration/test_tf_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,3 +232,15 @@ def test_resources_with_same_name(self):
# AND both components are mapped with the same name
assert len(otm.components) == 2
assert otm.components[0].name == otm.components[1].name

def test_valid_terraform_size_over_1mb(self):

# GIVEN a terraform file file under 2MB
tf_file = get_data(test_resource_paths.terraform_invalid_size_over_1mb)
# AND the default terraform mapping file
mapping_file = get_data(test_resource_paths.terraform_iriusrisk_tf_aws_mapping)

# WHEN processing
# THEN a 400 error is returned
with pytest.raises(IacFileNotValidError):
TerraformProcessor(SAMPLE_ID, SAMPLE_NAME, tf_file, [mapping_file]).process()
1 change: 1 addition & 0 deletions slp_tf/tests/resources/test_resource_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
terraform_security_groups_type2_inbound = path + '/tf/dataflows/security_groups/terraform_sg_type2_inbound.tf'
terraform_security_groups_type1_and_type2_mixed = path + '/tf/dataflows/security_groups/' \
'terraform_sg_type1_and_type2_mixed.tf'
terraform_invalid_size_over_1mb = path + '/tf/terraform_invalid_size_over_1mb.tf'


# tfplan
Expand Down
Loading

0 comments on commit 5c9ac7e

Please sign in to comment.