Browse Source

jenkins: Add makefile rule to do job creation

master
Holger Hans Peter Freyther 4 years ago
parent
commit
82ee682b67
  1. 1
      .gitignore
  2. 45
      Makefile
  3. 29
      jenkins/job_templates/view.xml

1
.gitignore

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

45
Makefile

@ -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))

29
jenkins/job_templates/view.xml

@ -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>
Loading…
Cancel
Save