mirror of https://gerrit.osmocom.org/osmo-ci
Oliver Smith
35030b7618
Harald requested that the OBS scripts should not stop if building one specific source package fails, instead it should keep going and report at the end a non-success exit code. Given that the shell script code has historically grown and became hard to maintain, I decided to rewrite the scripts for implementing this feature. This rewrite solves additional problems: * No full checkout of an OBS project like network:osmocom:latest anymore, with lots of packages that won't get updated (e.g. the uhd package has a uhd-images_3.14.1.1.tar.xz file that is 108 MB). With the old code, developers had to wait minutes during the checkout before the script reaches code that is currently being developed. Now only single packages get checked out right before they get updated. * No need to clone git repositories over and over. With the new code, git repos only get cloned if needed (for latest it is not needed if the remote git tag is the same as the version in OBS). During development, the cloned git repositories are cached. * Output from commands like "git tag -l" is not written to the log unless they failed. This makes the log more readable, which is especially important when a package fails to build, we keep going and need to spot the build error in the middle of the log later on. * No more duplicated code for nightly and latest scripts that worked similar but had slight differences. Also the list of packages is not duplicated for nightly and latest anymore; nightly uses all packages and latest uses packages that have at least one git tag. * Building source packages is decoupled from uploading them. A separate script build_srcpkg.py can be used to just build the deb + rpm spec source packages, without interacting with the OBS server. * The scripts can optionally run in docker with a command-line switch, and this is used by jenkins. This way we don't need to install more dependencies on the host such as rebar3 which is now needed for erlang/osmo_dia2gsup. * Add erlang/osmo_dia2gsup and run its generate_build_dep.sh (SYS#6006) I have done the new implementation in python to make use of argparse and to be able to use try/except and print a trace when building one package fails. Example output: * https://jenkins.osmocom.org/jenkins/job/Osmocom_OBS_nightly_obs.osmocom.org/48/console * https://jenkins.osmocom.org/jenkins/job/Osmocom_OBS_latest_obs.osmocom.org/46/console Change-Id: I45a555d05a9da808c0fe0145aae665f583cb80d9 |
||
---|---|---|
.. | ||
README.adoc | ||
coverity.yml | ||
gerrit-lint.yml | ||
gerrit-verifications-dahdi.yml | ||
gerrit-verifications.yml | ||
master-builds-dahdi.yml | ||
master-builds.yml | ||
octsim_osmo-ccid-firmware.yml | ||
osmo-gsm-manuals-trigger.yml | ||
osmo-gsm-tester-builder.yml | ||
osmo-gsm-tester-runner.yml | ||
osmo-gsm-tester-trigger.yml | ||
osmo-gsm-tester_run-gerrit.sh | ||
osmo-gsm-tester_run-prod.sh | ||
osmo-gsm-tester_run-rnd.sh | ||
osmo-gsm-tester_ttcn3.sh | ||
osmocom-build-tags-against-master.yml | ||
osmocom-depcheck.yml | ||
osmocom-list-commits.yml | ||
osmocom-obs.yml | ||
osmocom-release-tarballs.yml | ||
registry-rebuild-upload-fpga-build.yml | ||
registry-rebuild-upload-titan.yml | ||
registry-triggers.yml | ||
registry-update-base-images.yml | ||
repo-install-test.yml | ||
ttcn3-testsuites-kernel-git.yml | ||
ttcn3-testsuites.yml | ||
update-osmo-ci-on-slaves.yml | ||
update-osmo-python-on-slaves.yml |
README.adoc
These jenkins.osmocom.org job definitions, managed by https://docs.openstack.org/infra/jenkins-job-builder/index.html[Jenkins Job Builder] *Prepare:* Install jenkins-job-builder: For debian 9, see troubleshooting below. Otherwise: apt-get install jenkins-job-builder Have a jenkins-job-builder.ini file. One of ~/.config/jenkins_jobs/jenkins_jobs.ini /etc/jenkins_jobs/jenkins_jobs.ini or place one in here and pass it to jenkins-jobs using the --conf file. Make sure the file not world readable to minimally safeguard your jenkins password. Instead of using your jenkins password, use an *API Token*. To retrieve your token go to Jenkins via a Webbrowser, click on your Username in the right corner, click on configure, click on *Show API Toke...*. jenkins_jobs.ini: [jenkins] user=my_user_name password=my_api_token url=https://jenkins.osmocom.org/jenkins and chmod go-rwx jenkins_jobs.ini *Update a single job on jenkins.osmocom.org:* jenkins-jobs --conf jenkins_jobs.ini update gerrit-verifications.yml gerrit-osmo-msc NOTE: when you supply a name not defined in that yml file, you will not get an error message, just nothing will happen. *Update all jobs of one file:* jenkins-jobs --conf jenkins_jobs.ini update gerrit-verifications.yml *Update all jobs in all files:* jenkins-jobs --conf jenkins_jobs.ini update ./ *Troubleshooting:* - 'jenkins.JenkinsException: create[gerrit-osmo-msc] failed' jenkins.osmocom.org is not reachable, or URL in the config file is erratic. Make sure it is exactly url=https://jenkins.osmocom.org/jenkins - newlines: Use 'key: |' to keep new lines in multiline values, e.g.: - shell: | echo hello echo world See also: * https://yaml-multiline.info/ * https://stackoverflow.com/a/21699210 - jobs named on cmdline are not updated: Make sure the job name is correct, or just issue an entire yml file without individual job names. Also be aware that jobs are only actually updated when anything changed. - debian 9 For jenkins-job-builder to work on debian 9: add 'testing' to /etc/apt/sources.list like deb http://ftp.de.debian.org/debian/ testing main then sudo apt-get update sudo apt-get -t testing install python-jenkins sudo apt-get install jenkins-job-builder and make sure to *not* pick the python3 versions (or you'll need to add catching of HTTPError to jenkins/__init__.py in 'def maybe_add_crumb') *Jenkins labels* The build jobs are using labels to specify on which nodes the job should be run. Please use the following labels - osmocom-master-debian8: are nodes which can build osmocom-master and is a debian 8 - osmocom-master-debian9: are nodes which can build osmocom-master and is a debian 9 - osmocom-gerrit-debian8: are nodes which can build osmocom-gerrit and is a debian 8 - osmocom-gerrit-debian9: are nodes which can build osmocom-gerrit and is a debian 9