From 19df95cb5261f87318c2ccefa28c3d0338054420 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= <ondrej@sury.org>
Date: Thu, 19 Jan 2017 11:57:09 +0100
Subject: [PATCH 01/10] Build documentation from Gitlab CI

---
 .gitlab-ci.yml | 56 ++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 52 insertions(+), 4 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2d98279d26..d89993bf09 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -7,8 +7,16 @@ stages:
   - configure
   - build
   - test
+  - deploy
 
-.ubuntu: &ubuntu_image
+.debian_stretch: &debian_stretch
+  image: cznic/debian:stretch-knot
+  tags:
+    - docker
+    - linux
+    - amd64
+  
+.ubuntu_xenial: &ubuntu_xenial
   image: cznic/ubuntu:16.04-knot
   tags:
     - docker
@@ -38,17 +46,57 @@ stages:
     - make -k check
 
 configure:ubuntu:amd64:
-  <<: *ubuntu_image
+  <<: *ubuntu_xenial
   <<: *configure_job
 
 build:ubuntu:amd64:
-  <<: *ubuntu_image
+  <<: *ubuntu_xenial
   <<: *build_job
   dependencies:
     - configure:ubuntu:amd64
 
 test:ubuntu:amd64:
-  <<: *ubuntu_image
+  <<: *ubuntu_xenial
   <<: *test_job
   dependencies:
     - build:ubuntu:amd64
+
+configure:debian:stretch:amd64:
+  <<: *debian_stretch
+  <<: *configure_job
+
+build:debian:stretch:amd64:
+  <<: *debian_stretch
+  <<: *build_job
+  dependencies:
+    - configure:debian:stretch:amd64
+
+test:debian:stretch:amd64:
+  <<: *debian_stretch
+  <<: *test_job
+  dependencies:
+    - build:debian:stretch:amd64
+
+build:documentation:
+  <<: *debian_stretch
+  dependencies:
+    - configure:debian:stretch:amd64
+  only:
+    - gitlab-ci-documentation
+    - tags
+    - triggers
+  script:
+    - make -C doc html singlehtml pdf
+  artifacts:
+    name: "knot-dns-$CI_BUILD_TAG-doc"
+    paths:
+      - doc/_build/
+
+deploy:documentation:
+  <<: *debian_stretch
+  only:
+    - gitlab-ci-documentation
+    - tags
+    - triggers
+  script:
+    - "curl --request POST --form token=$WEBSITE_TOKEN --form ref=master https://gitlab.labs.nic.cz/api/v3/projects/5/trigger/builds"
-- 
GitLab


From 442312828b583970d6aa704cb12524606d43f963 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= <ondrej@sury.org>
Date: Thu, 19 Jan 2017 12:04:22 +0100
Subject: [PATCH 02/10] Push variables from this build

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d89993bf09..7bbf2eaddd 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -99,4 +99,4 @@ deploy:documentation:
     - tags
     - triggers
   script:
-    - "curl --request POST --form token=$WEBSITE_TOKEN --form ref=master https://gitlab.labs.nic.cz/api/v3/projects/5/trigger/builds"
+    - "curl --request POST --form token=$WEBSITE_TOKEN --form ref=master --form \"variables[RELEASE_CI_BUILD_TAG]=$CI_BUILD_TAG\" --form \"variables[RELEASE_CI_BUILD_ID]=$CI_BUILD_ID\" https://gitlab.labs.nic.cz/api/v3/projects/5/trigger/builds"
-- 
GitLab


From b62d6955d7cb228c2bd358b94b2cd7e514be1e96 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= <ondrej@sury.org>
Date: Thu, 19 Jan 2017 12:31:49 +0100
Subject: [PATCH 03/10] Move documentation deploy to the deploy phase

---
 .gitlab-ci.yml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 7bbf2eaddd..94deb887b1 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -10,7 +10,7 @@ stages:
   - deploy
 
 .debian_stretch: &debian_stretch
-  image: cznic/debian:stretch-knot
+  image: cznic/debian:stretch-knot-v2
   tags:
     - docker
     - linux
@@ -79,6 +79,7 @@ test:debian:stretch:amd64:
 
 build:documentation:
   <<: *debian_stretch
+  stage: build
   dependencies:
     - configure:debian:stretch:amd64
   only:
@@ -94,6 +95,7 @@ build:documentation:
 
 deploy:documentation:
   <<: *debian_stretch
