forked from aws-samples/sagemaker-ssh-helper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
48 lines (45 loc) · 1.51 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Official language image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/python/tags/
image: python:3.8
stages:
- scan_source_code
- test
scan_source_code:
stage: scan_source_code
script:
- pip install bandit
# TODO: replace with inline # nosec
- bandit -r ./ --skip B603,B404,B101,B607 2>&1 | tee bandit.txt
artifacts:
paths:
- bandit.txt
run_tests:
stage: test
resource_group: ssh-helper-tests
script:
# Smoke test - Python version
- python --version
# Install AWS CLI
- curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "/tmp/awscliv2.zip"
- unzip -o -q -d /tmp/ /tmp/awscliv2.zip
- /tmp/aws/install
- aws --version
- echo "AWS default region - $AWS_DEFAULT_REGION"
- echo "AWS region - $AWS_REGION"
- aws configure list
# Install SSM plugin
- curl "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_64bit/session-manager-plugin.deb" -o "session-manager-plugin.deb"
- dpkg -i session-manager-plugin.deb
- session-manager-plugin --version
# Install the package
- pip install '.[test]'
- pip freeze | tee pip_freeze.txt
# Run tests
- echo "Extra args for pytest - $PYTEST_EXTRA_ARGS"
- cd tests; pytest --junitxml=pytest_report.xml -m 'not manual' -o sagemaker_role=$SAGEMAKER_ROLE -o kernel_gateway_name=$KERNEL_GATEWAY_NAME $PYTEST_EXTRA_ARGS
artifacts:
when: always
reports:
junit: tests/pytest_report.xml
paths:
- pip_freeze.txt