← Back to team overview

sts-sponsors team mailing list archive

[Merge] ~bjornt/maas-ci/+git/maas-ci-internal:add-make-check into ~maas-committers/maas-ci/+git/maas-ci-internal:main

 

Björn Tillenius has proposed merging ~bjornt/maas-ci/+git/maas-ci-internal:add-make-check into ~maas-committers/maas-ci/+git/maas-ci-internal:main.

Commit message:
Add a Makefile target to check that the jenkins jobs can be built.

You can now run 'make check' to ensure that nothing is broken.

I had to move launchpad-ci and the github-ci directories to make it pass, as
well as change github-ci slightly, since it was conflicting with launchpad-ci.

There's also now a lander for this project.



Requested reviews:
  MAAS Committers (maas-committers)

For more details, see:
https://code.launchpad.net/~bjornt/maas-ci/+git/maas-ci-internal/+merge/433853
-- 
Your team MAAS Committers is requested to review the proposed merge of ~bjornt/maas-ci/+git/maas-ci-internal:add-make-check into ~maas-committers/maas-ci/+git/maas-ci-internal:main.
diff --git a/.gitignore b/.gitignore
index 1efd0c8..9b58760 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
 .ve
 .vscode
 jenkins_jobs.ini
+jenkins-jobs
+output*
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..9821888
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,41 @@
+VIRTUALENV := .ve
+CHECK_OUTPUT = output-check
+
+.DEFAULT_GOAL := setup
+
+install-dependencies:
+	sudo apt-get -y install python3-venv
+
+clean:
+	rm -rf $(VIRTUALENV)
+
+setup: py-dep jenkins-jobs
+
+check: setup
+	rm -rf $(CHECK_OUTPUT)
+	./jenkins-jobs test -r --config-xml -o $(CHECK_OUTPUT) jobs/
+
+py-dep: $(VIRTUALENV)
+	$(VIRTUALENV)/bin/pip install -r requirements.txt
+
+jenkins-jobs: $(VIRTUALENV)/.dev-bin
+	ln -fs $(VIRTUALENV)/bin/jenkins-jobs
+
+
+$(VIRTUALENV):
+	python3 -m venv $(VIRTUALENV)
+
+$(VIRTUALENV)/.dev-bin:
+	$(MAKE) py-dep
+	touch $@
+
+py-freeze: VENV := .freeze_ve
+py-freeze: PIP := $(VENV)/bin/pip
+py-freeze:
+	rm -rf $(VENV)
+	python3 -m venv $(VENV)
+	$(PIP) install jenkins-job-builder
+	$(PIP) freeze | grep -E -v '^pkg-resources' > requirements.txt
+	rm -rf $(VENV)
+.PHONY: py-freeze
+
diff --git a/github-ci/github-ci.groovy b/jobs/github-ci/github-ci.groovy
similarity index 100%
rename from github-ci/github-ci.groovy
rename to jobs/github-ci/github-ci.groovy
diff --git a/github-ci/github-ci.yaml b/jobs/github-ci/github-ci.yaml
similarity index 95%
rename from github-ci/github-ci.yaml
rename to jobs/github-ci/github-ci.yaml
index fed76f2..196beb5 100644
--- a/github-ci/github-ci.yaml
+++ b/jobs/github-ci/github-ci.yaml
@@ -1,10 +1,10 @@
 - job_group:
     name: '{name}-github-ci'
     jobs:
-      - '{name}-tester'
+      - 'gh-{name}-tester'
 
 - job-template:
-    name: '{name}-tester'
+    name: 'gh-{name}-tester'
     description: |
       Github CI tester for {name}
     project-type: pipeline
@@ -74,9 +74,9 @@
     ubuntu_series: '20.04'
 
 - view-template:
-    name: '{name}'
+    name: 'gh-{name}'
     description: |
       All the jobs related to {name}.
     view-type: list
     job-name:
