Skip to content

Commit

Permalink
ci: BI-0 add port forwarding (#679)
Browse files Browse the repository at this point in the history
  • Loading branch information
ovsds authored Oct 29, 2024
1 parent 708cbe2 commit c96a482
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/dl_api_lib/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ requires = [
]

[tool.pytest.ini_options]
# log_cli = true
# log_level = "DEBUG"
minversion = "6.0"
addopts = "-ra"
testpaths = ["dl_api_lib_tests/unit", "dl_api_lib_tests/db"]
Expand Down
2 changes: 0 additions & 2 deletions metapkg/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,6 @@ requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.pytest.ini_options]
# log_cli = true
# log_level = "ERROR"
minversion = "6.0"
addopts = "-ra"
testpaths = []
Expand Down
27 changes: 27 additions & 0 deletions tools/taskfiles/taskfile_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,30 @@ tasks:
desc: Stop and remove all docker containers
cmds:
- docker stop $(docker ps -a -q)

ssh_forward_start:
desc: Forward docker ports to localhost
requires:
vars:
- HOST
cmds:
- for port in $PORTS; do
echo "Forwarding port $port";
ssh -f -N -L $port:localhost:$port {{.HOST}};
done;
wait
var:
env:
PORTS:
sh: DOCKER_HOST=ssh://{{.HOST}} docker ps --format "{{`{{.Ports}}`}}"
| grep -o ':[0-9]*->'
| sed 's/->//g'
| sed 's/://g'
| uniq

ssh_forward_stop:
desc: Stop SSH port forwarding for Docker containers
cmds:
- echo "Next processes will be killed:"
- ps -ef | grep "ssh -f -N -L" | grep --invert-match "grep"
- pkill -f "ssh -f -N -L"

0 comments on commit c96a482

Please sign in to comment.