From 856c8c5300ac15e3a9a5aabde73c09ec421d2192 Mon Sep 17 00:00:00 2001
From: Vasek Sraier <git@vakabus.cz>
Date: Sun, 21 Feb 2021 21:56:52 +0100
Subject: [PATCH] CI containers: README and naming

---
 manager/.gitlab-ci.yml | 33 ++++++++++++++++++---------------
 manager/ci/README.md   |  9 +++++++++
 2 files changed, 27 insertions(+), 15 deletions(-)
 create mode 100644 manager/ci/README.md

diff --git a/manager/.gitlab-ci.yml b/manager/.gitlab-ci.yml
index 79e7f73f5..b667a9fb5 100644
--- a/manager/.gitlab-ci.yml
+++ b/manager/.gitlab-ci.yml
@@ -2,27 +2,30 @@ stages:
   - build
   - check
 
-image: $CI_REGISTRY/knot/knot-resolver-manager/ci/devenv:latest
+image: $CI_REGISTRY/knot/knot-resolver-manager/devenv:latest
 
-build:
-  image: docker:19.03.12
-  stage: build
-  services:
-    - docker:19.03.12-dind
-  variables:
-    IMAGE_TAG: $CI_REGISTRY/knot/knot-resolver-manager/ci/devenv:latest
-  script:
-    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
-    - docker build -t $IMAGE_TAG ci/devenv
-    - docker push $IMAGE_TAG
+# Ideally, the CI would build it's own container and use it afterwards. This workflow should be supported,
+# at least according to the GitLab documentation:
+# https://gitlab.nic.cz/help/user/packages/container_registry/index#container-registry-examples-with-gitlab-cicd
+# Sadly, it does not work on our infrastructure. I did not however test it thoroughly and/or consulted it with
+# anyone else. So it might be fixable. For now, let's leave the config here and we might fix it in the future.
+#
+# build:
+#   image: docker:19.03.12
+#   stage: build
+#   services:
+#     - docker:19.03.12-dind
+#   variables:
+#     IMAGE_TAG: $CI_REGISTRY/knot/knot-resolver-manager/ci/devenv:latest
+#   script:
+#     - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
+#     - docker build -t $IMAGE_TAG ci/devenv
+#     - docker push $IMAGE_TAG
 
 # FIXME - use custom Docker image, so that we don't rebuild it all every single time
 lint:
   image: debian:latest
   stage: check
-  variables:
-    # Python by default uses ascii encoding, which does not work, because source files are in UTF-8. Here is a potential solution, but for newer Python https://www.python.org/dev/peps/pep-0540/
-    LC_ALL: C.UTF-8
 
   cache:
     key: "check:always-the-same-cache"
diff --git a/manager/ci/README.md b/manager/ci/README.md
new file mode 100644
index 000000000..c6f692d85
--- /dev/null
+++ b/manager/ci/README.md
@@ -0,0 +1,9 @@
+Docker Build
+------------
+
+```
+$ docker build --no-cache -t registry.nic.cz/knot/knot-resolver-manager/devenv:latest devenv
+
+$ docker login registry.nic.cz
+$ docker push registry.nic.cz/knot/knot-resolver-manager/devenv:latest
+```
-- 
GitLab