Skip to content

Commit 98d9e30

Browse files
committed
updated project to use poetry and latest version of .github actions
started adding support for using Type_Safe in Docker_Container and Docker_Image classes fixed a couple tests
1 parent 51fa803 commit 98d9e30

File tree

22 files changed

+583
-40
lines changed

22 files changed

+583
-40
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CI Pipeline - DEV
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- dev
7+
8+
env:
9+
GIT__BRANCH : 'dev'
10+
RELEASE_TYPE : 'minor'
11+
PACKAGE_NAME : 'osbot-docker'
12+
13+
jobs:
14+
15+
run-tests:
16+
name: "Run tests"
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: "run-tests"
21+
uses: owasp-sbot/OSBot-GitHub-Actions/.github/actions/pytest__run-tests@dev
22+
23+
increment-tag:
24+
name: Increment Tag - DEV
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
- name: Increment Tag
29+
uses: owasp-sbot/OSBot-GitHub-Actions/.github/actions/git__increment-tag@dev
30+
with:
31+
release_type: ${{ env.RELEASE_TYPE }}
32+
needs:
33+
- run-tests
34+
35+
publish-to-pypi:
36+
if: False
37+
name: "Publish to: PYPI"
38+
permissions:
39+
id-token: write
40+
runs-on: ubuntu-latest
41+
steps:
42+
- uses: actions/checkout@v4
43+
- name: Git Update Current Branch
44+
uses: owasp-sbot/OSBot-GitHub-Actions/.github/actions/git__update_branch@dev
45+
- name: publish-to-pypi
46+
uses: owasp-sbot/OSBot-GitHub-Actions/.github/actions/pypi__twine__publish@dev
47+
needs:
48+
- increment-tag
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name : CI Pipeline - Main
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
7+
8+
env:
9+
GIT__BRANCH : 'main'
10+
RELEASE_TYPE : 'major'
11+
PACKAGE_NAME : 'osbot-docker'
12+
13+
jobs:
14+
15+
run-tests:
16+
name: "Run tests"
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: "run-tests"
21+
uses: owasp-sbot/OSBot-GitHub-Actions/.github/actions/pytest__run-tests@dev
22+
23+
increment-tag:
24+
name: Increment Tag - Main
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
- name: Increment Tag
29+
uses: owasp-sbot/OSBot-GitHub-Actions/.github/actions/git__increment-tag@dev
30+
with:
31+
release_type: ${{ env.RELEASE_TYPE }}
32+
needs:
33+
- run-tests
34+
35+
publish-to-pypi:
36+
name: "Publish to: PYPI"
37+
permissions:
38+
id-token: write
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v4
42+
- name: Git Update Current Branch
43+
uses: owasp-sbot/OSBot-GitHub-Actions/.github/actions/git__update_branch@dev
44+
- name: publish-to-pypi
45+
uses: owasp-sbot/OSBot-GitHub-Actions/.github/actions/pypi__twine__publish@dev
46+
needs:
47+
- increment-tag

osbot_docker/apis/Docker_Container.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
from docker.errors import NotFound
2+
from osbot_utils.type_safe.Type_Safe import Type_Safe
3+
from osbot_docker.apis.API_Docker import API_Docker
4+
from osbot_utils.utils.Misc import date_time_from_to_str, wait_for
25

3-
from osbot_docker.apis.API_Docker import API_Docker
4-
from osbot_utils.utils.Misc import date_time_from_to_str, wait_for
56

7+
class Docker_Container(Type_Safe):
8+
api_docker : API_Docker
9+
container_id : str = None
610

7-
class Docker_Container:
8-
9-
def __init__(self, container_id, api_docker:API_Docker=None, container_raw=None):
10-
self.api_docker = api_docker or API_Docker()
11+
def __init__(self, container_id, container_raw=None, **kwargs): # todo: refactor this to be more inline with how Type_Safe works
1112
self.container_id = container_id
12-
self.container_raw = container_raw # initial docker_api container_raw data
13+
self.container_raw = container_raw # initial docker_api container_raw data
14+
super().__init__(**kwargs)
1315

1416
def __repr__(self):
1517
return f"<Docker_Container: {self.short_id()}>"
@@ -117,4 +119,11 @@ def wait_for_container_status(self, desired_status, wait_delta=.2, wait_count=10
117119
return True # Container has reached the desired status
118120
wait_for(wait_delta)
119121
wait_count-=1
122+
return False
123+
124+
def wait_for_logs(self, max_attempts=20, delay_interval=0.1):
125+
for i in range(0,max_attempts):
126+
if self.logs() != "":
127+
return True
128+
wait_for(delay_interval)
120129
return False

0 commit comments

Comments
 (0)