jenkins: Add makefile rule to do job creation

This commit is contained in:
Holger Hans Peter Freyther 2017-08-10 11:38:09 +08:00
parent aca779cdc5
commit 82ee682b67
3 changed files with 71 additions and 4 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ build.*
*.sw?
downloads/
jenkins/*.xml
jenkins-cli.jar

View File

@ -39,7 +39,17 @@ BUILD_TARGET_sysmocom-alix = "core-image-minimal-initramfs meta-toolchain-osmo t
BUILD_TARGETS="$(BUILD_TARGET_$(CUR_MACHINE))"
# Jenkins jobs...
JOB_FILES=merge_diff.xml nightly.xml show_diff.xml test_upgrade_alix.xml test_upgrade_apu2.xml testbranch.xml testing.xml
JOB_FILES=merge_diff.xml nightly.xml show_diff.xml testing.xml test_upgrade_alix.xml test_upgrade_apu2.xml testbranch.xml
JOB_NAME_merge_diff.xml=$(SYSMOCOM_RELEASE)-merge-diff
JOB_NAME_nightly.xml=$(SYSMOCOM_RELEASE)-nightly
JOB_NAME_show_diff.xml=$(SYSMOCOM_RELEASE)-show-diff
JOB_NAME_testing.xml=$(SYSMOCOM_RELEASE)-testing
JOB_NAME_test_upgrade_alix.xml=$(SYSMOCOM_RELEASE)-test-upgrade-alix
JOB_NAME_test_upgrade_apu2.xml=$(SYSMOCOM_RELEASE)-test-upgrade-apu2
JOB_NAME_testbranch.xml=$(SYSMOCOM_RELEASE)-testbranch
JOB_NAME="$(JOB_NAME_$(job))"
VIEW_FILES=view.xml
ALL_JENKINS_FILES=$(JOB_FILES) $(VIEW_FILES)
SED=sed
#
@ -174,14 +184,41 @@ endif
@echo " User = $(SSH_USER)" >> $(HOME)/.ssh/config
# Create jenkin job xmls
create-jenkins-jobs:
$(Q)$(foreach file, $(JOB_FILES), \
create-jenkins-jobs-xml:
$(Q)$(foreach file, $(ALL_JENKINS_FILES), \
cat jenkins/job_templates/$(file) | \
$(SED) \
-e s,PLACEHOLDER_SYSMOCOM_RELEASE,$(SYSMOCOM_RELEASE),g \
-e s,PLACEHOLDER_POKY_RELEASE,$(POKY_RELEASE),g > jenkins/$(file); \
)
create-jenkins-jobs: create-jenkins-jobs-xml jenkins-cli.jar
ifndef JENKINS_HOST
$(error "Please call with make $@ JENKINS_HOST=xyz...")
endif
ifndef JENKINS_USER
$(error "Please call with make $@ JENKINS_USER=xyz...")
endif
ifndef JENKINS_PASS
$(error "Please call with make $@ JENKINS_PASS=xyz...")
endif
$(Q)$(foreach view, $(VIEW_FILES), \
cat jenkins/$(view) | java -jar jenkins-cli.jar -s http://$(JENKINS_HOST) \
create-view --username $(JENKINS_USER) --password $(JENKINS_PASS); \
)
$(Q)$(foreach job, $(JOB_FILES), \
cat jenkins/$(job) | java -jar jenkins-cli.jar -s http://$(JENKINS_HOST) \
create-job --username $(JENKINS_USER) --password $(JENKINS_PASS) $(JOB_NAME); \
)
jenkins-cli.jar:
ifndef JENKINS_HOST
$(error "Please call with make $@ JENKINS_HOST=xyz...")
endif
wget http://$(JENKINS_HOST)/jnlpJars/jenkins-cli.jar
# Target classification
.PHONY: update setup-all install-ssh-config create-jenkins-jobs
.PHONY: update setup-all install-ssh-config create-jenkins-jobs-xml create-jenkins-jobs
.SECONDARY: $(foreach repo, $(REPOS), git/$(repo)) $(foreach machine, $(MACHINES), build.$(machine))

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<hudson.model.ListView>
<name>System Images PLACEHOLDER_SYSMOCOM_RELEASE</name>
<filterExecutors>false</filterExecutors>
<filterQueue>false</filterQueue>
<properties class="hudson.model.View$PropertyList"/>
<jobNames>
<comparator class="hudson.util.CaseInsensitiveComparator"/>
<string>PLACEHOLDER_SYSMOCOM_RELEASE-merge-diff</string>
<string>PLACEHOLDER_SYSMOCOM_RELEASE-nightly</string>
<string>PLACEHOLDER_SYSMOCOM_RELEASE-show-diff</string>
<string>PLACEHOLDER_SYSMOCOM_RELEASE-test-upgrade-alix</string>
<string>PLACEHOLDER_SYSMOCOM_RELEASE-test-upgrade-apu2</string>
<string>PLACEHOLDER_SYSMOCOM_RELEASE-testbranch</string>
<string>PLACEHOLDER_SYSMOCOM_RELEASE-testing</string>
<string>Yocto-Master</string>
</jobNames>
<jobFilters/>
<columns>
<hudson.views.StatusColumn/>
<hudson.views.WeatherColumn/>
<hudson.views.JobColumn/>
<hudson.views.LastSuccessColumn/>
<hudson.views.LastFailureColumn/>
<hudson.views.LastDurationColumn/>
<hudson.views.BuildButtonColumn/>
</columns>
<recurse>false</recurse>
</hudson.model.ListView>