+  stage: deploy
   only:
     - gitlab-ci-documentation
     - tags
-- 
GitLab


From 2f2c2b72fddafee11370033241f2f14e3e99f298 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= <ondrej@sury.org>
Date: Thu, 19 Jan 2017 12:50:22 +0100
Subject: [PATCH 04/10] Install curl and publish artifacts for the deploy phase

---
 .gitlab-ci.yml | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 94deb887b1..9fd6bd2add 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -92,13 +92,20 @@ build:documentation:
     name: "knot-dns-$CI_BUILD_TAG-doc"
     paths:
       - doc/_build/
+    expire_in: '1 hour'
 
 deploy:documentation:
   <<: *debian_stretch
   stage: deploy
+  before_script:
+    - apt-get -y install curl
   only:
     - gitlab-ci-documentation
     - tags
     - triggers
   script:
     - "curl --request POST --form token=$WEBSITE_TOKEN --form ref=master --form \"variables[RELEASE_CI_BUILD_TAG]=$CI_BUILD_TAG\" --form \"variables[RELEASE_CI_BUILD_ID]=$CI_BUILD_ID\" https://gitlab.labs.nic.cz/api/v3/projects/5/trigger/builds"
+  artifacts:
+    name: "knot-dns-$CI_BUILD_TAG-doc"
+    paths:
+      - doc/_build/
-- 
GitLab


From 12986fb247e3b6cc2eeb29840e91bb60efbac508 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= <ondrej@sury.org>
Date: Thu, 19 Jan 2017 12:54:55 +0100
Subject: [PATCH 05/10] Use CI_BUILD_REF_NAME instead of CI_BUILD_REF_TAG

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9fd6bd2add..c648d93938 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -104,7 +104,7 @@ deploy:documentation:
     - tags
     - triggers
   script:
-    - "curl --request POST --form token=$WEBSITE_TOKEN --form ref=master --form \"variables[RELEASE_CI_BUILD_TAG]=$CI_BUILD_TAG\" --form \"variables[RELEASE_CI_BUILD_ID]=$CI_BUILD_ID\" https://gitlab.labs.nic.cz/api/v3/projects/5/trigger/builds"
+    - "curl --request POST --form token=$WEBSITE_TOKEN --form ref=master --form \"variables[RELEASE_CI_BUILD_REF_NAME]=$CI_BUILD_REF_NAME\" --form \"variables[RELEASE_CI_BUILD_ID]=$CI_BUILD_ID\" https://gitlab.labs.nic.cz/api/v3/projects/5/trigger/builds"
   artifacts:
     name: "knot-dns-$CI_BUILD_TAG-doc"
     paths:
-- 
GitLab


From 6827713bd3ada8b2529bcd655450cd1f4d7c6300 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= <ondrej@sury.org>
Date: Thu, 19 Jan 2017 12:56:38 +0100
Subject: [PATCH 06/10] Don't name documentation build artifact

---
 .gitlab-ci.yml | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c648d93938..2f00a89926 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -89,7 +89,6 @@ build:documentation:
   script:
     - make -C doc html singlehtml pdf
   artifacts:
-    name: "knot-dns-$CI_BUILD_TAG-doc"
     paths:
       - doc/_build/
     expire_in: '1 hour'
@@ -106,6 +105,6 @@ deploy:documentation:
   script:
     - "curl --request POST --form token=$WEBSITE_TOKEN --form ref=master --form \"variables[RELEASE_CI_BUILD_REF_NAME]=$CI_BUILD_REF_NAME\" --form \"variables[RELEASE_CI_BUILD_ID]=$CI_BUILD_ID\" https://gitlab.labs.nic.cz/api/v3/projects/5/trigger/builds"
   artifacts:
-    name: "knot-dns-$CI_BUILD_TAG-doc"
+    name: "knot-dns-$CI_BUILD_REF_NAME-doc"
     paths:
       - doc/_build/
-- 
GitLab


From 824f35a716e10e18d49be283bf733edae39870b5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= <ondrej@sury.org>
Date: Thu, 19 Jan 2017 13:16:41 +0100
Subject: [PATCH 07/10] Skip full builds on gitlab-ci-documentation branch and
 on tags

---
 .gitlab-ci.yml | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2f00a89926..25d067fb94 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -48,18 +48,27 @@ stages:
 configure:ubuntu:amd64:
   <<: *ubuntu_xenial
   <<: *configure_job
