From 31a823134c367c048330d680f201e5411423d1ca Mon Sep 17 00:00:00 2001 From: Iain Powrie Date: Tue, 21 Dec 2021 01:25:04 +0000 Subject: [PATCH 1/9] Apply required tls variables for dind --- .gitlab-ci.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index da96d10d..8608338a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,6 +4,10 @@ stages: - docker-dev - docker-prod +variables: + DOCKER_HOST: tcp://docker:2376 + DOCKER_TLS_CERTDIR: "/certs" + docker-build-dev: image: docker:latest services: @@ -32,7 +36,8 @@ docker-build-dev: - | tag=":$CI_COMMIT_REF_SLUG" echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" - - docker buildx create --use --name zedBuilder + - docker context create tls-environment + - docker buildx create --name zedBuilder --use tls-environment - docker buildx build --cache-from type=registry,ref="$CI_REGISTRY_IMAGE${tag}" --build-arg BUILDKIT_INLINE_CACHE=1 @@ -42,6 +47,7 @@ docker-build-dev: after_script: - | docker buildx rm zedBuilder && echo "Successfully Stopped builder instance" || echo "Failed to stop builder instance." + docker context rm tls-environment || true echo "Please review multi-arch manifests are present:" docker buildx imagetools inspect "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" @@ -73,7 +79,8 @@ docker-build-prod: - | tag="" echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'" - - docker buildx create --use --name zedBuilder + - docker context create tls-environment + - docker buildx create --name zedBuilder --use tls-environment - docker buildx build --cache-from type=registry,ref="$CI_REGISTRY_IMAGE${tag}" --build-arg BUILDKIT_INLINE_CACHE=1 @@ -83,6 +90,7 @@ docker-build-prod: after_script: - | docker buildx rm zedBuilder && echo "Successfully Stopped builder instance" || echo "Failed to stop builder instance." + docker context rm tls-environment || true echo "Please review multi-arch manifests are present:" docker buildx imagetools inspect "$CI_REGISTRY_IMAGE${tag}" From 8719a1b3a1805bf3bb6962fb971b6f22e58fac71 Mon Sep 17 00:00:00 2001 From: Iain Powrie Date: Tue, 21 Dec 2021 01:31:15 +0000 Subject: [PATCH 2/9] Remove deprecated experimental tag Buildx is no longer experimental --- .gitlab-ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8608338a..95245097 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,7 +12,6 @@ docker-build-dev: image: docker:latest services: - name: docker:dind - command: ["--experimental"] stage: docker-dev tags: - docker @@ -55,7 +54,6 @@ docker-build-prod: image: docker:latest services: - name: docker:dind - command: ["--experimental"] stage: docker-prod tags: - docker From 3d54072c50f3b0c12cb0f32f4a80ac07ad5beff4 Mon Sep 17 00:00:00 2001 From: Iain Powrie Date: Tue, 21 Dec 2021 02:01:28 +0000 Subject: [PATCH 3/9] Dynamically resolve qemu image --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 95245097..c51ee237 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,7 +29,7 @@ docker-build-dev: mkdir -p ~/.docker/cli-plugins mv docker-buildx ~/.docker/cli-plugins/docker-buildx docker version - - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + - docker run --rm --privileged "multiarch/qemu-user-static:$([ $(uname -p) = 'aarch64' ] && echo arm || echo latest)" --reset -p yes - echo $CI_BUILD_TOKEN | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY script: - | @@ -71,7 +71,7 @@ docker-build-prod: mkdir -p ~/.docker/cli-plugins mv docker-buildx ~/.docker/cli-plugins/docker-buildx docker version - - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + - docker run --rm --privileged "multiarch/qemu-user-static:$([ $(uname -p) = 'aarch64' ] && echo arm || echo latest)" --reset -p yes - echo $CI_BUILD_TOKEN | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY script: - | From 1fd489026d49b3ab8ec9c8e2d41412606fb8cf84 Mon Sep 17 00:00:00 2001 From: Iain Powrie Date: Tue, 21 Dec 2021 02:26:52 +0000 Subject: [PATCH 4/9] Replace qemu image for arm support --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c51ee237..3e1c4d92 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,7 +29,7 @@ docker-build-dev: mkdir -p ~/.docker/cli-plugins mv docker-buildx ~/.docker/cli-plugins/docker-buildx docker version - - docker run --rm --privileged "multiarch/qemu-user-static:$([ $(uname -p) = 'aarch64' ] && echo arm || echo latest)" --reset -p yes + - docker run --rm --privileged aptman/qus -s -- -p aarch64 x86_64 - echo $CI_BUILD_TOKEN | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY script: - | @@ -71,7 +71,7 @@ docker-build-prod: mkdir -p ~/.docker/cli-plugins mv docker-buildx ~/.docker/cli-plugins/docker-buildx docker version - - docker run --rm --privileged "multiarch/qemu-user-static:$([ $(uname -p) = 'aarch64' ] && echo arm || echo latest)" --reset -p yes + - docker run --rm --privileged aptman/qus -s -- -p aarch64 x86_64 - echo $CI_BUILD_TOKEN | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY script: - | From b814cb62efc0c331764307c504fdd8a883172057 Mon Sep 17 00:00:00 2001 From: Iain Powrie Date: Tue, 21 Dec 2021 02:36:46 +0000 Subject: [PATCH 5/9] Run stages in parallel --- .gitlab-ci.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3e1c4d92..8187591d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,8 +1,6 @@ stages: -- win-dev -- win-prod -- docker-dev -- docker-prod +- build-dev +- build-prod variables: DOCKER_HOST: tcp://docker:2376 @@ -12,7 +10,7 @@ docker-build-dev: image: docker:latest services: - name: docker:dind - stage: docker-dev + stage: build-dev tags: - docker rules: @@ -54,7 +52,7 @@ docker-build-prod: image: docker:latest services: - name: docker:dind - stage: docker-prod + stage: build-prod tags: - docker rules: @@ -93,7 +91,7 @@ docker-build-prod: docker buildx imagetools inspect "$CI_REGISTRY_IMAGE${tag}" win-dev-build: - stage: win-dev + stage: build-dev tags: - win64 cache: @@ -128,7 +126,7 @@ win-dev-build: # | https://gitlab.com/crafty-controller/crafty-commander/-/jobs/artifacts/dev/download?job=win-dev-build win-prod-build: - stage: win-prod + stage: build-prod tags: - win64 cache: From 12a1f2912910cf01a3664b49c066508a2a565399 Mon Sep 17 00:00:00 2001 From: Iain Powrie Date: Tue, 21 Dec 2021 02:39:27 +0000 Subject: [PATCH 6/9] Revert "Run stages in parallel" This reverts commit b814cb62efc0c331764307c504fdd8a883172057 --- .gitlab-ci.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8187591d..3e1c4d92 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,8 @@ stages: -- build-dev -- build-prod +- win-dev +- win-prod +- docker-dev +- docker-prod variables: DOCKER_HOST: tcp://docker:2376 @@ -10,7 +12,7 @@ docker-build-dev: image: docker:latest services: - name: docker:dind - stage: build-dev + stage: docker-dev tags: - docker rules: @@ -52,7 +54,7 @@ docker-build-prod: image: docker:latest services: - name: docker:dind - stage: build-prod + stage: docker-prod tags: - docker rules: @@ -91,7 +93,7 @@ docker-build-prod: docker buildx imagetools inspect "$CI_REGISTRY_IMAGE${tag}" win-dev-build: - stage: build-dev + stage: win-dev tags: - win64 cache: @@ -126,7 +128,7 @@ win-dev-build: # | https://gitlab.com/crafty-controller/crafty-commander/-/jobs/artifacts/dev/download?job=win-dev-build win-prod-build: - stage: build-prod + stage: win-prod tags: - win64 cache: From d61120cc8bec77f10080bd6f6fc2156ec6f8b3b0 Mon Sep 17 00:00:00 2001 From: Iain Powrie Date: Tue, 21 Dec 2021 03:14:33 +0000 Subject: [PATCH 7/9] Remove persistency flag The pipeline runs once but fails on new jobs after attempting fix --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3e1c4d92..5c9b8a9b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,7 +29,7 @@ docker-build-dev: mkdir -p ~/.docker/cli-plugins mv docker-buildx ~/.docker/cli-plugins/docker-buildx docker version - - docker run --rm --privileged aptman/qus -s -- -p aarch64 x86_64 + - docker run --rm --privileged aptman/qus -s -- aarch64 x86_64 - echo $CI_BUILD_TOKEN | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY script: - | @@ -71,7 +71,7 @@ docker-build-prod: mkdir -p ~/.docker/cli-plugins mv docker-buildx ~/.docker/cli-plugins/docker-buildx docker version - - docker run --rm --privileged aptman/qus -s -- -p aarch64 x86_64 + - docker run --rm --privileged aptman/qus -s -- aarch64 x86_64 - echo $CI_BUILD_TOKEN | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY script: - | From 5a03d4eb7cef51c4ef9da648598794486557f10c Mon Sep 17 00:00:00 2001 From: Iain Powrie Date: Tue, 21 Dec 2021 03:40:39 +0000 Subject: [PATCH 8/9] Remove all register interpreters before new job This will hopefully fix the pipeline failures, sorry for the emails --- .gitlab-ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5c9b8a9b..8a75f0cc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,7 +29,8 @@ docker-build-dev: mkdir -p ~/.docker/cli-plugins mv docker-buildx ~/.docker/cli-plugins/docker-buildx docker version - - docker run --rm --privileged aptman/qus -s -- aarch64 x86_64 + - docker run --rm --privileged aptman/qus -- -r + - docker run --rm --privileged aptman/qus -s -- -p aarch64 x86_64 - echo $CI_BUILD_TOKEN | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY script: - | @@ -71,7 +72,8 @@ docker-build-prod: mkdir -p ~/.docker/cli-plugins mv docker-buildx ~/.docker/cli-plugins/docker-buildx docker version - - docker run --rm --privileged aptman/qus -s -- aarch64 x86_64 + - docker run --rm --privileged aptman/qus -- -r + - docker run --rm --privileged aptman/qus -s -- -p aarch64 x86_64 - echo $CI_BUILD_TOKEN | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY script: - | From 3e2d2c89ee182b4608fac78046f71eacca6c925e Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 21 Dec 2021 16:11:48 -0500 Subject: [PATCH 9/9] hotfix for failed scandir --- app/classes/shared/helpers.py | 8 ++++---- app/classes/web/http_handler_page.py | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/classes/shared/helpers.py b/app/classes/shared/helpers.py index 3f5bb8cc..18d34970 100644 --- a/app/classes/shared/helpers.py +++ b/app/classes/shared/helpers.py @@ -94,7 +94,7 @@ class Helpers: return True except Exception as err: return False - + @staticmethod def check_port(server_port): a_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) @@ -653,9 +653,9 @@ class Helpers: @staticmethod def generate_tree(folder, output=""): - for file in sorted(os.scandir(folder), key=lambda e: e.name): - filename = html.escape(file.name) - rel = os.path.join(folder, filename) + for raw_filename in os.listdir(folder): + filename = html.escape(raw_filename) + rel = os.path.join(folder, raw_filename) if os.path.isdir(rel): output += \ """
  • diff --git a/app/classes/web/http_handler_page.py b/app/classes/web/http_handler_page.py index 8b9e9c90..3b5a6c81 100644 --- a/app/classes/web/http_handler_page.py +++ b/app/classes/web/http_handler_page.py @@ -25,11 +25,9 @@ class HTTPHandlerPage(BaseHandler): def get(self, page): url = self.request.full_url port = 443 - print(url) if url[len(url)-1] == '/': url = url.strip(url[len(url)-1]) url_list = url.split('/') - print(url_list) if url_list[0] != "": primary_url = url_list[0] + ":"+str(port)+"/" backup_url = url_list[0] + ":" +str(helper.get_setting["https_port"]) +"/"