Skip to content

Commit

Permalink
.gitlab-ci.yml: merge .gitlab-ci-private.yml
Browse files Browse the repository at this point in the history
`.gitlab-ci.yml` support conditional jobs with `only` and `except`.
And variables can be read from repo CI/CD settings as condition:

    build_samba:
      script: ...
      only:
        variables:
          - $SUPPORT_PRIVATE_TEST == 'yes'

Instead of having 2 copies of yml file, we can use this feature to
trigger private jobs only when a var like `SUPPORT_PRIVATE_TEST` is defined.

I've already added above var to our repos.
Once merged, we can remove custom CI config file in
gitlab repo settings, and remove .gitlab-ci-private.yml file from code.

Signed-off-by: Joe Guo <[email protected]>
Reviewed-by: Tim Beale <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>

Autobuild-User(master): Andrew Bartlett <[email protected]>
Autobuild-Date(master): Mon Feb 18 10:54:19 CET 2019 on sn-devel-144
  • Loading branch information
catalyst-joe-guo authored and abartlet committed Feb 18, 2019
1 parent 9fa698b commit 6b4ae52
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 29 deletions.
30 changes: 1 addition & 29 deletions .gitlab-ci-private.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,2 @@
include:
- '/.gitlab-ci.yml'


.private_template:
extends: .shared_template
tags:
- docker
- private
before_script:
- uname -a
- lsb_release -a
- mount
- df -h
- free -h

samba:
extends: .private_template
# this one takes about 4 hours to finish

samba-fileserver:
extends: .private_template
# this one takes about 1 hours to finish

samba-ad-dc:
extends: .private_template
# this one takes about 1 hours to finish

samba-nt4:
extends: .private_template
- '/.gitlab-ci.yml'
34 changes: 34 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,37 @@ samba-ad-dc-ntvfs:
extends: .shared_template
# this one takes about 100 mins to finish


.private_template:
extends: .shared_template
tags:
- docker
- private
before_script:
- uname -a
- lsb_release -a
- mount
- df -h
- free -h
only:
variables:
# These jobs are only run if the gitlab repo has private runners available.
# To enable private jobs, you must add the following var and value to
# your gitlab repo by navigating to:
# settings -> CI/CD -> Environment variables
- $SUPPORT_PRIVATE_TEST == "yes"

samba:
extends: .private_template
# this one takes about 4 hours to finish

samba-fileserver:
extends: .private_template
# this one takes about 1 hours to finish

samba-ad-dc:
extends: .private_template
# this one takes about 1 hours to finish

samba-nt4:
extends: .private_template

0 comments on commit 6b4ae52

Please sign in to comment.