+  except:
+    - gitlab-ci-documentation
+    - tags
 
 build:ubuntu:amd64:
   <<: *ubuntu_xenial
   <<: *build_job
   dependencies:
     - configure:ubuntu:amd64
+  except:
+    - gitlab-ci-documentation
+    - tags
 
 test:ubuntu:amd64:
   <<: *ubuntu_xenial
   <<: *test_job
   dependencies:
     - build:ubuntu:amd64
+  except:
+    - gitlab-ci-documentation
+    - tags
 
 configure:debian:stretch:amd64:
   <<: *debian_stretch
-- 
GitLab


From 30fdd909847018132e28456b9016e96a87e4a5d9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= <ondrej@sury.org>
Date: Thu, 19 Jan 2017 13:35:12 +0100
Subject: [PATCH 08/10] API calls need HTTP/1.1 for some strange reason

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 25d067fb94..0fd9dc2817 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -112,7 +112,7 @@ deploy:documentation:
     - tags
     - triggers
   script:
-    - "curl --request POST --form token=$WEBSITE_TOKEN --form ref=master --form \"variables[RELEASE_CI_BUILD_REF_NAME]=$CI_BUILD_REF_NAME\" --form \"variables[RELEASE_CI_BUILD_ID]=$CI_BUILD_ID\" https://gitlab.labs.nic.cz/api/v3/projects/5/trigger/builds"
+    - "curl --http1.1 --request POST --form token=$WEBSITE_TOKEN --form ref=master --form \"variables[RELEASE_CI_BUILD_REF_NAME]=$CI_BUILD_REF_NAME\" --form \"variables[RELEASE_CI_BUILD_ID]=$CI_BUILD_ID\" https://gitlab.labs.nic.cz/api/v3/projects/5/trigger/builds"
   artifacts:
     name: "knot-dns-$CI_BUILD_REF_NAME-doc"
     paths:
-- 
GitLab


From 766781594086b6186a2912d62bfadcd842159d74 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= <ondrej@sury.org>
Date: Thu, 19 Jan 2017 17:01:59 +0100
Subject: [PATCH 09/10] Reduce the amount of files in the documentation
 artifact

---
 .gitlab-ci.yml | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0fd9dc2817..0bae387465 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -99,7 +99,9 @@ build:documentation:
     - make -C doc html singlehtml pdf
   artifacts:
     paths:
-      - doc/_build/
+      - doc/_build/html/
+      - doc/_build/singlehtml/
+      - doc/_build/latex/knot.pdf
     expire_in: '1 hour'
 
 deploy:documentation:
@@ -116,4 +118,6 @@ deploy:documentation:
   artifacts:
     name: "knot-dns-$CI_BUILD_REF_NAME-doc"
     paths:
-      - doc/_build/
+      - doc/_build/html/
+      - doc/_build/singlehtml/
+      - doc/_build/latex/knot.pdf
-- 
GitLab


From 3766d3b9146ee8541287d9d4546329f9d6eef418 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= <ondrej@sury.org>
Date: Thu, 19 Jan 2017 20:49:46 +0100
Subject: [PATCH 10/10] Finalize the merge request by removing the branch from
 .gitlab-ci.yml

---
 .gitlab-ci.yml | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0bae387465..14451e2e10 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -49,7 +49,6 @@ configure:ubuntu:amd64:
   <<: *ubuntu_xenial
   <<: *configure_job
   except:
-    - gitlab-ci-documentation
     - tags
 
 build:ubuntu:amd64:
@@ -58,7 +57,6 @@ build:ubuntu:amd64:
   dependencies:
     - configure:ubuntu:amd64
   except:
-    - gitlab-ci-documentation
     - tags
 
 test:ubuntu:amd64:
@@ -67,7 +65,6 @@ test:ubuntu:amd64:
   dependencies:
     - build:ubuntu:amd64
   except:
-    - gitlab-ci-documentation
     - tags
 
 configure:debian:stretch:amd64:
@@ -92,7 +89,6 @@ build:documentation:
   dependencies:
     - configure:debian:stretch:amd64
   only:
-    - gitlab-ci-documentation
     - tags
     - triggers
   script:
@@ -110,7 +106,6 @@ deploy:documentation:
   before_script:
     - apt-get -y install curl
   only:
-    - gitlab-ci-documentation
     - tags
     - triggers
   script:
-- 
GitLab