[PATCH] Allow gitlab CI to pass without a private runner

Andrew Bartlett abartlet at samba.org
Tue May 1 08:58:27 UTC 2018


On Tue, 2018-05-01 at 08:26 +1200, Andrew Bartlett via samba-technical
wrote:
> G'Day,
> 
> This patch splits up our gitlab CI configuration such that the tests
> that require a private runner (rather than the shared runners) do not
> operate by default.
> 
> The gitlab repositories that have access to a private runner can then
> use the .gitlab-ci-private.yml file via a config change.
> 
> This should make it easier for contributors to use gitlab.
> 
> The number of tests is not as good as on travis-ci, and we should work
> to split those that actually need ext4 out, but this is a step forward
> for now.
> 
> William,
> 
> Can you give this a test on your gitlab repo and confirm it passes for
> you?

And now with the patch.

Thanks,

Andrew Bartlett


-- 
Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba
-------------- next part --------------
From c08c1a205d889f56042a03fb41a19a35ee9dbb2e Mon Sep 17 00:00:00 2001
From: Andrew Bartlett <abartlet at samba.org>
Date: Mon, 30 Apr 2018 20:18:52 +1200
Subject: [PATCH 1/3] gitlab-ci: split up gitlab-ci file

The "private" build environments are not available to most users so
remove this from the default build.  Only developers with access
to private runners (rather than a shared runner) will have a runner
tagged as "private".

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
---
 .gitlab-ci-private.yml | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 .gitlab-ci.yml         | 45 ---------------------------------------------
 2 files changed, 49 insertions(+), 45 deletions(-)
 create mode 100644 .gitlab-ci-private.yml

diff --git a/.gitlab-ci-private.yml b/.gitlab-ci-private.yml
new file mode 100644
index 00000000000..fc4adada1a6
--- /dev/null
+++ b/.gitlab-ci-private.yml
@@ -0,0 +1,49 @@
+include:
+ - '/.gitlab-ci.yml'
+
+
+build_samba:
+  stage: build
+  tags:
+    - docker
+    - private
+  script:
+    # this one takes about 4 hours to finish
+    - python script/autobuild.py samba            --verbose --tail --testbase /tmp/samba-testbase
+
+build_samba_nt4:
+  stage: build
+  tags:
+    - docker
+    - private
+  script:
+    # this one takes about 1 hours to finish
+    - python script/autobuild.py samba-nt4        --verbose --tail --testbase /tmp/samba-testbase
+
+build_samba_fileserver:
+  stage: build
+  tags:
+    - docker
+    - private
+  script:
+    # this one takes about 1 hours to finish
+    - python script/autobuild.py samba-fileserver --verbose --tail --testbase /tmp/samba-testbase
+
+build_samba_ad_dc:
+  stage: build
+  tags:
+    - docker
+    - private
+  script:
+    # this one takes about 1 hours to finish
+    - python script/autobuild.py samba-ad-dc     --verbose --tail --testbase /tmp/samba-testbase
+
+build_samba_ad_dc_2:
+  stage: build
+  tags:
+    - docker
+    - private
+  script:
+    # this one takes about 1 hours to finish
+    - python script/autobuild.py samba-ad-dc-2     --verbose --tail --testbase /tmp/samba-testbase
+
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index cde8341d0f7..bfefc23aa58 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -14,51 +14,6 @@ before_script:
       sudo swapon /samba-swap;
     fi
 
