Skip to content

Commit

Permalink
use python virtualenv
Browse files Browse the repository at this point in the history
  • Loading branch information
SashaLsnko committed Jun 1, 2023
1 parent d6b8ee8 commit 052bbf5
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
3 changes: 1 addition & 2 deletions src/commands/set-parameters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,4 @@ steps:
MAPPING: << parameters.mapping >>
OUTPUT_PATH: << parameters.output-path >>
CONFIG_PATH: << parameters.config-path >>
shell: /usr/bin/env python3
command: <<include(scripts/create-parameters.py)>>
command: <<include(scripts/create-parameters.sh)>>
17 changes: 8 additions & 9 deletions src/scripts/create-parameters.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python3

import json
import os
import re
Expand Down Expand Up @@ -137,10 +135,11 @@ def create_parameters(output_path, config_path, head, base, mapping):
write_parameters_from_mappings(mappings, changes, output_path, config_path)


create_parameters(
os.environ.get('OUTPUT_PATH'),
os.environ.get('CONFIG_PATH'),
os.environ.get('CIRCLE_SHA1'),
os.environ.get('BASE_REVISION'),
os.environ.get('MAPPING')
)
if __name__ == "__main__":
create_parameters(
os.environ.get('OUTPUT_PATH'),
os.environ.get('CONFIG_PATH'),
os.environ.get('CIRCLE_SHA1'),
os.environ.get('BASE_REVISION'),
os.environ.get('MAPPING')
)
19 changes: 19 additions & 0 deletions src/scripts/create-parameters.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
python3 get-pip.py --user

python3 -m pip install --user virtualenv

echo "Create python virtual environment for path-filtering"
virtualenv path-filtering-venv

echo "Activate python virtual environment"
# shellcheck source=/dev/null
. path-filtering-venv/bin/activate

echo "Creating pipeline parameters"
python3 src/scripts/create-parameters.py

echo "Deactivate python virtual environment for path-filtering"
deactivate

0 comments on commit 052bbf5

Please sign in to comment.