-      - '{name}-tester'
+      - 'gh-{name}-tester'
diff --git a/launchpad-ci/job-lander.groovy b/jobs/launchpad-ci/job-lander.groovy
similarity index 100%
rename from launchpad-ci/job-lander.groovy
rename to jobs/launchpad-ci/job-lander.groovy
diff --git a/launchpad-ci/job-reviewer.groovy b/jobs/launchpad-ci/job-reviewer.groovy
similarity index 100%
rename from launchpad-ci/job-reviewer.groovy
rename to jobs/launchpad-ci/job-reviewer.groovy
diff --git a/launchpad-ci/job-tester.groovy b/jobs/launchpad-ci/job-tester.groovy
similarity index 100%
rename from launchpad-ci/job-tester.groovy
rename to jobs/launchpad-ci/job-tester.groovy
diff --git a/launchpad-ci/launchpad b/jobs/launchpad-ci/launchpad
similarity index 100%
rename from launchpad-ci/launchpad
rename to jobs/launchpad-ci/launchpad
diff --git a/launchpad-ci/launchpad-ci-utils.groovy b/jobs/launchpad-ci/launchpad-ci-utils.groovy
similarity index 100%
rename from launchpad-ci/launchpad-ci-utils.groovy
rename to jobs/launchpad-ci/launchpad-ci-utils.groovy
diff --git a/launchpad-ci/launchpad-ci.groovy b/jobs/launchpad-ci/launchpad-ci.groovy
similarity index 100%
rename from launchpad-ci/launchpad-ci.groovy
rename to jobs/launchpad-ci/launchpad-ci.groovy
diff --git a/launchpad-ci/launchpad-ci.yaml b/jobs/launchpad-ci/launchpad-ci.yaml
similarity index 100%
rename from launchpad-ci/launchpad-ci.yaml
rename to jobs/launchpad-ci/launchpad-ci.yaml
diff --git a/launchpad-ci/repo-ubuntu-release b/jobs/launchpad-ci/repo-ubuntu-release
similarity index 100%
rename from launchpad-ci/repo-ubuntu-release
rename to jobs/launchpad-ci/repo-ubuntu-release
diff --git a/jobs/maas-ci-internal.yaml b/jobs/maas-ci-internal.yaml
new file mode 100644
index 0000000..184ff94
--- /dev/null
+++ b/jobs/maas-ci-internal.yaml
@@ -0,0 +1,11 @@
+- project:
+    name: maas-ci-internal
+    repo_lp_path: ~maas-committers/maas-ci/+git/maas-ci-internal
+    ubuntu_series: '22.04'
+    deps_command: 'make install-dependencies'
+    build_command: 'make setup'
+    test_command: 'make check'
+    jobs:
+      - '{name}-launchpad-ci'
+    views:
+      - '{name}'
diff --git a/jobs/maas-terraform-test.yaml b/jobs/maas-terraform-test.yaml
index 7f876f0..5bc6c3e 100644
--- a/jobs/maas-terraform-test.yaml
+++ b/jobs/maas-terraform-test.yaml
@@ -17,9 +17,9 @@
     repo_gh_test_path: maas-terraform-e2e-tests
     tester_agent_label: 'ci-lab'
     jobs:
-      - '{name}-tester'
+      - 'gh-{name}-tester'
     views:
-      - '{name}'
+      - 'gh-{name}'
     triggers:
       - timed: 'H H * * *'
     ssh_key: 'maas-lander-ssh-key'
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..c21be80
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,15 @@
+certifi==2022.9.24
+charset-normalizer==2.1.1
+fasteners==0.18
+idna==3.4
+jenkins-job-builder==4.1.0
+Jinja2==3.1.2
+MarkupSafe==2.1.1
+multi-key-dict==2.0.3
+pbr==5.11.0
+python-jenkins==1.7.0
+PyYAML==6.0
+requests==2.28.1
+six==1.16.0
+stevedore==4.1.1
+urllib3==1.26.13

Follow ups