-build_samba:
-  stage: build
-  tags:
-    - docker
-    - private
-  script:
-    # this one takes about 4 hours to finish
-    - python script/autobuild.py samba            --verbose --tail --testbase /tmp/samba-testbase
-
-build_samba_nt4:
-  stage: build
-  tags:
-    - docker
-    - private
-  script:
-    # this one takes about 1 hours to finish
-    - python script/autobuild.py samba-nt4        --verbose --tail --testbase /tmp/samba-testbase
-
-build_samba_fileserver:
-  stage: build
-  tags:
-    - docker
-    - private
-  script:
-    # this one takes about 1 hours to finish
-    - python script/autobuild.py samba-fileserver --verbose --tail --testbase /tmp/samba-testbase
-
-build_samba_ad_dc:
-  stage: build
-  tags:
-    - docker
-    - private
-  script:
-    # this one takes about 1 hours to finish
-    - python script/autobuild.py samba-ad-dc     --verbose --tail --testbase /tmp/samba-testbase
-
-build_samba_ad_dc_2:
-  stage: build
-  tags:
-    - docker
-    - private
-  script:
-    # this one takes about 1 hours to finish
-    - python script/autobuild.py samba-ad-dc-2     --verbose --tail --testbase /tmp/samba-testbase
-
 build_samba_none_env:
   stage: build
   tags:
-- 
2.14.3


From f78b5aacabb04c5428ba21ff9e8f5591cfe01bc4 Mon Sep 17 00:00:00 2001
From: Andrew Bartlett <abartlet at samba.org>
Date: Mon, 30 Apr 2018 20:31:19 +1200
Subject: [PATCH 2/3] gitlab-ci: Use YAML templates to reduce duplication

Inspired by WIP patches by Jamie McClymont

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
---
 .gitlab-ci-private.yml | 25 ++++++++-----------------
 .gitlab-ci.yml         | 50 +++++++++++++-------------------------------------
 2 files changed, 21 insertions(+), 54 deletions(-)

diff --git a/.gitlab-ci-private.yml b/.gitlab-ci-private.yml
index fc4adada1a6..24b474d3b3a 100644
--- a/.gitlab-ci-private.yml
+++ b/.gitlab-ci-private.yml
@@ -2,47 +2,38 @@ include:
  - '/.gitlab-ci.yml'
 
 
-build_samba:
+.private_template: &private_template
   stage: build
   tags:
     - docker
     - private
+
+build_samba:
+  <<: *private_template
   script:
     # this one takes about 4 hours to finish
     - python script/autobuild.py samba            --verbose --tail --testbase /tmp/samba-testbase
 
 build_samba_nt4:
-  stage: build
-  tags:
-    - docker
-    - private
+  <<: *private_template
   script:
     # this one takes about 1 hours to finish
     - python script/autobuild.py samba-nt4        --verbose --tail --testbase /tmp/samba-testbase
 
 build_samba_fileserver:
-  stage: build
-  tags:
-    - docker
-    - private
+  <<: *private_template
   script:
     # this one takes about 1 hours to finish
     - python script/autobuild.py samba-fileserver --verbose --tail --testbase /tmp/samba-testbase
 
 build_samba_ad_dc:
-  stage: build
-  tags:
-    - docker
-    - private
+  <<: *private_template
   script:
     # this one takes about 1 hours to finish
     - python script/autobuild.py samba-ad-dc     --verbose --tail --testbase /tmp/samba-testbase
 
 build_samba_ad_dc_2:
-  stage: build
-  tags:
-    - docker
-    - private
+  <<: *private_template
   script:
     # this one takes about 1 hours to finish
     - python script/autobuild.py samba-ad-dc-2     --verbose --tail --testbase /tmp/samba-testbase
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index bfefc23aa58..b151599f12c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -14,84 +14,60 @@ before_script:
       sudo swapon /samba-swap;
     fi
 
-build_samba_none_env:
+.shared_template: &shared_template
   stage: build
   tags:
     - docker
     - shared
+
+build_samba_none_env:
+  <<: *shared_template
   script:
     # this one takes about 1 hours to finish
     - python script/autobuild.py samba-none-env    --verbose --tail --testbase /tmp/samba-testbase
 
 build_samba_nopython:
