aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel P. Berrangé <berrange@redhat.com>2022-03-11 13:56:40 +0000
committerDaniel P. Berrangé <berrange@redhat.com>2022-05-11 13:22:21 +0100
commit2658b0ed87815a00375738e666146e5d0e71fd18 (patch)
tree0140ac76fef636c579b3e48769cffccefbb8e7f8
parent46e91d9d2d5e2a355df9245ab5b3c29100db76e7 (diff)
downloadlibvirt-ci-2658b0ed87815a00375738e666146e5d0e71fd18.zip
libvirt-ci-2658b0ed87815a00375738e666146e5d0e71fd18.tar.gz
libvirt-ci-2658b0ed87815a00375738e666146e5d0e71fd18.tar.bz2
lcitool/manifest: split gitlab sanity check jobs into separate file
Currently ci/gitlab.yml contains all the generated build logic. This continues from the previous commit by splitting the sanity check jobs into a separate file called 'ci/gitlab/sanity-checks.yml' Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-rw-r--r--guests/lcitool/lcitool/manifest.py13
-rw-r--r--guests/lcitool/tests/data/manifest/out/ci/gitlab.yml53
-rw-r--r--guests/lcitool/tests/data/manifest/out/ci/gitlab/sanity-checks.yml50
-rw-r--r--guests/lcitool/tests/test_manifest.py1
4 files changed, 61 insertions, 56 deletions
diff --git a/guests/lcitool/lcitool/manifest.py b/guests/lcitool/lcitool/manifest.py
index 39425be..f264366 100644
--- a/guests/lcitool/lcitool/manifest.py
+++ b/guests/lcitool/lcitool/manifest.py
@@ -295,14 +295,19 @@ class Manifest:
self._replace_file(content, path, dryrun)
includes.append(path)
+ testcontent = []
if jobinfo["check-dco"]:
- gitlabcontent.append(gitlab.check_dco_job(namespace))
+ testcontent.append(gitlab.check_dco_job(namespace))
if jobinfo["cargo-fmt"]:
- gitlabcontent.append(gitlab.cargo_fmt_job())
+ testcontent.append(gitlab.cargo_fmt_job())
if jobinfo["go-fmt"]:
- gitlabcontent.append(gitlab.go_fmt_job())
+ testcontent.append(gitlab.go_fmt_job())
if jobinfo["clang-format"]:
- gitlabcontent.append(gitlab.clang_format_job())
+ testcontent.append(gitlab.clang_format_job())
+
+ path = Path(gitlabdir, "sanity-checks.yml")
+ self._replace_file(testcontent, path, dryrun)
+ includes.append(path)
if gitlabinfo["containers"]:
gitlabcontent.extend(self._generate_gitlab_native_container_jobs())
diff --git a/guests/lcitool/tests/data/manifest/out/ci/gitlab.yml b/guests/lcitool/tests/data/manifest/out/ci/gitlab.yml
index 28bbb2e..ea90c2a 100644
--- a/guests/lcitool/tests/data/manifest/out/ci/gitlab.yml
+++ b/guests/lcitool/tests/data/manifest/out/ci/gitlab.yml
@@ -1,58 +1,7 @@
include:
- local: 'ci/gitlab/container-templates.yml'
- local: 'ci/gitlab/build-templates.yml'
-
-check-dco:
- stage: sanity_checks
- needs: []
- image: registry.gitlab.com/libvirt/libvirt-ci/check-dco:master
- script:
- - /check-dco test-group
- except:
- variables:
- - $CI_PROJECT_NAMESPACE == 'test-group'
- variables:
- GIT_DEPTH: 1000
-
-
-cargo-fmt:
- stage: sanity_checks
- image: registry.gitlab.com/libvirt/libvirt-ci/cargo-fmt:master
- needs: []
- script:
- - /cargo-fmt
- artifacts:
- paths:
- - cargo-fmt.txt
- expire_in: 1 week
- when: on_failure
-
-
-go-fmt:
- stage: sanity_checks
- image: registry.gitlab.com/libvirt/libvirt-ci/go-fmt:master
- needs: []
- script:
- - /go-fmt
- artifacts:
- paths:
- - go-fmt.patch
- expire_in: 1 week
- when: on_failure
-
-
-clang-format:
- stage: sanity_checks
- image: registry.gitlab.com/libvirt/libvirt-ci/clang-format:master
- needs: []
- script:
- - /clang-format
- artifacts:
- paths:
- - clang-format.patch
- expire_in: 1 week
- when: on_failure
-
+ - local: 'ci/gitlab/sanity-checks.yml'
# Native container jobs
diff --git a/guests/lcitool/tests/data/manifest/out/ci/gitlab/sanity-checks.yml b/guests/lcitool/tests/data/manifest/out/ci/gitlab/sanity-checks.yml
new file mode 100644
index 0000000..a966463
--- /dev/null
+++ b/guests/lcitool/tests/data/manifest/out/ci/gitlab/sanity-checks.yml
@@ -0,0 +1,50 @@
+check-dco:
+ stage: sanity_checks
+ needs: []
+ image: registry.gitlab.com/libvirt/libvirt-ci/check-dco:master
+ script:
+ - /check-dco test-group
+ except:
+ variables:
+ - $CI_PROJECT_NAMESPACE == 'test-group'
+ variables:
+ GIT_DEPTH: 1000
+
+
+cargo-fmt:
+ stage: sanity_checks
+ image: registry.gitlab.com/libvirt/libvirt-ci/cargo-fmt:master
+ needs: []
+ script:
+ - /cargo-fmt
+ artifacts:
+ paths:
+ - cargo-fmt.txt
+ expire_in: 1 week
+ when: on_failure
+
+
+go-fmt:
+ stage: sanity_checks
+ image: registry.gitlab.com/libvirt/libvirt-ci/go-fmt:master
+ needs: []
+ script:
+ - /go-fmt
+ artifacts:
+ paths:
+ - go-fmt.patch
+ expire_in: 1 week
+ when: on_failure
+
+
+clang-format:
+ stage: sanity_checks
+ image: registry.gitlab.com/libvirt/libvirt-ci/clang-format:master
+ needs: []
+ script:
+ - /clang-format
+ artifacts:
+ paths:
+ - clang-format.patch
+ expire_in: 1 week
+ when: on_failure
diff --git a/guests/lcitool/tests/test_manifest.py b/guests/lcitool/tests/test_manifest.py
index 34a4691..14ab884 100644
--- a/guests/lcitool/tests/test_manifest.py
+++ b/guests/lcitool/tests/test_manifest.py
@@ -116,6 +116,7 @@ def test_generate(monkeypatch, custom_projects):
assert_write(Path("ci", "gitlab.yml"))
assert_write(Path("ci", "gitlab", "container-templates.yml"))
assert_write(Path("ci", "gitlab", "build-templates.yml"))
+ assert_write(Path("ci", "gitlab", "sanity-checks.yml"))
assert_write(Path("ci", "cirrus", "freebsd-current.vars"))
assert_write(Path("ci", "cirrus", "macos-11.vars"))
assert_write(Path("ci", "containers", "centos-stream-9.Dockerfile"))