From 3fbf8cd97cc26560f36e5fe9831ddfe6b1498f56 Mon Sep 17 00:00:00 2001 From: Jack Hadrill Date: Sat, 27 Aug 2022 19:39:24 +0000 Subject: [PATCH 1/7] Update 'src/containerspawner/state.py' --- src/containerspawner/state.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/containerspawner/state.py b/src/containerspawner/state.py index ce67521..61f14c0 100644 --- a/src/containerspawner/state.py +++ b/src/containerspawner/state.py @@ -44,11 +44,15 @@ class StateManager: name=container_name, network=CONTAINER_NETWORK, volumes={container_name: {"bind": CONTAINER_PERSIST}}, + restart_policy={"Name": "always", "MaximumRetryCount": 5} detach=True, auto_remove=True ) # Wait for container to start. + while container.status != "running": + time.sleep(1) + time.sleep(3) # Disable auth. @@ -56,3 +60,6 @@ class StateManager: # Install extensions. container.exec_run("code-server --install-extension ms-python.python") + + # Restart container. + container.restart() -- 2.47.2 From fecf8f1ab385615efe97a91572786adc409099fb Mon Sep 17 00:00:00 2001 From: Jack Hadrill Date: Sat, 27 Aug 2022 19:41:04 +0000 Subject: [PATCH 2/7] Update 'src/containerspawner/__init__.py' --- src/containerspawner/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/containerspawner/__init__.py b/src/containerspawner/__init__.py index 745899e..5c1a70d 100644 --- a/src/containerspawner/__init__.py +++ b/src/containerspawner/__init__.py @@ -19,6 +19,6 @@ def default(path): if not state.is_running(username): state.spawn(username) - response = make_response(f"Container spawned. Reloading `{path}`...", 201) - response.headers["Refresh"] = "5" + response = make_response(f"Container spawned. Reloading{'' if path else ' ' + path}...", 201) + response.headers["Refresh"] = "2" return response -- 2.47.2 From c0f662bc1ec61a02b1bcf6ad655eb18410d04d65 Mon Sep 17 00:00:00 2001 From: Jack Hadrill Date: Sat, 27 Aug 2022 19:41:27 +0000 Subject: [PATCH 3/7] Update 'src/containerspawner/state.py' --- src/containerspawner/state.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/containerspawner/state.py b/src/containerspawner/state.py index 61f14c0..79034ef 100644 --- a/src/containerspawner/state.py +++ b/src/containerspawner/state.py @@ -44,7 +44,7 @@ class StateManager: name=container_name, network=CONTAINER_NETWORK, volumes={container_name: {"bind": CONTAINER_PERSIST}}, - restart_policy={"Name": "always", "MaximumRetryCount": 5} + restart_policy={"Name": "always", "MaximumRetryCount": 5}, detach=True, auto_remove=True ) -- 2.47.2 From 55d61e1bc4b1998bb3beb9ddcd263f580d5c3ade Mon Sep 17 00:00:00 2001 From: Jack Hadrill Date: Sat, 27 Aug 2022 19:44:33 +0000 Subject: [PATCH 4/7] Update '.drone.yml' --- .drone.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index e94204a..cb6fa97 100644 --- a/.drone.yml +++ b/.drone.yml @@ -100,11 +100,13 @@ name: combine-manifests depends_on: - build-docker-amd64 - build-docker-arm64 +clone: + disable: true steps: - name: publish image: plugins/manifest settings: - username: JackNet + username: jackhadrill password: from_secret: password target: git.jacknet.io/jackhadrill/container-spawner:latest -- 2.47.2 From 6037f1fa1fa54d63760b6c21326959f3ceb822b1 Mon Sep 17 00:00:00 2001 From: Jack Hadrill Date: Sat, 27 Aug 2022 19:50:07 +0000 Subject: [PATCH 5/7] Update 'setup.cfg' --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 1b617c0..2832b9e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,3 @@ [metadata] name = containerspawner -version = 0.1.0 +version = 0.1.1 -- 2.47.2 From 362378a24f3907e277eb67238491c813a199e0cc Mon Sep 17 00:00:00 2001 From: Jack Hadrill Date: Sat, 27 Aug 2022 19:52:15 +0000 Subject: [PATCH 6/7] Update '.drone.yml' --- .drone.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index cb6fa97..35c07df 100644 --- a/.drone.yml +++ b/.drone.yml @@ -3,7 +3,7 @@ type: docker name: lint steps: - name: lint - image: python:3-slim + image: python:3-alpine commands: - echo "Installing lint dependencies..." - pip install --no-cache-dir .[lint] > /dev/null @@ -17,7 +17,7 @@ type: docker name: test steps: - name: test - image: python:3-slim + image: python:3-alpine commands: - echo "Installing test dependencies..." - pip install --no-cache-dir .[test] > /dev/null @@ -32,7 +32,7 @@ depends_on: - test steps: - name: build - image: python:3-slim + image: python:3-alpine commands: - pip install --no-cache-dir build - python -m build --wheel -- 2.47.2 From 8cbf8036c809df1b4eb70c1fe5e76443d5debeae Mon Sep 17 00:00:00 2001 From: Jack Hadrill Date: Sat, 27 Aug 2022 20:00:43 +0000 Subject: [PATCH 7/7] Update '.drone.yml' --- .drone.yml | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/.drone.yml b/.drone.yml index 35c07df..194364d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -43,6 +43,8 @@ steps: when: branch: - main + event: + - push settings: username: jackhadrill password: @@ -53,6 +55,11 @@ steps: kind: pipeline type: docker name: build-docker-amd64 +trigger: + branch: + - main + event: + - push depends_on: - build-pypi platform: @@ -60,9 +67,6 @@ platform: steps: - name: build image: plugins/docker - when: - branch: - - main settings: dockerfile: Dockerfile repo: git.jacknet.io/jackhadrill/container-spawner @@ -75,6 +79,11 @@ steps: kind: pipeline type: docker name: build-docker-arm64 +trigger: + branch: + - main + event: + - push depends_on: - build-pypi platform: @@ -82,9 +91,6 @@ platform: steps: - name: build image: plugins/docker - when: - branch: - - main settings: dockerfile: Dockerfile repo: git.jacknet.io/jackhadrill/container-spawner @@ -97,6 +103,11 @@ steps: kind: pipeline type: docker name: combine-manifests +trigger: + branch: + - main + event: + - push depends_on: - build-docker-amd64 - build-docker-arm64 -- 2.47.2