-  stage: build
-  tags:
-    - docker
-    - shared
+  <<: *shared_template
   script:
     - python script/autobuild.py samba-nopython   --verbose --tail --testbase /tmp/samba-testbase
 
 build_samba_systemkrb5:
-  stage: build
-  tags:
-    - docker
-    - shared
+  <<: *shared_template
   script:
     - python script/autobuild.py samba-systemkrb5 --verbose --tail --testbase /tmp/samba-testbase
 
 build_samba_xc:
-  stage: build
-  tags:
-    - docker
-    - shared
+  <<: *shared_template
   script:
     - python script/autobuild.py samba-xc         --verbose --tail --testbase /tmp/samba-testbase
 
 build_samba_o3:
-  stage: build
-  tags:
-    - docker
-    - shared
+  <<: *shared_template
   script:
     - python script/autobuild.py samba-o3         --verbose --tail --testbase /tmp/samba-testbase
 
 build_samba_libs:
-  stage: build
-  tags:
-    - docker
-    - shared
+  <<: *shared_template
   script:
     - python script/autobuild.py samba-libs       --verbose --tail --testbase /tmp/samba-testbase
 
 build_samba_static:
-  stage: build
-  tags:
-    - docker
-    - shared
+  <<: *shared_template
   script:
     - python script/autobuild.py samba-static     --verbose --tail --testbase /tmp/samba-testbase
 
 build_ctdb:
-  stage: build
-  tags:
-    - docker
-    - shared
+  <<: *shared_template
   script:
     - python script/autobuild.py samba-ctdb       --verbose --tail --testbase /tmp/samba-testbase
 
 build_samba_ctdb:
-  stage: build
-  tags:
-    - docker
-    - shared
+  <<: *shared_template
   script:
     - python script/autobuild.py ctdb             --verbose --tail --testbase /tmp/samba-testbase
 
 build_others:
-  stage: build
-  tags:
-    - docker
-    - shared
+  <<: *shared_template
   script:
     - python script/autobuild.py ldb              --verbose --tail --testbase /tmp/samba-testbase
     - python script/autobuild.py pidl             --verbose --tail --testbase /tmp/samba-testbase
-- 
2.14.3


From 65d6a46e32804558f49aabfec9fcd25f67cbd454 Mon Sep 17 00:00:00 2001
From: Andrew Bartlett <abartlet at samba.org>
Date: Mon, 30 Apr 2018 20:38:43 +1200
Subject: [PATCH 3/3] gitlab-ci: Run samba-ad-dc-2 in the shared environment

This will allow more AD DC tests to run for those without access
to a private gitlab runner.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
---
 .gitlab-ci-private.yml | 6 ------
 .gitlab-ci.yml         | 6 ++++++
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/.gitlab-ci-private.yml b/.gitlab-ci-private.yml
index 24b474d3b3a..6956e712425 100644
--- a/.gitlab-ci-private.yml
+++ b/.gitlab-ci-private.yml
@@ -32,9 +32,3 @@ build_samba_ad_dc:
     # this one takes about 1 hours to finish
     - python script/autobuild.py samba-ad-dc     --verbose --tail --testbase /tmp/samba-testbase
 
-build_samba_ad_dc_2:
-  <<: *private_template
-  script:
-    # this one takes about 1 hours to finish
-    - python script/autobuild.py samba-ad-dc-2     --verbose --tail --testbase /tmp/samba-testbase
-
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b151599f12c..71e44c6081c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -46,6 +46,12 @@ build_samba_o3:
   script:
     - python script/autobuild.py samba-o3         --verbose --tail --testbase /tmp/samba-testbase
 
+build_samba_ad_dc_2:
+  <<: *shared_template
+  script:
+    # this one takes about 1 hours to finish
+    - python script/autobuild.py samba-ad-dc-2     --verbose --tail --testbase /tmp/samba-testbase
+
 build_samba_libs:
   <<: *shared_template
   script:
-- 
2.14.3



More information about the samba-technical mailing list