├── .dir-locals.el ├── .gitignore ├── Jenkinsfile ├── Jenkinsfile-Walter ├── LICENSE ├── Makefile ├── README.md ├── build_configure.sh ├── build_login.sh ├── build_postprocess.sh ├── common.py ├── common.sh ├── configs ├── OpenEmbedded │ ├── combos-master.yaml │ ├── combos-pyro.yaml │ └── pyro_build.yaml ├── WRLinux10 │ ├── WRLinux-lts-17-Base_qemux86-64_glibc-small_Base.yaml │ ├── combos-WRLINUX_10_18_BASE.yaml │ ├── combos-WRLINUX_10_19_BASE.yaml │ ├── combos-WRLINUX_10_BASE.yaml │ ├── combos-master-wr.yaml │ ├── jenkins_job_configs.yaml │ └── test_configs.yaml ├── WRLinux9 │ ├── WRLinux-9-Base_qemux86-64_glibc-small_Base.yaml │ ├── combos-WRLINUX_9_BASE.yaml │ ├── combos-WRLINUX_9_LTS_CVE.yaml │ ├── jenkins_job_configs.yaml │ └── test_configs.yaml ├── jenkins_job_configs.yaml └── test_configs.yaml ├── create_folder.sh ├── docker_run_check.sh ├── docs └── devbuilds.md ├── es-kibana.yaml ├── images ├── docker-jenkins-swarm-client │ ├── .gitignore │ ├── Dockerfile │ ├── LICENSE │ ├── Makefile │ ├── README.md │ ├── hooks │ │ └── build │ └── scripts │ │ └── docker-entrypoint.sh ├── jenkins-master │ ├── .gitignore │ ├── Dockerfile │ ├── LICENSE │ ├── Makefile │ ├── README.md │ ├── init_scripts │ │ ├── configure_jenkins_url.groovy │ │ ├── create_user.groovy │ │ ├── default_project_auth.groovy │ │ ├── disable_jobdsl_script_security.groovy │ │ ├── disable_remote_cli.groovy │ │ └── executors.groovy │ └── jobs │ │ ├── Login.xml │ │ ├── WRLinux_Build.xml │ │ ├── Walter.xml │ │ ├── devbuild.xml │ │ ├── devbuilds.xml │ │ └── folder_create.xml ├── nginx │ ├── Dockerfile │ ├── LICENSE │ ├── Makefile │ ├── README.md │ ├── imagescripts │ │ ├── create_config.sh │ │ ├── custom_server.sh │ │ ├── default_server.sh │ │ ├── docker-entrypoint.sh │ │ ├── port_redirect.sh │ │ └── reverse_proxy.sh │ └── scripts │ │ ├── build.sh │ │ ├── container.cfg │ │ ├── rmi.sh │ │ └── scripts.cfg ├── postbuild │ ├── Dockerfile │ ├── Makefile │ └── README.md ├── rsync │ ├── .gitignore │ ├── Dockerfile │ ├── LICENSE │ ├── Makefile │ ├── README.md │ └── conf │ │ └── rsyncd.conf ├── toaster_aggregator │ ├── .gitignore │ ├── Dockerfile │ ├── MANIFEST.in │ ├── Makefile │ ├── development.ini │ ├── docker-production.ini │ ├── production.ini │ ├── setup.py │ └── toaster_aggregator │ │ ├── __init__.py │ │ ├── aggregator.py │ │ ├── consul_query.py │ │ ├── static │ │ ├── jquery-compat-git.js │ │ ├── jquery.dataTables.min.css │ │ ├── jquery.dataTables.min.js │ │ ├── normalize.css │ │ ├── running_build_reload.js │ │ ├── skeleton.css │ │ └── tablesearch.js │ │ └── templates │ │ └── builds.jinja2 ├── ubuntu1604_builder │ ├── .gitignore │ ├── Dockerfile │ ├── LICENSE │ ├── Makefile │ └── README.md └── ubuntu1804 │ ├── Dockerfile │ ├── LICENSE │ ├── Makefile │ └── README.md ├── index.html ├── jenkins_build.sh ├── jenkins_job_create.py ├── jenkins_job_submit.py ├── jobs ├── Jenkinsfile-devbuild ├── Jenkinsfile-login ├── Login.xml ├── WRLinux_Build.xml ├── Walter.xml ├── devbuilds.xml ├── devbuilds │ └── devbuild.xml ├── folder_create.xml └── get_job_config.py ├── layerindex ├── commands │ └── layer_update.py ├── docker-compose.yaml ├── layerindex_branch_reload.sh ├── layerindex_export.sh ├── layerindex_layer_reload.sh ├── layerindex_layer_update.sh ├── layerindex_start.sh ├── layerindex_stop.sh ├── settings.py └── transform_index.py ├── notconfigure.sh ├── oe_build.sh ├── poky_setup.sh ├── run_tests.sh ├── scripts ├── cleanup.sh ├── display_build_log.sh ├── report.sh ├── rsync.sh └── send_mail.sh ├── setup_workspace_login.sh ├── start_devbuild.sh ├── start_jenkins.sh ├── test ├── config.xml ├── custom_images.yaml ├── fedora_build.yaml ├── local.conf ├── recipes.yaml ├── sdk_core.yaml ├── single_machine.yaml └── upload_devbuild.sh ├── test_configure.py ├── test_postprocess.sh ├── vars └── Wrigel.groovy ├── workspace_login.sh ├── wr-lx-setup.sh ├── wrl-ci.yaml ├── wrlinux_update.sh └── yaml ├── __init__.py ├── composer.py ├── constructor.py ├── cyaml.py ├── dumper.py ├── emitter.py ├── error.py ├── events.py ├── loader.py ├── nodes.py ├── parser.py ├── reader.py ├── representer.py ├── resolver.py ├── scanner.py ├── serializer.py └── tokens.py /.dir-locals.el: -------------------------------------------------------------------------------- 1 | ;;; Directory Local Variables 2 | ;;; For more information see (info "(emacs) Directory Variables") 3 | 4 | ((python-mode . ((eval progn 5 | (setq python-shell-virtualenv-root 6 | (concat 7 | (locate-dominating-file default-directory dir-locals-file) 8 | "/.venv"))) 9 | (encoding . utf-8))) 10 | ) 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | .#* 3 | *.swp 4 | *.elc 5 | .venv/* 6 | jenkins_auth.txt 7 | wrigel-configs/* 8 | wrigel-configs 9 | flycheck_* 10 | -------------------------------------------------------------------------------- /Jenkinsfile-Walter: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env groovy 2 | // -*- mode: groovy; tab-width: 2; groovy-indent-offset: 2 -*- 3 | 4 | node('docker') { 5 | 6 | stage('Docker Run Check') { 7 | dir('ci-scripts') { 8 | git(url:params.CI_REPO, branch:params.CI_BRANCH) 9 | } 10 | sh "${WORKSPACE}/ci-scripts/docker_run_check.sh" 11 | } 12 | 13 | def pipeline 14 | 15 | stage('Generate Config') { 16 | writeFile file: "${WORKSPACE}/pipeline.yaml", text: params.YAML 17 | pipeline = readYaml text: params.YAML 18 | } 19 | 20 | stage('Fetch Walter') { 21 | echo "Fetching Walter..." 22 | def bin = params.WALTER_BINARY 23 | sh "curl ${bin} -o ${WORKSPACE}/walter" 24 | sh "chmod +x ${WORKSPACE}/walter" 25 | } 26 | 27 | for (curStage in pipeline.stages) { 28 | String STAGE_NAME = curStage.name 29 | stage("${STAGE_NAME}") { 30 | sh "${WORKSPACE}/walter -config ${WORKSPACE}/pipeline.yaml -stage \"${STAGE_NAME}\"" 31 | } 32 | } 33 | 34 | stage('Post Process') { 35 | sh "rm -f ${WORKSPACE}/pipeline.yaml" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Wind River Systems Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 Wind River Systems Inc. 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | # 10 | # The above copyright notice and this permission notice shall be included in all 11 | # copies or substantial portions of the Software. 12 | # 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | SHELL = /bin/bash #requires bash 22 | VENV = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/.venv 23 | DEPS = $(wildcard *.py) 24 | GET_PIP = $(VENV)/bin/get-pip.py 25 | PIP = $(VENV)/bin/pip3 26 | 27 | .PHONY: build image setup clean test help 28 | 29 | .DEFAULT_GOAL := help 30 | 31 | help: 32 | @echo "Make options for jenkins ci development" 33 | @echo 34 | @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-10s\033[0m %s\n", $$1, $$2}' 35 | 36 | # Use get-pip.py to avoid requiring installation of ensurepip package 37 | $(VENV): 38 | type python3 >/dev/null 2>&1 || { echo >&2 "Python3 required. Aborting."; exit 1; }; \ 39 | test -d $(VENV) || python3 -m venv --without-pip $(VENV); \ 40 | touch $(VENV); \ 41 | wget -O $(GET_PIP) https://bootstrap.pypa.io/get-pip.py; \ 42 | $(VENV)/bin/python3 $(GET_PIP) --ignore-installed; \ 43 | $(PIP) install pylint flake8 python-jenkins PyYAML requests gitpython; 44 | 45 | setup: $(VENV) ## Install all python dependencies in .venv 46 | 47 | volume_clean: ## Delete named docker volumes 48 | type docker >/dev/null 2>&1 && \ 49 | { \ 50 | docker volume rm ci_jenkins_agent; \ 51 | docker volume rm ci_jenkins_home; \ 52 | docker volume rm ci_rproxy_nginx_config; \ 53 | } 54 | 55 | clean: ## Delete virtualenv 56 | rm -rf $(VENV) 57 | -------------------------------------------------------------------------------- /build_configure.sh: -------------------------------------------------------------------------------- 1 | notconfigure.sh -------------------------------------------------------------------------------- /build_login.sh: -------------------------------------------------------------------------------- 1 | workspace_login.sh -------------------------------------------------------------------------------- /build_postprocess.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (c) 2017 Wind River Systems Inc. 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | 24 | function setup_post_scripts { 25 | local POST_DIR="$1" 26 | local POST_SCRIPTS="$2" 27 | local BUILD="$3" 28 | local SCRIPT= 29 | local COUNTER_STR= 30 | 31 | mkdir -p "${BUILD}/${POST_DIR}" 32 | 33 | COUNTER=0 34 | set -f; IFS=, 35 | for SCRIPT in $POST_SCRIPTS; do 36 | COUNTER_STR=$(printf "%02d" "$COUNTER") 37 | local SCRIPT_FULLPATH="$WORKSPACE/ci-scripts/scripts/${SCRIPT}.sh" 38 | if [ -f "$SCRIPT_FULLPATH" ]; then 39 | ln -s "$SCRIPT_FULLPATH" "${BUILD}/${POST_DIR}/${COUNTER_STR}-$SCRIPT" 40 | fi 41 | COUNTER=$((COUNTER + 1)) 42 | done 43 | set +f; unset IFS 44 | } 45 | 46 | run_post_scripts() 47 | { 48 | local BUILD="$1" 49 | local POST_SCRIPT_DIR="$2" 50 | 51 | if [ -d "$BUILD/$POST_SCRIPT_DIR" ]; then 52 | ( 53 | run-parts --arg="$BUILD" --arg="$WORKSPACE/ci-scripts" \ 54 | -- "$BUILD/$POST_SCRIPT_DIR" 55 | ) 56 | fi 57 | } 58 | 59 | main() 60 | { 61 | local BUILD="$WORKSPACE/builds/builds-$BUILD_ID" 62 | cd "$BUILD" || exit 1 63 | 64 | setup_post_scripts "post-success.d" "$POST_SUCCESS" "$BUILD" 65 | setup_post_scripts "post-fail.d" "$POST_FAIL" "$BUILD" 66 | 67 | if [ -f "00-PASS" ]; then 68 | run_post_scripts "$BUILD" "post-success.d" 69 | elif [ -f "00-FAIL" ]; then 70 | run_post_scripts "$BUILD" "post-fail.d" 71 | fi 72 | } 73 | 74 | main "$@" 75 | -------------------------------------------------------------------------------- /configs/OpenEmbedded/combos-master.yaml: -------------------------------------------------------------------------------- 1 | - branch: master 2 | build: 3 | - bitbake 4 | - core-image-minimal 5 | name: master-minimal 6 | prebuild: 7 | - build_configure.sh 8 | - --enable-shared-sstate=oecore_sstate 9 | - --enable-bootimage=ext4 10 | setup: 11 | - wr-lx-setup.sh 12 | - --machine=qemux86-64 13 | - --distro=poky 14 | - --layers=meta-poky 15 | -------------------------------------------------------------------------------- /configs/OpenEmbedded/combos-pyro.yaml: -------------------------------------------------------------------------------- 1 | - branch: pyro 2 | build: 3 | - bitbake 4 | - core-image-minimal 5 | name: pyro-minimal 6 | prebuild: 7 | - build_configure.sh 8 | - --enable-bootimage=ext4 9 | setup: 10 | - poky_setup.sh 11 | - --machine=qemux86-64 12 | -------------------------------------------------------------------------------- /configs/WRLinux10/combos-WRLINUX_10_BASE.yaml: -------------------------------------------------------------------------------- 1 | - branch: WRLINUX_10_17_LTS 2 | build: 3 | - 'bitbake wrlinux-image-glibc-std' 4 | name: intel-x86-64_wrlinux-image-glibc-std 5 | prebuild: 6 | - build_configure.sh 7 | - --enable-shared-sstate=wrl10_sstate_cache 8 | setup: 9 | - --distro=wrlinux 10 | - --machine=intel-x86-64 11 | - --dl-layers 12 | - --accept-eula=yes 13 | 14 | - branch: WRLINUX_10_17_LTS 15 | build: 16 | - 'bitbake wrlinux-image-glibc-std' 17 | name: intel-x86-32_wrlinux-image-glibc-std 18 | prebuild: 19 | - build_configure.sh 20 | - --enable-shared-sstate=wrl10_sstate_cache 21 | setup: 22 | - --distro=wrlinux 23 | - --machine=intel-x86-32 24 | - --dl-layers 25 | - --accept-eula=yes 26 | 27 | - branch: WRLINUX_10_17_LTS 28 | build: 29 | - 'bitbake wrlinux-image-glibc-std' 30 | name: intel-skylake-32_wrlinux-image-glibc-std 31 | prebuild: 32 | - build_configure.sh 33 | - --enable-shared-sstate=wrl10_sstate_cache 34 | setup: 35 | - --distro=wrlinux 36 | - --machine=intel-skylake-32 37 | - --dl-layers 38 | - --accept-eula=yes 39 | 40 | - branch: WRLINUX_10_17_LTS 41 | build: 42 | - 'bitbake wrlinux-image-glibc-std' 43 | name: intel-skylake-64_wrlinux-image-glibc-std 44 | prebuild: 45 | - build_configure.sh 46 | - --enable-shared-sstate=wrl10_sstate_cache 47 | setup: 48 | - --distro=wrlinux 49 | - --machine=intel-skylake-64 50 | - --dl-layers 51 | - --accept-eula=yes 52 | 53 | - branch: WRLINUX_10_17_LTS 54 | build: 55 | - 'bitbake wrlinux-image-glibc-std' 56 | name: intel-skylake-avx512-32_wrlinux-image-glibc-std 57 | prebuild: 58 | - build_configure.sh 59 | - --enable-shared-sstate=wrl10_sstate_cache 60 | setup: 61 | - --distro=wrlinux 62 | - --machine=intel-skylake-avx512-32 63 | - --dl-layers 64 | - --accept-eula=yes 65 | 66 | - branch: WRLINUX_10_17_LTS 67 | build: 68 | - 'bitbake wrlinux-image-glibc-std' 69 | name: intel-skylake-avx512-64_wrlinux-image-glibc-std 70 | prebuild: 71 | - build_configure.sh 72 | - --enable-shared-sstate=wrl10_sstate_cache 73 | setup: 74 | - --distro=wrlinux 75 | - --machine=intel-skylake-avx512-64 76 | - --dl-layers 77 | - --accept-eula=yes 78 | 79 | - branch: WRLINUX_10_17_LTS 80 | build: 81 | - 'bitbake wrlinux-image-glibc-std' 82 | name: nxp-imx7_wrlinux-image-glibc-std 83 | prebuild: 84 | - build_configure.sh 85 | - --enable-bootimage=ext4 86 | - --enable-shared-sstate=wrl10_sstate_cache 87 | setup: 88 | - --distro=wrlinux 89 | - --machine=nxp-imx7 90 | - --dl-layers 91 | - --accept-eula=yes 92 | 93 | - branch: WRLINUX_10_17_LTS 94 | build: 95 | - 'bitbake wrlinux-image-glibc-std' 96 | name: nxp-ls20xx_wrlinux-image-glibc-std 97 | prebuild: 98 | - build_configure.sh 99 | - --enable-shared-sstate=wrl10_sstate_cache 100 | setup: 101 | - --distro=wrlinux 102 | - --machine=nxp-ls20xx 103 | - --dl-layers 104 | - --accept-eula=yes 105 | 106 | - branch: WRLINUX_10_17_LTS 107 | build: 108 | - 'bitbake wrlinux-image-glibc-std' 109 | name: nxp-ls10xx_wrlinux-image-glibc-std 110 | prebuild: 111 | - build_configure.sh 112 | - --enable-shared-sstate=wrl10_sstate_cache 113 | setup: 114 | - --distro=wrlinux 115 | - --machine=nxp-ls10xx 116 | - --dl-layers 117 | - --accept-eula=yes 118 | 119 | - branch: WRLINUX_10_17_LTS 120 | build: 121 | - 'bitbake wrlinux-image-glibc-std' 122 | name: xilinx-zynqmp_wrlinux-image-glibc-std 123 | prebuild: 124 | - build_configure.sh 125 | - --enable-bootimage=ext4 126 | - --enable-shared-sstate=wrl10_sstate_cache 127 | setup: 128 | - --distro=wrlinux 129 | - --machine=xilinx-zynqmp 130 | - --dl-layers 131 | - --accept-eula=yes 132 | 133 | - branch: WRLINUX_10_17_LTS 134 | build: 135 | - 'bitbake wrlinux-image-glibc-std' 136 | name: qemuarma9_wrlinux-image-glibc-std 137 | prebuild: 138 | - build_configure.sh 139 | - --enable-shared-sstate=wrl10_sstate_cache 140 | setup: 141 | - --distro=wrlinux 142 | - --machine=qemuarma9 143 | - --dl-layers 144 | - --accept-eula=yes 145 | 146 | - branch: WRLINUX_10_17_LTS 147 | build: 148 | - 'bitbake wrlinux-image-glibc-std' 149 | name: qemuarm64_wrlinux-image-glibc-std 150 | prebuild: 151 | - build_configure.sh 152 | - --enable-shared-sstate=wrl10_sstate_cache 153 | setup: 154 | - --distro=wrlinux 155 | - --machine=qemuarm64 156 | - --dl-layers 157 | - --accept-eula=yes 158 | 159 | - branch: WRLINUX_10_17_LTS 160 | build: 161 | - 'bitbake wrlinux-image-glibc-std' 162 | name: qemux86-64_wrlinux-image-glibc-std 163 | prebuild: 164 | - build_configure.sh 165 | - --enable-bootimage=ext4 166 | - --enable-shared-sstate=wrl10_sstate_cache 167 | setup: 168 | - --distro=wrlinux 169 | - --machine=qemux86-64 170 | - --dl-layers 171 | - --accept-eula=yes 172 | - --templates=feature/ptest 173 | -------------------------------------------------------------------------------- /configs/WRLinux9/test_configs.yaml: -------------------------------------------------------------------------------- 1 | - name: oeqa-default-test 2 | prebuild_cmd_for_test: 3 | - test_configure.py 4 | build_cmd_for_test: 5 | - bitbake wrlinux-image-glibc-std -c testexport 6 | build_options: 7 | - INHERIT += "testexport" 8 | - IMAGE_INSTALL_append += "python3-pip" 9 | - TEST_TARGET_IP = "localhost" 10 | - TEST_SERVER_IP = "localhost" 11 | - TEST_SUITES = "ping ssh df date scp pam perl python rpm" 12 | lava_test_repo: git://ala-lxgit.wrs.com/lpd-ops/lava-test.git 13 | simics: 14 | job_template: lava-test/jobs/templates/wrlinux-9/x86_simics_job_oeqa-default-test_template.yaml 15 | timeout: 420 16 | baytrail_simics: 17 | job_template: lava-test/jobs/templates/wrlinux-9/x86_simics_job_oeqa-default-test_template.yaml 18 | timeout: 420 19 | x86-x58-ich10_simics: 20 | job_template: lava-test/jobs/templates/wrlinux-9/x86-x58-ich10_simics_job_oeqa-default-test_template.yaml 21 | timeout: 500 22 | purley_simics: 23 | job_template: lava-test/jobs/templates/wrlinux-9/purley_simics_job_oeqa-default-test_template.yaml 24 | timeout: 500 25 | hardware: 26 | job_template: lava-test/jobs/templates/wrlinux-9/x86_64_job_oeqa-default-test_template.yaml 27 | timeout: 420 28 | qemu-x86_64: 29 | job_template: lava-test/jobs/templates/wrlinux-9/x86_64_qemu_job_oeqa-default-test_template.yaml 30 | timeout: 420 31 | mxe5400-qemu-x86_64: 32 | job_template: lava-test/jobs/templates/wrlinux-9/mxe5400-x86_64_qemu_job_oeqa-default-test_template.yaml 33 | timeout: 420 34 | 35 | - name: linaro-smoke-test 36 | prebuild_cmd_for_test: 37 | - test_configure.py 38 | build_cmd_for_test: 39 | build_options: 40 | - IMAGE_INSTALL_append += "python3-pip" 41 | lava_test_repo: git://ala-lxgit.wrs.com/lpd-ops/lava-test.git 42 | simics: 43 | job_template: lava-test/jobs/templates/wrlinux-10/x86_simics_job_linaro-smoke-test_template.yaml 44 | timeout: 300 45 | baytrail_simics: 46 | job_template: lava-test/jobs/templates/wrlinux-10/x86_simics_job_linaro-smoke-test_template.yaml 47 | timeout: 300 48 | x86-x58-ich10_simics: 49 | job_template: lava-test/jobs/templates/wrlinux-10/x86-x58-ich10_simics_job_linaro-smoke-test_template.yaml 50 | timeout: 500 51 | purley_simics: 52 | job_template: lava-test/jobs/templates/wrlinux-10/purley_simics_job_linaro-smoke-test_template.yaml 53 | timeout: 500 54 | hardware: 55 | job_template: lava-test/jobs/templates/wrlinux-10/x86_64_job_linaro-smoke-test_template.yaml 56 | timeout: 300 57 | qemu-x86_64: 58 | job_template: lava-test/jobs/templates/wrlinux-10/x86_64_qemu_job_lava-smoke-test_template.yaml 59 | timeout: 300 60 | mxe5400-qemu-x86_64: 61 | job_template: lava-test/jobs/templates/wrlinux-9/mxe5400-x86_64_qemu_job_lava-smoke-test_template.yaml 62 | timeout: 300 63 | -------------------------------------------------------------------------------- /configs/jenkins_job_configs.yaml: -------------------------------------------------------------------------------- 1 | WRLinux10/jenkins_job_configs.yaml -------------------------------------------------------------------------------- /configs/test_configs.yaml: -------------------------------------------------------------------------------- 1 | WRLinux10/test_configs.yaml -------------------------------------------------------------------------------- /create_folder.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -x 2 | set -euo pipefail 3 | 4 | SERVER=https://yow-kscherer-d3.wrs.com 5 | 6 | APITOKEN=$(curl -k -s "$SERVER/auth/build_auth.txt" | tr -d '\n') 7 | 8 | CRUMB=$(curl -k -s --user "$APITOKEN" \ 9 | "$SERVER"/jenkins/crumbIssuer/api/xml?xpath='concat(//crumbRequestField,":",//crumb)' ) 10 | 11 | curl -X POST -k -H "$CRUMB" --user "$APITOKEN" \ 12 | "$SERVER/jenkins/job/folder_create/buildWithParameters?TOKEN=devbuild&NAME=devbuilds" 13 | 14 | -------------------------------------------------------------------------------- /docker_run_check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (c) 2017 Wind River Systems Inc. 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | # This script checks to see if docker can run without permission errors 24 | # If not it prints a diagnostic and attempts to set world rw permissions 25 | # on /var/run/docker.sock and tries again. 26 | 27 | docker info 28 | if [ $? != 0 ]; then 29 | echo "Unable to run 'docker info'." 30 | GID=$(stat -c '%g' /var/run/docker.sock) 31 | PERMS=$(stat -c '%A' /var/run/docker.sock) 32 | echo "/var/run/docker.sock has GID $GID with file permissions $PERMS" 33 | echo "Either add UID 1000 to group $GID or give world RW permissions to /var/run/docker.sock" 34 | echo "Attempting to add world rw permissions to /var/run/docker.sock" 35 | sudo chmod 666 /var/run/docker.sock 36 | docker info 37 | if [ $? != 0 ]; then 38 | echo "Unable to run 'docker info' even after changing permissions. Aborting." 39 | exit 1 40 | fi 41 | fi 42 | echo "Docker info successful. Proceeding with build." 43 | exit 0 44 | -------------------------------------------------------------------------------- /docs/devbuilds.md: -------------------------------------------------------------------------------- 1 | # Devbuilds 2 | 3 | ## Setup 4 | 5 | Create a WRLinux project. The example will be a WRL10 project: 6 | 7 | > git clone --branch WRLINUX_10_17_LTS --single-branch git://lxgit.wrs.com/wrlinux-x 8 | > ./wrlinux-x/setup.sh --machine qemux86-64 --dl-layers --accept-eula=yes 9 | 10 | ## Making local changes 11 | 12 | The recommended method of creating local patches is to use `repo 13 | start`. Here is an example when the repo contains a single layer: 14 | 15 | > ./.repo/repo/repo start devbuild layers/meta-dpdk 16 | > cd layers/meta-dpdk 17 | > git branch 18 | * devbuild 19 | > touch devbuild-test 20 | > git add devbuild-test 21 | > git commit -m "Devbuild test" 22 | 23 | Here is an example when the repo contains multiple layers: 24 | 25 | > ./wrlinux-x/bin/repo start devbuild layers/meta-openembedded 26 | > cd layers/meta-openembedded 27 | > git branch 28 | * devbuild 29 | > cd meta-python 30 | > touch devbuild-python-test 31 | > cd ../meta-gnome 32 | > touch debuild-gnome-test 33 | > cd ..; git add -A 34 | > git commit -m "Multiple layer devbuild test" 35 | 36 | Adding a commit without using `repo start` is also supported: 37 | 38 | > cd meta/virtualization 39 | > touch devbuild-virt-test 40 | > git add devbuild-virt-test 41 | > git commit -m "Devbuild virt test" 42 | 43 | This is not recommended because this commit would be lost if `repo 44 | sync` were run. The last commit will also be missed by `'repo status`. 45 | 46 | ## Starting a devbuild 47 | 48 | The `start_devbuild.sh` script must be located on the system: 49 | 50 | > git clone git://ala-lxgit.wrs.com/projects/wrlinux-ci/ci-scripts.git 51 | 52 | From the base of the WRLinux workarea, run the script: 53 | 54 | > /start_devbuild.sh 55 | 56 | Using the above changes as a template the script will detect the 57 | following changes: 58 | 59 | Found following local commits on layers/meta-dpdk: 60 | 6b401fb40d148fb6082cfa00076692db7a0fd64c Devbuild test 61 | 62 | Found following local commits on layers/meta-openembedded: 63 | b8ef0eaf1b68687a53233320ea7c0bb4b40450f8 Multiple layer devbuild test 64 | 65 | Found following local commits on layers/meta-virtualization: 66 | a87115407636541ca415e4315c9d72e0fc0edb28 Devbuild virt test 67 | 68 | Each repository will be forked and a branch with the commits will be 69 | pushed to ala-lxgit. 70 | 71 | Due to the way the layerindex works, every layer in a git repository 72 | with multiple sublayers (like meta-openembedded) will need to be 73 | updated. This will increase the time required for the layerindex update 74 | stage. 75 | 76 | ## Development Tips 77 | 78 | To trigger a devbuild using a development jenkins server with a 79 | ci-scripts branch: 80 | 81 | > CI_BRANCH=mydev SERVER= ./start_devbuild.sh 82 | 83 | To retrieve the admin password for Jenkins: 84 | 85 | Start Jenkins server using `start_jenkins.sh --debug` and then on 86 | the same server in a different console: 87 | 88 | > docker logs ci_jenkins_1 |& grep Admin 89 | 90 | To change the branch of the devbuilds/devbuild and WRLinux_Build jobs 91 | to be able to test changes to the Jenkinsfile-devbuild without logging 92 | in: 93 | 94 | > .venv/bin/python3 jenkins_job_create.py --jenkins --job 95 | devbuilds/devbuild --ci_branch 96 | > .venv/bin/python3 jenkins_job_create.py --jenkins --job 97 | WRLinux_Build --ci_branch 98 | 99 | It is possible that this change could be automated using the Job DSL 100 | plugin. 101 | 102 | ## Limitations 103 | 104 | - Currently triggers only a single build with the patches with hard 105 | coded build parameters 106 | - Race condition on the shared wrlinux cache repository and the 107 | deletion of the mirror-index 108 | -------------------------------------------------------------------------------- /es-kibana.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | version: '2' 3 | services: 4 | kibana: 5 | image: docker.elastic.co/kibana/kibana-oss:6.2.4 6 | environment: 7 | SERVER_NAME: $HOSTNAME 8 | ELASTICSEARCH_URL: http://elasticsearch:9200 9 | ports: 10 | - 5601:5601 11 | networks: 12 | - esnet 13 | 14 | elasticsearch: 15 | image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.2.4 16 | container_name: elasticsearch 17 | environment: 18 | discovery.type: single-node 19 | bootstrap.memory_lock: "true" 20 | ES_JAVA_OPTS: "-Xms512m -Xmx512m" 21 | ulimits: 22 | memlock: 23 | soft: -1 24 | hard: -1 25 | ports: 26 | - 9200:9200 27 | volumes: 28 | - esdata1:/usr/share/elasticsearch/data 29 | networks: 30 | - esnet 31 | 32 | volumes: 33 | esdata1: 34 | driver: local 35 | 36 | networks: 37 | esnet: 38 | -------------------------------------------------------------------------------- /images/docker-jenkins-swarm-client/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | .#* 3 | *.swp 4 | *.elc 5 | -------------------------------------------------------------------------------- /images/docker-jenkins-swarm-client/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 Wind River Systems Inc. 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | # 10 | # The above copyright notice and this permission notice shall be included in all 11 | # copies or substantial portions of the Software. 12 | # 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | FROM docker:stable 22 | 23 | ARG version=0.1.0-dev 24 | ARG build_date=unknown 25 | ARG commit_hash=unknown 26 | ARG vcs_url=unknown 27 | ARG vcs_branch=unknown 28 | 29 | LABEL maintainer="Konrad Scherer " \ 30 | org.label-schema.vendor="WindRiver" \ 31 | org.label-schema.name="docker-jenkins-swarm-client" \ 32 | org.label-schema.description="Jenkins agent using Swarm plugin with Docker" \ 33 | org.label-schema.usage="README.md" \ 34 | org.label-schema.url="https://github.com/WindRiver-OpenSourceLabs/docker-jenkins-swarm-client/blob/master/README.md" \ 35 | org.label-schema.vcs-url=$vcs_url \ 36 | org.label-schema.vcs-branch=$vcs_branch \ 37 | org.label-schema.vcs-ref=$commit_hash \ 38 | org.label-schema.version=$version \ 39 | org.label-schema.schema-version="1.0" \ 40 | org.label-schema.build-date=$build_date 41 | 42 | RUN addgroup -g 1000 jenkins && addgroup -g 997 docker && addgroup -g 996 docker2 \ 43 | && addgroup -g 998 docker3 && addgroup -g 995 docker4 \ 44 | && adduser -u 1000 -G jenkins -D -s /sbin/nologin jenkins \ 45 | && adduser jenkins docker2 && adduser jenkins docker3 && adduser jenkins docker4 \ 46 | && adduser jenkins ping && adduser jenkins jenkins \ 47 | && apk --update --no-cache add tini openjdk8-jre python git openssh openssl bash sudo py-pip curl python-dev libc-dev libffi-dev openssl-dev gcc make \ 48 | && pip install docker-compose \ 49 | && echo "jenkins ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers 50 | 51 | RUN mkdir /license-report && cd /license-report \ 52 | && curl --silent --remote-name https://raw.githubusercontent.com/WindRiver-OpenSourceLabs/license-report/master/generate_report.sh \ 53 | && apk update && sh generate_report.sh > report \ 54 | && rm -rf /var/cache/apk/* && rm /license-report/generate_report.sh 55 | 56 | ENV SWARM_CLIENT_VERSION="3.17" \ 57 | SWARM_SHA="96dfbf0ceda7a380fb94df449ddaeddec686f800" \ 58 | SWARM_HOME="/home/jenkins" \ 59 | SWARM_DELAYED_START="" \ 60 | SWARM_AGENT_USER="agent" \ 61 | COMMAND_OPTIONS="" 62 | 63 | # note busybox sha1sum requires two spaces between SHA and filename 64 | RUN wget -q https://repo.jenkins-ci.org/releases/org/jenkins-ci/plugins/swarm-client/${SWARM_CLIENT_VERSION}/swarm-client-${SWARM_CLIENT_VERSION}.jar -P /usr/bin/ \ 65 | && mv /usr/bin/swarm-client-*.jar /usr/bin/swarm-client.jar \ 66 | && echo "$SWARM_SHA /usr/bin/swarm-client.jar" | sha1sum -c - \ 67 | && mkdir -p "${SWARM_HOME}/workspace" && chown -R jenkins:jenkins "$SWARM_HOME" 68 | 69 | COPY scripts/docker-entrypoint.sh /docker-entrypoint.sh 70 | 71 | USER jenkins 72 | 73 | VOLUME ["$SWARM_HOME"] 74 | 75 | ENTRYPOINT ["/sbin/tini","--","/docker-entrypoint.sh"] 76 | -------------------------------------------------------------------------------- /images/docker-jenkins-swarm-client/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Wind River Systems Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /images/docker-jenkins-swarm-client/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 Wind River Systems Inc. 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | # 10 | # The above copyright notice and this permission notice shall be included in all 11 | # copies or substantial portions of the Software. 12 | # 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | SHELL = /bin/bash #requires bash 22 | 23 | .DEFAULT_GOAL := jenkins-swarm-client 24 | 25 | help: 26 | @echo "Make options to build Jenkins Swarm Client docker image" 27 | @echo 28 | @grep -E '^[a-zA-Z][^:]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}' 29 | 30 | jenkins-swarm-client: ## Build Jenkins Swarm Client docker image 31 | ifndef TAG 32 | $(eval TAG=latest) 33 | endif 34 | ifndef REGISTRY 35 | $(eval REGISTRY=windriver) 36 | endif 37 | docker build --rm=true --pull -t $(REGISTRY)/$@:$(TAG) -f Dockerfile . 38 | -------------------------------------------------------------------------------- /images/docker-jenkins-swarm-client/README.md: -------------------------------------------------------------------------------- 1 | # Jenkins Swarm Agent Docker Image 2 | 3 | This repository contains Dockerfile and scripts used to build the 4 | Jenkins Swarm Agent docker image hosted on Docker Hub. This image is 5 | part of the Wind River Linux Continuous Integration Project. 6 | 7 | ## Building the image 8 | 9 | To build the image windriver/jenkins-swarm-client run: 10 | 11 | make jenkins-swarm-client 12 | 13 | To build the image with a different registry and tag run: 14 | 15 | make jenkin-swarm-client TAG=test REGISTRY=internal:5000 16 | 17 | # Contributing 18 | 19 | Contributions submitted must be signed off under the terms of the Linux 20 | Foundation Developer's Certificate of Origin version 1.1. Please refer to: 21 | https://developercertificate.org 22 | 23 | To submit a patch: 24 | 25 | - Open a Pull Request on the GitHub project 26 | - Optionally create a GitHub Issue describing the issue addressed by the patch 27 | 28 | 29 | # License 30 | 31 | MIT License 32 | 33 | Copyright (c) 2017 Wind River Systems Inc. 34 | 35 | Permission is hereby granted, free of charge, to any person obtaining a copy 36 | of this software and associated documentation files (the "Software"), to deal 37 | in the Software without restriction, including without limitation the rights 38 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 39 | copies of the Software, and to permit persons to whom the Software is 40 | furnished to do so, subject to the following conditions: 41 | 42 | The above copyright notice and this permission notice shall be included in all 43 | copies or substantial portions of the Software. 44 | 45 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 46 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 47 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 48 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 49 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 50 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 51 | SOFTWARE. 52 | -------------------------------------------------------------------------------- /images/docker-jenkins-swarm-client/hooks/build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Build hook running" 4 | docker build \ 5 | --build-arg commit_hash="$(git rev-parse HEAD)" \ 6 | --build-arg vcs_url="$(git config --get remote.origin.url)" \ 7 | --build-arg vcs_branch="$(git rev-parse --abbrev-ref HEAD)" \ 8 | --build-arg build_date="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ 9 | -t "$IMAGE_NAME" . 10 | -------------------------------------------------------------------------------- /images/docker-jenkins-swarm-client/scripts/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Copyright (c) 2017 Wind River Systems Inc. 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | set -o errexit 24 | 25 | if [ -n "${SWARM_DELAYED_START}" ]; then 26 | sleep "${SWARM_DELAYED_START}" 27 | fi 28 | 29 | if ! echo "$COMMAND_OPTIONS" | grep -q -- '-fsroot' ; then 30 | COMMAND_OPTIONS="${COMMAND_OPTIONS} -fsroot ${SWARM_HOME}" 31 | fi 32 | 33 | # Use docker secret to retrieve password, but env always overrides 34 | if [ -n "${SWARM_AGENT_PASSWORD}" ]; then 35 | COMMAND_OPTIONS="${COMMAND_OPTIONS} -username ${SWARM_AGENT_USER} -password ${SWARM_AGENT_PASSWORD}" 36 | elif [ -f /run/secrets/agent_password ]; then 37 | COMMAND_OPTIONS="${COMMAND_OPTIONS} -username ${SWARM_AGENT_USER} -password $(cat /run/secrets/agent_password)" 38 | fi 39 | 40 | if [ -n "${SWARM_CLIENT_NAME}" ]; then 41 | COMMAND_OPTIONS="${COMMAND_OPTIONS} -name ${SWARM_CLIENT_NAME}" 42 | else 43 | HOSTNAME=$(cat /etc/hostname) 44 | COMMAND_OPTIONS="${COMMAND_OPTIONS} -name ${HOSTNAME}" 45 | fi 46 | 47 | java -jar "/usr/bin/swarm-client.jar" -deleteExistingClients ${COMMAND_OPTIONS} 48 | -------------------------------------------------------------------------------- /images/jenkins-master/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | .#* 3 | *.swp 4 | *.elc 5 | -------------------------------------------------------------------------------- /images/jenkins-master/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 Wind River Systems Inc. 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | # 10 | # The above copyright notice and this permission notice shall be included in all 11 | # copies or substantial portions of the Software. 12 | # 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | FROM jenkins/jenkins:lts-alpine 22 | 23 | # Increase timeout to try and avoid plugin download errors 24 | ENV CURL_CONNECTION_TIMEOUT 60 25 | 26 | # split the plugin installation into multiple stages to reduce chance of download failure 27 | RUN /usr/local/bin/install-plugins.sh git workflow-aggregator docker-workflow swarm greenballs matrix-auth leastload pipeline-utility-steps job-dsl authorize-project 28 | 29 | # init script written in groovy to setup Jenkins on startup 30 | COPY init_scripts/ /usr/share/jenkins/ref/init.groovy.d/ 31 | 32 | # Install initial job to automate creation of folders 33 | COPY jobs/folder_create.xml /usr/share/jenkins/ref/jobs/folder_create/config.xml 34 | 35 | # Install folder that will hold devbuild job with library config 36 | COPY jobs/devbuilds.xml /usr/share/jenkins/ref/jobs/devbuilds/config.xml 37 | 38 | # Install initial job to start devbuilds 39 | COPY jobs/devbuild.xml /usr/share/jenkins/ref/jobs/devbuilds/jobs/devbuild/config.xml 40 | 41 | # Install initial job to build WRLinux 42 | COPY jobs/WRLinux_Build.xml /usr/share/jenkins/ref/jobs/WRLinux_Build/config.xml 43 | 44 | # Install initial job to start Walter 45 | COPY jobs/Walter.xml /usr/share/jenkins/ref/jobs/Walter/config.xml 46 | 47 | # Install initial job for build logins 48 | COPY jobs/Login.xml /usr/share/jenkins/ref/jobs/Login/config.xml 49 | 50 | RUN echo 2.5 > /usr/share/jenkins/ref/jenkins.install.UpgradeWizard.state 51 | 52 | USER root 53 | 54 | RUN mkdir /license-report && cd /license-report \ 55 | && curl --silent --remote-name https://raw.githubusercontent.com/WindRiver-OpenSourceLabs/license-report/master/generate_report.sh \ 56 | && apk update && sh generate_report.sh > report \ 57 | && rm -rf /var/cache/apk/* && rm /license-report/generate_report.sh 58 | 59 | USER jenkins 60 | -------------------------------------------------------------------------------- /images/jenkins-master/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Wind River Systems Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /images/jenkins-master/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 Wind River Systems Inc. 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | # 10 | # The above copyright notice and this permission notice shall be included in all 11 | # copies or substantial portions of the Software. 12 | # 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | SHELL = /bin/bash #requires bash 22 | 23 | .DEFAULT_GOAL := jenkins-master 24 | 25 | help: 26 | @echo "Make options to build Jenkins Master docker image with Plugins preinstalled" 27 | @echo 28 | @grep -E '^[a-zA-Z][^:]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}' 29 | 30 | jenkins-master: ## Build Jenkins Master docker image 31 | ifndef TAG 32 | $(eval TAG=latest) 33 | endif 34 | ifndef REGISTRY 35 | $(eval REGISTRY=windriver) 36 | endif 37 | docker build --rm=true --pull -t $(REGISTRY)/$@:$(TAG) -f Dockerfile . 38 | -------------------------------------------------------------------------------- /images/jenkins-master/README.md: -------------------------------------------------------------------------------- 1 | # Jenkins Master Docker Image 2 | 3 | This repository contains Dockerfile and scripts used to build the Jenkins 4 | Master docker image hosted on Docker Hub. This image is part of the Wind 5 | River Linux Continuous Integration Project. 6 | 7 | ## Building the image 8 | 9 | To build the image windriver/jenkins-master run: 10 | 11 | make jenkins-master 12 | 13 | To build the image with a different registry and tag run: 14 | 15 | make jenkin-master TAG=test REGISTRY=internal:5000 16 | 17 | ## Contributing 18 | 19 | Contributions submitted must be signed off under the terms of the Linux 20 | Foundation Developer's Certificate of Origin version 1.1. Please refer to: 21 | https://developercertificate.org 22 | 23 | To submit a patch: 24 | 25 | - Open a Pull Request on the GitHub project 26 | - Optionally create a GitHub Issue describing the issue addressed by the patch 27 | 28 | 29 | # License 30 | 31 | MIT License 32 | 33 | Copyright (c) 2017 Wind River Systems Inc. 34 | 35 | Permission is hereby granted, free of charge, to any person obtaining a copy 36 | of this software and associated documentation files (the "Software"), to deal 37 | in the Software without restriction, including without limitation the rights 38 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 39 | copies of the Software, and to permit persons to whom the Software is 40 | furnished to do so, subject to the following conditions: 41 | 42 | The above copyright notice and this permission notice shall be included in all 43 | copies or substantial portions of the Software. 44 | 45 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 46 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 47 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 48 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 49 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 50 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 51 | SOFTWARE. 52 | -------------------------------------------------------------------------------- /images/jenkins-master/init_scripts/configure_jenkins_url.groovy: -------------------------------------------------------------------------------- 1 | import jenkins.model.* 2 | 3 | // Read the environment variable 4 | url = System.env.JENKINS_UI_URL 5 | 6 | // Get the config from our running instance 7 | urlConfig = JenkinsLocationConfiguration.get() 8 | 9 | // Set the config to be the value of the env var 10 | urlConfig.setUrl(url) 11 | 12 | // Save the configuration 13 | urlConfig.save() 14 | 15 | // Print the results 16 | println("Jenkins URL Set to " + url) 17 | -------------------------------------------------------------------------------- /images/jenkins-master/init_scripts/create_user.groovy: -------------------------------------------------------------------------------- 1 | import jenkins.model.* 2 | import jenkins.security.* 3 | import jenkins.security.apitoken.* 4 | import hudson.model.* 5 | import hudson.security.* 6 | import hudson.security.csrf.DefaultCrumbIssuer 7 | import jenkins.security.s2m.AdminWhitelistRule 8 | /** 9 | * This is the groovy script to enable global security in Jenkins-master 10 | * Major aim of jenkins security is to ensure only jenkins_job_submit.py can submit build jobs to jenkins 11 | * 12 | * This script applies matrix authority strategy to authorize three users for different authorities 13 | * Administrator user has the authority to all operations in jenkins 14 | * Agent user is for agent docker containers to discover jenkins master and create slave jenkins node 15 | * Anonymous user can only read the current jenkins status from the Web UI 16 | * 17 | * Agent user's credential is generated by start_jenkins.sh and passed through wrl-ci.yaml as ENV vars, since 18 | * client docker need to start up using those credentials 19 | * Administrator user's credential is generated in this script for this credential is never used elsewhere 20 | */ 21 | 22 | def randomStringGenerator = {String alphabet, int n -> 23 | new Random().with { 24 | (1..n).collect {alphabet[nextInt(alphabet.length()) ] }.join() 25 | } 26 | } 27 | def alphabet = (('a'..'z')+('0'..'9')).join() 28 | 29 | // Generate random password for admin user 30 | String adminUser = 'admin' 31 | def adminPassword = randomStringGenerator(alphabet, 10) 32 | 33 | if (System.env.JENKINS_INIT_DEBUG == "true") { 34 | println("Admin password: ${adminPassword}") 35 | } 36 | 37 | // Create a build user for triggering builds 38 | String buildUser = 'build' 39 | String buildPassword = randomStringGenerator(alphabet, 10) 40 | 41 | String agentUser = 'agent' 42 | String agentPassword = randomStringGenerator(alphabet, 10) 43 | 44 | // check if agent password is supplied using docker secrets 45 | def agentPassFile = new File("/run/secrets/agent_password") 46 | if (agentPassFile.exists()) { 47 | agentPassword = agentPassFile.text.trim() 48 | } 49 | 50 | // env variable always overrides 51 | if (System.env.JENKINS_AGENT_PASSWORD) { 52 | agentPassword = System.env.JENKINS_AGENT_PASSWORD 53 | } 54 | 55 | def instance = Jenkins.getInstance() 56 | // Set up admin & agent accounts to jenkins 57 | def hudsonRealm = new HudsonPrivateSecurityRealm(false) 58 | hudsonRealm.createAccount(adminUser, adminPassword) 59 | hudsonRealm.createAccount(buildUser, buildPassword) 60 | hudsonRealm.createAccount(agentUser, agentPassword) 61 | instance.setSecurityRealm(hudsonRealm) 62 | 63 | // Apply Matrix Authorization Strategy for admin, agentUser & anonymous 64 | def globalStrategy = new GlobalMatrixAuthorizationStrategy() 65 | globalStrategy.add(Jenkins.ADMINISTER, adminUser) 66 | 67 | // full access for authenticated users 68 | globalStrategy.add(Jenkins.READ, 'authenticated') 69 | globalStrategy.add(Item.BUILD, 'authenticated') 70 | globalStrategy.add(Item.READ, 'authenticated') 71 | globalStrategy.add(Item.CREATE, 'authenticated') 72 | globalStrategy.add(Item.DELETE, 'authenticated') 73 | globalStrategy.add(Item.DISCOVER, 'authenticated') 74 | globalStrategy.add(Item.CANCEL, 'authenticated') 75 | globalStrategy.add(Computer.BUILD, 'authenticated') 76 | 77 | // read only access and ability to cancel running jobs for anonymous users 78 | globalStrategy.add(Jenkins.READ,'anonymous') 79 | globalStrategy.add(Item.READ, 'anonymous') 80 | globalStrategy.add(Item.CANCEL, 'anonymous') 81 | 82 | // agent user can only manage agents 83 | globalStrategy.add(Computer.BUILD, agentUser) 84 | globalStrategy.add(Computer.CONFIGURE, agentUser) 85 | globalStrategy.add(Computer.CONNECT, agentUser) 86 | globalStrategy.add(Computer.CREATE, agentUser) 87 | globalStrategy.add(Computer.DISCONNECT, agentUser) 88 | 89 | instance.setAuthorizationStrategy(globalStrategy) 90 | 91 | // setup CSRF protection to avoid warning banner 92 | // https://wiki.jenkins.io/display/JENKINS/CSRF+Protection 93 | instance.setCrumbIssuer(new DefaultCrumbIssuer(true)) 94 | 95 | // Enable master slave access control lists 96 | // https://wiki.jenkins.io/display/JENKINS/Slave+To+Master+Access+Control 97 | new File('/var/jenkins_home/secrets/whitelisted-callables.d/gui.conf').write ' ' 98 | new File('/var/jenkins_home/secrets/filepath-filters.d/50-gui.conf').write ' ' 99 | instance.getInjector().getInstance(AdminWhitelistRule.class).setMasterKillSwitch(false) 100 | 101 | instance.save() 102 | 103 | // Output API key to a shared file bind mount to rproxy 104 | // jenkins_job_submit.py uses this API key to set up security connection and submit jobs 105 | def env = System.getenv() 106 | def authPath = new File("/var/jenkins_home/auth/") 107 | if (!authPath.exists()) { 108 | authPath.mkdirs() 109 | } 110 | 111 | def setupAuthFile(String userName, String fileName) { 112 | def authFile = new File(fileName) 113 | if (authFile.exists()) { 114 | authFile.delete() 115 | } 116 | User user = User.get(userName) 117 | ApiTokenProperty tokenProperty = user.getProperty(ApiTokenProperty.class) 118 | ApiTokenStore.TokenUuidAndPlainValue tokenUuidAndPlainValue = tokenProperty.tokenStore.generateNewToken("Initial"); 119 | authFile << userName 120 | authFile << ":" 121 | authFile << tokenUuidAndPlainValue.plainValue 122 | } 123 | 124 | setupAuthFile(adminUser, "/var/jenkins_home/auth/jenkins_auth.txt") 125 | setupAuthFile(buildUser, "/var/jenkins_home/auth/build_auth.txt") 126 | -------------------------------------------------------------------------------- /images/jenkins-master/init_scripts/default_project_auth.groovy: -------------------------------------------------------------------------------- 1 | import jenkins.* 2 | import jenkins.model.* 3 | import hudson.model.* 4 | import jenkins.model.Jenkins 5 | import org.jenkinsci.plugins.authorizeproject.* 6 | import org.jenkinsci.plugins.authorizeproject.strategy.* 7 | import jenkins.security.QueueItemAuthenticatorConfiguration 8 | 9 | def instance = Jenkins.getInstance() 10 | 11 | // default to running jobs as user that triggered them 12 | def authenticators = QueueItemAuthenticatorConfiguration.get().getAuthenticators() 13 | authenticators.add(new GlobalQueueItemAuthenticator(new TriggeringUsersAuthorizationStrategy())) 14 | 15 | instance.save() 16 | -------------------------------------------------------------------------------- /images/jenkins-master/init_scripts/disable_jobdsl_script_security.groovy: -------------------------------------------------------------------------------- 1 | // This isn't ideal, but I haven't found a way to easily whitelist the 2 | // methods that I need 3 | import javaposse.jobdsl.plugin.GlobalJobDslSecurityConfiguration 4 | import jenkins.model.GlobalConfiguration 5 | 6 | GlobalConfiguration.all().get(GlobalJobDslSecurityConfiguration.class).useScriptSecurity=false 7 | -------------------------------------------------------------------------------- /images/jenkins-master/init_scripts/disable_remote_cli.groovy: -------------------------------------------------------------------------------- 1 | // imports 2 | import jenkins.model.Jenkins 3 | import jenkins.security.s2m.* 4 | 5 | Jenkins jenkins = Jenkins.getInstance() 6 | 7 | jenkins.getDescriptor("jenkins.CLI").get().setEnabled(false) 8 | 9 | // define protocols 10 | HashSet oldProtocols = new HashSet<>(jenkins.getAgentProtocols()) 11 | oldProtocols.removeAll(Arrays.asList("JNLP3-connect", "JNLP2-connect", "JNLP-connect", "CLI-connect")) 12 | 13 | // set protocols 14 | jenkins.setAgentProtocols(oldProtocols) 15 | 16 | // save to disk 17 | jenkins.save() 18 | -------------------------------------------------------------------------------- /images/jenkins-master/init_scripts/executors.groovy: -------------------------------------------------------------------------------- 1 | import jenkins.model.* 2 | 3 | def Integer numExecutors=0 4 | if (System.env.JENKINS_MASTER_NUM_EXECUTORS) { 5 | numExecutors=Integer.parseInt(System.env.JENKINS_MASTER_NUM_EXECUTORS) 6 | } 7 | 8 | println("Num Master Executors: ${numExecutors}") 9 | Jenkins.instance.setNumExecutors(numExecutors) 10 | -------------------------------------------------------------------------------- /images/jenkins-master/jobs/Login.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | false 6 | 7 | 8 | 9 | 5 10 | 10 11 | -1 12 | -1 13 | 14 | 15 | 16 | false 17 | 18 | 19 | 20 | 21 | BUILDER 22 | 23 | 24 | true 25 | 26 | 27 | BUILD_DIR 28 | 29 | 30 | true 31 | 32 | 33 | CI_BRANCH 34 | 35 | master 36 | true 37 | 38 | 39 | CI_REPO 40 | 41 | https://github.com/WindRiver-OpenSourceLabs/ci-scripts.git 42 | true 43 | 44 | 45 | PUBLIC_SSH_KEY 46 | 47 | 48 | true 49 | 50 | 51 | IMAGE_TYPE 52 | Docker image type 53 | build 54 | true 55 | 56 | 57 | 58 | 59 | 60 | 61 | 2 62 | 63 | 64 | git://ala-lxgit.wrs.com/projects/wrlinux-ci/ci-scripts.git 65 | 66 | 67 | 68 | 69 | */master 70 | 71 | 72 | false 73 | 74 | 75 | 76 | jobs/Jenkinsfile-login 77 | true 78 | 79 | 80 | false 81 | 82 | -------------------------------------------------------------------------------- /images/jenkins-master/jobs/Walter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | 7 | false 8 | 9 | 10 | 11 | 12 | CI_BRANCH 13 | Branch of the ci-scripts repository to use 14 | master 15 | true 16 | 17 | 18 | CI_REPO 19 | Location of the ci-scripts repository 20 | https://github.com/WindRiver-OpenSourceLabs/ci-scripts.git 21 | true 22 | 23 | 24 | WALTER_BINARY 25 | Download location for Walter binary 26 | http://h2o2.me/bin/walter 27 | true 28 | 29 | 30 | YAML 31 | YAML file passing to Walter 32 | 33 | false 34 | 35 | 36 | 37 | 38 | 39 | 40 | 2 41 | 42 | 43 | https://github.com/WindRiver-OpenSourceLabs/ci-scripts.git 44 | 45 | 46 | 47 | 48 | */master 49 | 50 | 51 | false 52 | 53 | 54 | 55 | Jenkinsfile-Walter 56 | true 57 | 58 | 59 | false 60 | 61 | -------------------------------------------------------------------------------- /images/jenkins-master/jobs/devbuild.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | 7 | false 8 | 9 | 10 | 11 | 12 | DEVBUILD_ARGS 13 | 14 | 15 | false 16 | 17 | 18 | LOCALCONF 19 | 20 | 21 | false 22 | 23 | 24 | CI_BRANCH 25 | Branch of the ci-scripts repository to use 26 | master 27 | 28 | 29 | CI_REPO 30 | Localtion of the ci-scripts repository 31 | git://ala-lxgit.wrs.com/projects/wrlinux-ci/ci-scripts 32 | 33 | 34 | 35 | 36 | 37 | 38 | 2 39 | 40 | 41 | git://lxgit.wrs.com/projects/wrlinux-ci/ci-scripts 42 | 43 | 44 | 45 | 46 | */master 47 | 48 | 49 | false 50 | 51 | 52 | 53 | jobs/Jenkinsfile-devbuild 54 | false 55 | 56 | 57 | false 58 | 59 | -------------------------------------------------------------------------------- /images/jenkins-master/jobs/devbuilds.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | wrigel 8 | 9 | 10 | wrigel 11 | git://ala-lxgit.wrs.com/projects/wrlinux-ci/ci-scripts 12 | 13 | 14 | 15 | 16 | 17 | false 18 | true 19 | true 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | All 30 | false 31 | false 32 | 33 | 34 | 35 | 36 | All 37 | 38 | 39 | 40 | 41 | devbuilds 42 | 43 | -------------------------------------------------------------------------------- /images/jenkins-master/jobs/folder_create.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | false 6 | 7 | 8 | true 9 | 10 | 11 | 12 | 13 | NAME 14 | 15 | 16 | false 17 | 18 | 19 | 20 | 21 | 22 | true 23 | false 24 | false 25 | false 26 | 27 | false 28 | 29 | 30 | folder("${NAME}") { 31 | displayName("${NAME}") 32 | properties { 33 | folderLibraries { 34 | libraries { 35 | libraryConfiguration { 36 | name("wrigel") 37 | retriever { 38 | modernSCM { 39 | scm { 40 | git { 41 | id("wrigel") 42 | remote("git://ala-lxgit.wrs.com/projects/wrlinux-ci/ci-scripts") 43 | traits { 44 | branchDiscoveryTrait() 45 | } 46 | } 47 | } 48 | } 49 | } 50 | } 51 | } 52 | } 53 | } 54 | } 55 | true 56 | true 57 | false 58 | false 59 | false 60 | false 61 | IGNORE 62 | IGNORE 63 | IGNORE 64 | JENKINS_ROOT 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /images/nginx/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.9 2 | 3 | # Build time arguments 4 | #Values: latest or version number (e.g. 1.8.1-r0) 5 | ARG NGINX_VERSION=latest 6 | #Permissions, set the linux user id and group id 7 | ARG CONTAINER_UID=1000 8 | ARG CONTAINER_GID=1000 9 | # Image Build Date By Buildsystem 10 | ARG BUILD_DATE=undefined 11 | 12 | # install dev tools 13 | ENV NGINX_DIRECTORY=/etc/nginx 14 | 15 | RUN export CONTAINER_USER=nginx && \ 16 | export CONTAINER_GROUP=nginx && \ 17 | # Add user 18 | addgroup -g $CONTAINER_GID $CONTAINER_GROUP && \ 19 | adduser -u $CONTAINER_UID -G $CONTAINER_GROUP -h /home/$CONTAINER_USER -s /bin/bash -S $CONTAINER_USER && \ 20 | apk add --update bash tini \ 21 | ca-certificates \ 22 | curl \ 23 | openssl \ 24 | apache2-utils && \ 25 | if [ "${NGINX_VERSION}" = "latest" ]; \ 26 | then apk add nginx ; \ 27 | else apk add "nginx=${NGINX_VERSION}" ; \ 28 | fi && \ 29 | rm -f /${NGINX_DIRECTORY}/nginx.conf && \ 30 | rm -rf ${NGINX_DIRECTORY}/conf.d ${NGINX_DIRECTORY}/default.d && \ 31 | mkdir -p /var/log/nginx && \ 32 | touch /var/log/nginx/error.log && \ 33 | mkdir -p ${NGINX_DIRECTORY}/default.d && \ 34 | mkdir -p ${NGINX_DIRECTORY}/conf.d && \ 35 | mkdir -p ${NGINX_DIRECTORY}/keys && \ 36 | mkdir -p /run/nginx && \ 37 | chown -R $CONTAINER_UID:$CONTAINER_GID ${NGINX_DIRECTORY} /var/log/nginx && \ 38 | chown -R $CONTAINER_UID:$CONTAINER_GID ${NGINX_DIRECTORY} /var/lib/nginx && \ 39 | chown -R $CONTAINER_UID:$CONTAINER_GID ${NGINX_DIRECTORY} /run/nginx && \ 40 | rm -rf /var/cache/apk/* && rm -rf /tmp/* 41 | 42 | RUN apk update && \ 43 | mkdir /license-report && \ 44 | cd /license-report && \ 45 | curl --silent --remote-name https://raw.githubusercontent.com/WindRiver-OpenSourceLabs/license-report/master/generate_report.sh && \ 46 | sh generate_report.sh > report && \ 47 | rm /license-report/generate_report.sh 48 | 49 | EXPOSE 80 443 50 | 51 | USER root 52 | COPY imagescripts/*.sh /opt/nginx/ 53 | ENTRYPOINT ["/sbin/tini","--","/opt/nginx/docker-entrypoint.sh"] 54 | VOLUME ["/home/nginx","/var/log/nginx"] 55 | CMD ["nginx"] 56 | -------------------------------------------------------------------------------- /images/nginx/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Steffen Bleul 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /images/nginx/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 Wind River Systems Inc. 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | # 10 | # The above copyright notice and this permission notice shall be included in all 11 | # copies or substantial portions of the Software. 12 | # 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | SHELL = /bin/bash #requires bash 22 | 23 | .DEFAULT_GOAL := nginx 24 | 25 | help: 26 | @echo "Make options to build nginx docker image" 27 | @echo 28 | @grep -E '^[a-zA-Z][^:]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}' 29 | 30 | nginx: ## Build nginx image used as reverse proxy 31 | ifndef TAG 32 | $(eval TAG=latest) 33 | endif 34 | ifndef REGISTRY 35 | $(eval REGISTRY=windriver) 36 | endif 37 | docker build --rm=true --pull -t $(REGISTRY)/$@:$(TAG) -f Dockerfile . 38 | -------------------------------------------------------------------------------- /images/nginx/imagescripts/create_config.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | 5 | NAMESERVER=$(cat /etc/resolv.conf | grep "nameserver" | head -1 | awk '{print $2}' | tr '\n' ' ') 6 | LOG_FORMAT='$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for"' 7 | 8 | if [ -z "${LOG_LEVEL}" ]; then 9 | LOG_LEVEL=info 10 | fi 11 | 12 | ACCESS_LOG=/dev/stdout 13 | if [ "${DISABLE_ACCESS_LOG}" == 'true' ]; then 14 | ACCESS_LOG=off 15 | fi 16 | 17 | cat > ${NGINX_DIRECTORY}/nginx.conf <<_EOF_ 18 | worker_processes auto; 19 | error_log /dev/stdout ${LOG_LEVEL}; 20 | 21 | events { 22 | worker_connections 1024; 23 | } 24 | 25 | http { 26 | log_format main '${LOG_FORMAT}'; 27 | 28 | access_log ${ACCESS_LOG}; 29 | 30 | sendfile on; 31 | tcp_nopush on; 32 | tcp_nodelay on; 33 | 34 | resolver ${NAMESERVER} ipv6=off valid=30s; 35 | 36 | include mime.types; 37 | _EOF_ 38 | 39 | nginx_upload_size='100m' 40 | 41 | if [ -n "${NGINX_MAX_UPLOAD_SIZE}" ]; then 42 | nginx_upload_size=${NGINX_MAX_UPLOAD_SIZE} 43 | fi 44 | 45 | cat >> "${NGINX_DIRECTORY}/nginx.conf" <<_EOF_ 46 | client_body_buffer_size ${nginx_upload_size}; 47 | client_max_body_size ${nginx_upload_size}; 48 | _EOF_ 49 | 50 | cat >> ${NGINX_DIRECTORY}/nginx.conf <<_EOF_ 51 | keepalive_timeout 65; 52 | types_hash_max_size 2048; 53 | 54 | # Load modular configuration files from the /etc/nginx/conf.d directory. 55 | # See http://nginx.org/en/docs/ngx_core_module.html#include 56 | # for more information. 57 | include ${NGINX_DIRECTORY}/conf.d/*.conf; 58 | _EOF_ 59 | 60 | if [ -n "${SERVER1REVERSE_PROXY_LOCATION1}" ]; then 61 | source $CUR_DIR/custom_server.sh 62 | else 63 | source $CUR_DIR/default_server.sh 64 | fi 65 | 66 | cat >> ${NGINX_DIRECTORY}/nginx.conf <<_EOF_ 67 | } 68 | _EOF_ 69 | 70 | cat ${NGINX_DIRECTORY}/nginx.conf 71 | -------------------------------------------------------------------------------- /images/nginx/imagescripts/default_server.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | 5 | nginx_use_ipv6="false" 6 | nginx_http_port="80" 7 | 8 | if [ -n "${NGINX_USE_IPV6}" ]; then 9 | nginx_use_ipv6=${NGINX_USE_IPV6} 10 | fi 11 | 12 | if [ -n "${NGINX_HTTP_PORT}" ]; then 13 | nginx_http_port=${NGINX_HTTP_PORT} 14 | fi 15 | 16 | cat >> ${NGINX_DIRECTORY}/nginx.conf <<_EOF_ 17 | server { 18 | _EOF_ 19 | 20 | if [ "${nginx_use_ipv6}" = 'true' ]; then 21 | cat >> ${NGINX_DIRECTORY}/nginx.conf <<_EOF_ 22 | listen [::]:${nginx_http_port} default_server; 23 | _EOF_ 24 | else 25 | cat >> ${NGINX_DIRECTORY}/nginx.conf <<_EOF_ 26 | listen ${nginx_http_port} default_server; 27 | _EOF_ 28 | fi 29 | 30 | cat >> ${NGINX_DIRECTORY}/nginx.conf <<_EOF_ 31 | server_name _; 32 | root /usr/share/nginx/html; 33 | 34 | # Load configuration files for the default server block. 35 | include ${NGINX_DIRECTORY}/default.d/*.conf; 36 | 37 | location / { 38 | } 39 | 40 | error_page 404 /404.html; 41 | location = /40x.html { 42 | } 43 | 44 | error_page 500 502 503 504 /50x.html; 45 | location = /50x.html { 46 | } 47 | } 48 | _EOF_ 49 | -------------------------------------------------------------------------------- /images/nginx/imagescripts/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | 5 | # Setting environment variables 6 | readonly CUR_DIR=$(cd $(dirname ${BASH_SOURCE:-$0}); pwd) 7 | 8 | if [ -n "${DELAYED_START}" ]; then 9 | sleep ${DELAYED_START} 10 | fi 11 | 12 | nginx_main_config_file=${NGINX_DIRECTORY}"/nginx.conf" 13 | 14 | if [ ! -f ${nginx_main_config_file} ]; then 15 | rm -rf ${NGINX_DIRECTORY}/conf.d/* 16 | if [ "${NGINX_REDIRECT_PORT80}" = 'true' ]; then 17 | source $CUR_DIR/port_redirect.sh 18 | fi 19 | source $CUR_DIR/create_config.sh 20 | fi 21 | 22 | if [ "$1" = 'nginx' ]; then 23 | exec nginx -g "daemon off;" 24 | elif [[ "$1" == '-'* ]]; then 25 | exec nginx "$@" 26 | else 27 | exec "$@" 28 | fi 29 | -------------------------------------------------------------------------------- /images/nginx/imagescripts/port_redirect.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | 5 | nginx_use_ipv6="false" 6 | 7 | if [ -n "${NGINX_IPV6_ENABLED}" ]; then 8 | nginx_use_ipv6=${NGINX_IPV6_ENABLED} 9 | fi 10 | 11 | NGINX_PORT_REDIRECT_PATTERN='https://$server_name$request_uri' 12 | 13 | PORT_REDIRECT_FILE=${NGINX_DIRECTORY}/conf.d/portRedirect.conf 14 | 15 | cat > ${PORT_REDIRECT_FILE} <<_EOF_ 16 | _EOF_ 17 | 18 | for (( x=1; ; x++ )) 19 | do 20 | VAR_NGINX_SERVER_NAME="SERVER${x}SERVER_NAME" 21 | 22 | if [ ! -n "${!VAR_NGINX_SERVER_NAME}" ]; then 23 | break 24 | fi 25 | 26 | NGINX_SERVER_NAME="_" 27 | 28 | if [ -n "${!VAR_NGINX_SERVER_NAME}" ]; then 29 | NGINX_SERVER_NAME=${!VAR_NGINX_SERVER_NAME} 30 | fi 31 | 32 | cat >> ${PORT_REDIRECT_FILE} <<_EOF_ 33 | 34 | server { 35 | _EOF_ 36 | 37 | if [ "${nginx_use_ipv6}" = 'true' ]; then 38 | cat >> ${PORT_REDIRECT_FILE} <<_EOF_ 39 | listen [::]:80; 40 | _EOF_ 41 | else 42 | cat >> ${PORT_REDIRECT_FILE} <<_EOF_ 43 | listen 80; 44 | _EOF_ 45 | fi 46 | 47 | cat >> ${PORT_REDIRECT_FILE} <<_EOF_ 48 | server_name ${NGINX_SERVER_NAME}; 49 | return 301 ${NGINX_PORT_REDIRECT_PATTERN}; 50 | } 51 | 52 | _EOF_ 53 | done 54 | 55 | cat ${PORT_REDIRECT_FILE} 56 | -------------------------------------------------------------------------------- /images/nginx/scripts/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Build Docker image 4 | # 5 | 6 | set -o errexit # abort script at first error 7 | set -o pipefail # return the exit status of the last command in the pipe 8 | set -o nounset # treat unset variables and parameters as an error 9 | 10 | # Setting environment variables 11 | readonly CUR_DIR=$(cd $(dirname ${BASH_SOURCE:-$0}); pwd) 12 | 13 | printf '%b\n' ":: Reading scrips config...." 14 | source $CUR_DIR/scripts.cfg 15 | 16 | printf '%b\n' ":: Reading container config...." 17 | source $CUR_DIR/container.cfg 18 | 19 | # Helper functions 20 | err() { 21 | printf '%b\n' "" 22 | printf '%b\n' "\033[1;31m[ERROR] $@\033[0m" 23 | printf '%b\n' "" 24 | exit 1 25 | } >&2 26 | 27 | success() { 28 | printf '%b\n' "" 29 | printf '%b\n' "\033[1;32m[SUCCESS] $@\033[0m" 30 | printf '%b\n' "" 31 | } 32 | 33 | lookForImage() { 34 | local IMAGE_LIST=$(docker images | awk '{print $1}') 35 | local IMAGE_FOUND="false" 36 | 37 | for image in $IMAGE_LIST 38 | do 39 | if [ $image = $IMAGE_NAME ]; then 40 | IMAGE_FOUND="true" 41 | fi 42 | done 43 | 44 | echo $IMAGE_FOUND 45 | } 46 | 47 | #------------------ 48 | # SCRIPT ENTRYPOINT 49 | #------------------ 50 | 51 | found=$(lookForImage) 52 | if [ $found = "true" ]; then 53 | err ""$IMAGE_NAME" does exist, cannot build" 54 | fi 55 | 56 | printf '%b\n' "" 57 | printf '%b\n' ":: Building image..." 58 | 59 | docker build -t ${IMAGE_NAME} . 60 | 61 | found=$(lookForImage) 62 | if [ $found = "false" ]; then 63 | err ""$IMAGE_NAME" not found, build failed" 64 | fi 65 | 66 | success "Image build successfully." 67 | 68 | -------------------------------------------------------------------------------- /images/nginx/scripts/container.cfg: -------------------------------------------------------------------------------- 1 | #------------------ 2 | # CONTAINER VARIABLES 3 | #------------------ 4 | readonly CONTAINER_NAME="nginx" 5 | readonly IMAGE_NAME="blacklabelops/nginx" 6 | -------------------------------------------------------------------------------- /images/nginx/scripts/rmi.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Remove Docker image 4 | # 5 | 6 | set -o errexit # abort script at first error 7 | set -o pipefail # return the exit status of the last command in the pipe 8 | set -o nounset # treat unset variables and parameters as an error 9 | 10 | # Setting environment variables 11 | readonly CUR_DIR=$(cd $(dirname ${BASH_SOURCE:-$0}); pwd) 12 | 13 | printf '%b\n' ":: Reading scrips config...." 14 | source $CUR_DIR/scripts.cfg 15 | 16 | printf '%b\n' ":: Reading container config...." 17 | source $CUR_DIR/container.cfg 18 | 19 | # Helper functions 20 | err() { 21 | printf '%b\n' "" 22 | printf '%b\n' "\033[1;31m[ERROR] $@\033[0m" 23 | printf '%b\n' "" 24 | exit 1 25 | } >&2 26 | 27 | success() { 28 | printf '%b\n' "" 29 | printf '%b\n' "\033[1;32m[SUCCESS] $@\033[0m" 30 | printf '%b\n' "" 31 | } 32 | 33 | lookForImage() { 34 | local IMAGE_LIST=$(docker images | awk '{print $1}') 35 | local IMAGE_FOUND="false" 36 | 37 | for image in $IMAGE_LIST 38 | do 39 | if [ $image = $IMAGE_NAME ]; then 40 | IMAGE_FOUND="true" 41 | fi 42 | done 43 | 44 | echo $IMAGE_FOUND 45 | } 46 | 47 | #------------------ 48 | # SCRIPT ENTRYPOINT 49 | #------------------ 50 | 51 | found=$(lookForImage) 52 | 53 | if [ $found = "false" ]; then 54 | err ""$IMAGE_NAME" not found" 55 | fi 56 | 57 | printf '%b\n' "" 58 | printf '%b\n' ":: Removing image..." 59 | 60 | docker rmi -f ${IMAGE_NAME} 61 | 62 | found=$(lookForImage) 63 | 64 | if [ $found = "true" ]; then 65 | err ""$IMAGE_NAME" still found, removing failed." 66 | fi 67 | 68 | success "Image removed successfully." 69 | -------------------------------------------------------------------------------- /images/nginx/scripts/scripts.cfg: -------------------------------------------------------------------------------- 1 | readonly ROOT_DIR=$(cd ${CUR_DIR}/..; pwd) -------------------------------------------------------------------------------- /images/postbuild/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 Wind River Systems Inc. 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | # 10 | # The above copyright notice and this permission notice shall be included in all 11 | # copies or substantial portions of the Software. 12 | # 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | FROM debian:stretch 22 | 23 | MAINTAINER Konrad Scherer 24 | 25 | RUN apt-get update && \ 26 | DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confnew" -qy install --no-install-recommends \ 27 | bzip2 openssh-client rsync git git-email lava-tool locales curl && \ 28 | useradd --home-dir /home/wrlbuild --uid 1000 --gid 100 --shell /bin/bash wrlbuild && \ 29 | mkdir -p /home/wrlbuild && chown 1000:100 /home/wrlbuild && \ 30 | echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen && \ 31 | /usr/sbin/locale-gen en_US.UTF-8 && \ 32 | /usr/sbin/update-locale LANG=en_US.UTF-8 && \ 33 | apt-get clean && \ 34 | rm -rf /var/lib/apt/lists/* 35 | 36 | RUN mkdir /license-report && \ 37 | cd /license-report && \ 38 | curl --silent --remote-name https://raw.githubusercontent.com/WindRiver-OpenSourceLabs/license-report/master/generate_report.sh && \ 39 | sh generate_report.sh > report && \ 40 | rm /license-report/generate_report.sh 41 | 42 | CMD ["/bin/bash"] 43 | 44 | USER wrlbuild 45 | -------------------------------------------------------------------------------- /images/postbuild/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 Wind River Systems Inc. 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | # 10 | # The above copyright notice and this permission notice shall be included in all 11 | # copies or substantial portions of the Software. 12 | # 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | SHELL = /bin/bash #requires bash 22 | 23 | .DEFAULT_GOAL := postbuild 24 | 25 | help: 26 | @echo "Make options to build docker image for build post processing" 27 | @echo 28 | @grep -E '^[a-zA-Z][^:]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}' 29 | 30 | postbuild: ## Build image with required tools for post processing 31 | ifndef TAG 32 | $(eval TAG=latest) 33 | endif 34 | ifndef REGISTRY 35 | $(eval REGISTRY=windriver) 36 | endif 37 | docker build --rm=true --pull -t $(REGISTRY)/$@:$(TAG) - < Dockerfile 38 | -------------------------------------------------------------------------------- /images/postbuild/README.md: -------------------------------------------------------------------------------- 1 | # Ubuntu 16.04 Docker Image for Post Build Actions 2 | 3 | This repository contains Dockerfile and scripts used to build the 4 | Ubuntu 16.04 postbuild docker image hosted on Docker Hub. This 5 | image is part of the Wind River Linux Continuous Integration Project. 6 | 7 | ## Building the image 8 | 9 | To build the image windriver/postbuild run: 10 | 11 | make postbuild 12 | 13 | To build the image with a different registry and tag run: 14 | 15 | make postbuild TAG=test REGISTRY=internal:5000 16 | 17 | ## Contributing 18 | 19 | Contributions submitted must be signed off under the terms of the Linux 20 | Foundation Developer's Certificate of Origin version 1.1. Please refer to: 21 | https://developercertificate.org 22 | 23 | To submit a patch: 24 | 25 | - Open a Pull Request on the GitHub project 26 | - Optionally create a GitHub Issue describing the issue addressed by the patch 27 | 28 | 29 | # License 30 | 31 | MIT License 32 | 33 | Copyright (c) 2017 Wind River Systems Inc. 34 | 35 | Permission is hereby granted, free of charge, to any person obtaining a copy 36 | of this software and associated documentation files (the "Software"), to deal 37 | in the Software without restriction, including without limitation the rights 38 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 39 | copies of the Software, and to permit persons to whom the Software is 40 | furnished to do so, subject to the following conditions: 41 | 42 | The above copyright notice and this permission notice shall be included in all 43 | copies or substantial portions of the Software. 44 | 45 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 46 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 47 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 48 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 49 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 50 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 51 | SOFTWARE. 52 | -------------------------------------------------------------------------------- /images/rsync/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /images/rsync/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 Wind River Systems Inc. 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | # 10 | # The above copyright notice and this permission notice shall be included in all 11 | # copies or substantial portions of the Software. 12 | # 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | FROM alpine:3.9 22 | 23 | MAINTAINER Konrad Scherer 24 | 25 | RUN apk add --update --no-cache rsync curl \ 26 | && mkdir -p /builds \ 27 | && chown -R nobody:nobody /builds 28 | 29 | RUN mkdir /license-report && cd /license-report \ 30 | && curl --silent --remote-name https://raw.githubusercontent.com/WindRiver-OpenSourceLabs/license-report/master/generate_report.sh \ 31 | && apk update && sh generate_report.sh > report \ 32 | && rm -rf /var/cache/apk/* && rm /license-report/generate_report.sh 33 | 34 | COPY conf/rsyncd.conf /etc/ 35 | 36 | VOLUME /builds 37 | 38 | EXPOSE 873 39 | 40 | ENTRYPOINT ["rsync","--daemon","--no-detach","--log-file=/dev/stdout"] 41 | -------------------------------------------------------------------------------- /images/rsync/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Wind River Systems Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /images/rsync/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 Wind River Systems Inc. 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | # 10 | # The above copyright notice and this permission notice shall be included in all 11 | # copies or substantial portions of the Software. 12 | # 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | SHELL = /bin/bash #requires bash 22 | 23 | .DEFAULT_GOAL := rsync 24 | 25 | help: 26 | @echo "Make options to build docker images which have host tools to build WRLinux" 27 | @echo 28 | @grep -E '^[a-zA-Z][^:]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}' 29 | 30 | rsync: ## Build rsync image with required host tools 31 | ifndef TAG 32 | $(eval TAG=latest) 33 | endif 34 | ifndef REGISTRY 35 | $(eval REGISTRY=windriver) 36 | endif 37 | docker build --rm=true --pull -t $(REGISTRY)/$@:$(TAG) -f Dockerfile . 38 | -------------------------------------------------------------------------------- /images/rsync/README.md: -------------------------------------------------------------------------------- 1 | # Rsync Server Docker Image 2 | 3 | This repository contains Dockerfile and scripts used to build the 4 | rsync docker image hosted on Docker Hub. This image is part of the 5 | Wind River Linux Continuous Integration Project. 6 | 7 | ## Building the image 8 | 9 | To build the image windriver/rsync run: 10 | 11 | make rsync 12 | 13 | To build the image with a different registry and tag run: 14 | 15 | make rsync TAG=test REGISTRY=internal:5000 16 | 17 | ## Contributing 18 | 19 | Contributions submitted must be signed off under the terms of the Linux 20 | Foundation Developer's Certificate of Origin version 1.1. Please refer to: 21 | https://developercertificate.org 22 | 23 | To submit a patch: 24 | 25 | - Open a Pull Request on the GitHub project 26 | - Optionally create a GitHub Issue describing the issue addressed by the patch 27 | 28 | 29 | # License 30 | 31 | MIT License 32 | 33 | Copyright (c) 2017 Wind River Systems Inc. 34 | 35 | Permission is hereby granted, free of charge, to any person obtaining a copy 36 | of this software and associated documentation files (the "Software"), to deal 37 | in the Software without restriction, including without limitation the rights 38 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 39 | copies of the Software, and to permit persons to whom the Software is 40 | furnished to do so, subject to the following conditions: 41 | 42 | The above copyright notice and this permission notice shall be included in all 43 | copies or substantial portions of the Software. 44 | 45 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 46 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 47 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 48 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 49 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 50 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 51 | SOFTWARE. 52 | -------------------------------------------------------------------------------- /images/rsync/conf/rsyncd.conf: -------------------------------------------------------------------------------- 1 | pid file = /var/run/rsyncd.pid 2 | log file = /var/run/rsyncd.log 3 | 4 | reverse lookup = no 5 | timeout = 300 6 | 7 | [builds] 8 | path = /builds 9 | use chroot = no 10 | uid = nobody 11 | gid = nobody 12 | read only = no 13 | write only = no 14 | list = yes 15 | # hosts allow = 0.0.0.0 16 | incoming chmod = D755,F644 17 | outgoing chmod = D755,F644 18 | max connections = 3 19 | -------------------------------------------------------------------------------- /images/toaster_aggregator/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | .#* 3 | *.swp 4 | *.elc 5 | .check 6 | .pex/* 7 | dist/* 8 | toaster_aggregator.egg-info/* 9 | build/* 10 | .venv/* 11 | -------------------------------------------------------------------------------- /images/toaster_aggregator/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 Wind River Systems Inc. 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | # 10 | # The above copyright notice and this permission notice shall be included in all 11 | # copies or substantial portions of the Software. 12 | # 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | FROM alpine:3.9 as builder 22 | 23 | RUN apk add --update --no-cache python3 make bash openssl ca-certificates gcc python3-dev musl-dev curl && \ 24 | addgroup -g 1000 toaster && \ 25 | adduser -h /home/toaster -u 1000 -G toaster -s /bin/bash -D toaster 26 | 27 | COPY Makefile MANIFEST.in setup.py /home/toaster/ 28 | 29 | COPY toaster_aggregator /home/toaster/toaster_aggregator 30 | 31 | COPY docker-production.ini /home/toaster/dist/ 32 | 33 | RUN chown -R toaster:toaster /home/toaster 34 | 35 | USER toaster 36 | 37 | # Generate the license report for the python packages used by toaster_aggregator 38 | RUN cd /home/toaster/ && make dist/toaster_aggregator 39 | 40 | USER root 41 | 42 | RUN cd /home/toaster && curl --silent --remote-name https://raw.githubusercontent.com/WindRiver-OpenSourceLabs/license-report/master/generate_report.sh && \ 43 | apk update && bash generate_report.sh --pip /home/toaster/.venv/bin/pip > /home/toaster/report && rm -rf /var/cache/apk/* 44 | 45 | FROM alpine:3.9 46 | 47 | COPY --from=builder /home/toaster/report /license-report/report 48 | COPY --from=builder /home/toaster/generate_report.sh /license-report/generate_report.sh 49 | 50 | # Append alpine package data to the python package data 51 | RUN apk add --update python3 tini && \ 52 | cd /license-report && \ 53 | sh /license-report/generate_report.sh -a report >> report && \ 54 | rm -rf /var/cache/apk/* && \ 55 | addgroup -g 1000 toaster && \ 56 | adduser -h /home/toaster -u 1000 -G toaster -s /bin/ash -D toaster 57 | 58 | EXPOSE 6543 59 | 60 | COPY --from=builder /home/toaster/dist/ /usr/local/bin/ 61 | 62 | USER toaster 63 | 64 | ENTRYPOINT [ "/sbin/tini" ] 65 | 66 | CMD [ "/usr/local/bin/toaster_aggregator", "--paste", "/usr/local/bin/docker-production.ini" ] 67 | -------------------------------------------------------------------------------- /images/toaster_aggregator/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include *.txt *.ini *.cfg *.rst 2 | recursive-include toaster_aggregator *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml *.jinja2 3 | -------------------------------------------------------------------------------- /images/toaster_aggregator/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 Wind River Systems Inc. 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | # 10 | # The above copyright notice and this permission notice shall be included in all 11 | # copies or substantial portions of the Software. 12 | # 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | SHELL = /bin/bash #requires bash 22 | VENV = $(PWD)/.venv 23 | DEPS = $(wildcard *.py) 24 | GET_PIP = $(VENV)/bin/get-pip.py 25 | PIP = $(VENV)/bin/pip3 26 | PEX = $(VENV)/bin/pex 27 | 28 | .PHONY: build image toaster_aggregator setup clean test help 29 | 30 | .DEFAULT_GOAL := help 31 | 32 | help: 33 | @echo "Make options for jenkins ci development" 34 | @echo 35 | @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-10s\033[0m %s\n", $$1, $$2}' 36 | 37 | toaster_aggregator: ## Use multi-stage docker build to build pex and final toaster aggregator image 38 | ifndef TAG 39 | $(eval TAG=latest) 40 | endif 41 | ifndef REGISTRY 42 | $(eval REGISTRY=windriver) 43 | endif 44 | docker pull alpine:3.9 # bug in multi-stage does not allow docker build --pull 45 | docker build --rm=true -t $(REGISTRY)/$@:$(TAG) -f Dockerfile . 46 | 47 | dist/toaster_aggregator: $(DEPS) $(VENV) 48 | rm -f $(PWD)/.pex/build/toaster*; \ 49 | export PEX_ROOT=$(PWD)/.pex; \ 50 | $(VENV)/bin/python setup.py bdist_pex --bdist-all --pex-args="-v --pex-root=$(PWD)/.pex" 51 | 52 | # Use get-pip.py to avoid requiring installation of ensurepip package 53 | $(VENV): 54 | type python3 >/dev/null 2>&1 || { echo >&2 "Python3 required. Aborting."; exit 1; }; \ 55 | test -d $(VENV) || python3 -m venv --without-pip $(VENV); \ 56 | touch $(VENV); \ 57 | wget -O $(GET_PIP) https://bootstrap.pypa.io/get-pip.py; \ 58 | $(VENV)/bin/python3 $(GET_PIP) --ignore-installed; \ 59 | $(PIP) install pylint flake8 pex; \ 60 | touch $(PEX); \ 61 | $(VENV)/bin/python3 setup.py develop; 62 | 63 | setup: $(VENV) ## Install all python dependencies in .venv 64 | 65 | dev: $(DEPS) $(VENV) ## Run a local development version of the app 66 | $(VENV)/bin/gunicorn --paste development.ini 67 | 68 | clean: ## Delete virtualenv and all build directories 69 | rm -rf $(VENV) *.egg-info build dist .pex 70 | -------------------------------------------------------------------------------- /images/toaster_aggregator/development.ini: -------------------------------------------------------------------------------- 1 | [app:main] 2 | use = egg:toaster_aggregator 3 | 4 | pyramid.reload_templates = true 5 | pyramid.debug_authorization = false 6 | pyramid.debug_notfound = false 7 | pyramid.debug_routematch = false 8 | pyramid.default_locale_name = en 9 | pyramid.includes = 10 | pyramid_debugtoolbar 11 | 12 | consul = http://yow-kscherer-d3.wrs.com:8500 13 | 14 | # By default, the toolbar only appears for clients from IP addresses 15 | # '127.0.0.1' and '::1'. 16 | # debugtoolbar.hosts = 127.0.0.1 ::1 17 | 18 | ### 19 | # wsgi server configuration 20 | ### 21 | 22 | [server:main] 23 | use = egg:gunicorn#main 24 | host = 0.0.0.0 25 | port = 6543 26 | workers = 1 27 | loglevel = debug 28 | 29 | [loggers] 30 | keys = root, toaster_aggregator 31 | 32 | [handlers] 33 | keys = console 34 | 35 | [formatters] 36 | keys = generic 37 | 38 | [logger_root] 39 | level = DEBUG 40 | handlers = console 41 | 42 | [logger_toaster_aggregator] 43 | level = DEBUG 44 | handlers = 45 | qualname = toaster_aggregator 46 | 47 | [handler_console] 48 | class = StreamHandler 49 | args = (sys.stderr,) 50 | level = NOTSET 51 | formatter = generic 52 | 53 | [formatter_generic] 54 | format = %(asctime)s %(levelname)-5.5s [%(name)s:%(lineno)s][%(threadName)s] %(message)s 55 | -------------------------------------------------------------------------------- /images/toaster_aggregator/docker-production.ini: -------------------------------------------------------------------------------- 1 | [app:main] 2 | use = egg:toaster_aggregator 3 | 4 | pyramid.reload_templates = false 5 | pyramid.debug_authorization = false 6 | pyramid.debug_notfound = false 7 | pyramid.debug_routematch = false 8 | pyramid.default_locale_name = en 9 | filter-with = proxy-prefix 10 | 11 | consul = http://consul:8500 12 | prefix = /toaster_aggregator 13 | 14 | [filter:proxy-prefix] 15 | use = egg:PasteDeploy#prefix 16 | prefix = /toaster_aggregator 17 | 18 | [server:main] 19 | use = egg:gunicorn#main 20 | host = 0.0.0.0 21 | port = 6543 22 | workers = 4 23 | loglevel = warn 24 | preload = true 25 | 26 | [loggers] 27 | keys = root, toaster_aggregator 28 | 29 | [handlers] 30 | keys = console 31 | 32 | [formatters] 33 | keys = generic 34 | 35 | [logger_root] 36 | level = WARN 37 | handlers = console 38 | 39 | [logger_toaster_aggregator] 40 | level = WARN 41 | handlers = 42 | qualname = toaster_aggregator 43 | 44 | [handler_console] 45 | class = StreamHandler 46 | args = (sys.stderr,) 47 | level = NOTSET 48 | formatter = generic 49 | 50 | [formatter_generic] 51 | format = %(asctime)s %(levelname)-5.5s [%(name)s:%(lineno)s][%(threadName)s] %(message)s 52 | -------------------------------------------------------------------------------- /images/toaster_aggregator/production.ini: -------------------------------------------------------------------------------- 1 | [app:main] 2 | use = egg:toaster_aggregator 3 | 4 | pyramid.reload_templates = false 5 | pyramid.debug_authorization = false 6 | pyramid.debug_notfound = false 7 | pyramid.debug_routematch = false 8 | pyramid.default_locale_name = en 9 | filter-with = proxy-prefix 10 | 11 | consul = http://localhost:8500/ 12 | prefix = / 13 | 14 | [filter:proxy-prefix] 15 | use = egg:PasteDeploy#prefix 16 | prefix = /monitor 17 | 18 | [server:main] 19 | use = egg:gunicorn#main 20 | host = 127.0.0.1 21 | port = 6543 22 | workers = 4 23 | loglevel = warn 24 | preload = true 25 | 26 | [loggers] 27 | keys = root, toaster_aggregator 28 | 29 | [handlers] 30 | keys = console 31 | 32 | [formatters] 33 | keys = generic 34 | 35 | [logger_root] 36 | level = WARN 37 | handlers = console 38 | 39 | [logger_toaster_aggregator] 40 | level = WARN 41 | handlers = 42 | qualname = toaster_aggregator 43 | 44 | [handler_console] 45 | class = StreamHandler 46 | args = (sys.stderr,) 47 | level = NOTSET 48 | formatter = generic 49 | 50 | [formatter_generic] 51 | format = %(asctime)s %(levelname)-5.5s [%(name)s:%(lineno)s][%(threadName)s] %(message)s 52 | -------------------------------------------------------------------------------- /images/toaster_aggregator/setup.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 Wind River Systems Inc. 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | # 10 | # The above copyright notice and this permission notice shall be included in all 11 | # copies or substantial portions of the Software. 12 | # 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | """Create a package for the toaster aggregator so it can packaged using pex""" 22 | from setuptools import setup, find_packages 23 | 24 | setup( 25 | name="toaster_aggregator", 26 | version="0.1", 27 | packages=find_packages(), 28 | include_package_data=True, 29 | install_requires=[ 30 | 'pyramid==1.8.2', 31 | 'requests>=2.9.0', 32 | 'pyramid_debugtoolbar', 33 | 'pyramid_jinja2', 34 | 'gunicorn', 35 | ], 36 | entry_points={ 37 | 'console_scripts': [ 38 | 'toaster_aggregator=gunicorn.app.wsgiapp:run' 39 | ], 40 | 'paste.app_factory': [ 41 | 'main = toaster_aggregator.aggregator:main', 42 | ], 43 | }, 44 | test_suite='nose.collector', 45 | tests_require=['nose'], 46 | author="Konrad Scherer", 47 | zip_safe=False, 48 | author_email="kmscherer@gmail.com", 49 | description="A webapp for aggregating toaster services listed by consul", 50 | license="MIT", 51 | url='http://github.com/Wind-River', 52 | ) 53 | -------------------------------------------------------------------------------- /images/toaster_aggregator/toaster_aggregator/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wind-River/ci-scripts/df9cd3f646b755bbed03ca80beafa3bc63b88017/images/toaster_aggregator/toaster_aggregator/__init__.py -------------------------------------------------------------------------------- /images/toaster_aggregator/toaster_aggregator/consul_query.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) 2017 Wind River Systems Inc. 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | import sys 24 | import requests 25 | 26 | CONSUL = sys.argv[1] 27 | 28 | try: 29 | request = requests.get('http://' + CONSUL + ':8500/v1/agent/services') 30 | except requests.ConnectionError: 31 | print("Could not connect to %s" % CONSUL) 32 | sys.exit(1) 33 | 34 | services = request.json() 35 | 36 | for service_name, info in services.items(): 37 | print("Service: %s Port: %s" % (info['Service'], info['Port'])) 38 | -------------------------------------------------------------------------------- /images/toaster_aggregator/toaster_aggregator/static/running_build_reload.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 Wind River Systems Inc. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in all 11 | // copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | // SOFTWARE. 20 | 21 | $(document).ready(function() { 22 | 23 | running_url = "/running" 24 | if ((typeof prefix !== "undefined") && (prefix !== '/')) { 25 | running_url = prefix + running_url 26 | } 27 | buildTable = $('#running_build_table').DataTable( { 28 | "ajax": running_url, 29 | "order": [[ 1, 'asc' ]], 30 | "pageLength": 100, 31 | "columns": [ 32 | { "data": "name" }, 33 | { "data": "progress" }, 34 | { "data": "link" }, 35 | ] 36 | } ); 37 | 38 | setInterval( function () { 39 | buildTable.ajax.reload( null, false ); // user paging is not reset on reload 40 | }, 15000 ); 41 | 42 | } ); 43 | 44 | 45 | -------------------------------------------------------------------------------- /images/toaster_aggregator/toaster_aggregator/static/tablesearch.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 Wind River Systems Inc. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in all 11 | // copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | // SOFTWARE. 20 | 21 | $(window).on('load', function() { 22 | // Write on keyup event of keyword input element 23 | $("#search").keyup(function(){ 24 | _this = this; 25 | // Show only matching TR, hide rest of them 26 | $.each($("#running_build_table tbody").find("tr"), function() { 27 | if($(this).text().toLowerCase().indexOf($(_this).val().toLowerCase()) == -1) 28 | $(this).hide(); 29 | else 30 | $(this).show(); 31 | }); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /images/toaster_aggregator/toaster_aggregator/templates/builds.jinja2: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | Builds 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 |

Builds

18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |
NameProgressLink
28 |

29 |
30 | 31 | 32 | -------------------------------------------------------------------------------- /images/ubuntu1604_builder/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | .#* 3 | *.swp 4 | *.elc 5 | -------------------------------------------------------------------------------- /images/ubuntu1604_builder/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 Wind River Systems Inc. 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | # 10 | # The above copyright notice and this permission notice shall be included in all 11 | # copies or substantial portions of the Software. 12 | # 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | FROM ubuntu:16.04 22 | 23 | MAINTAINER Konrad Scherer 24 | 25 | RUN dpkg --add-architecture i386 && \ 26 | apt-get update && \ 27 | DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confnew" -qy install --no-install-recommends \ 28 | libc6:i386 libc6-dev-i386 libncurses5:i386 texi2html chrpath curl \ 29 | diffstat subversion libgl1-mesa-dev libglu1-mesa-dev libsdl1.2-dev \ 30 | texinfo gawk gcc gcc-multilib help2man g++ git-core python-gtk2 bash cpio \ 31 | diffutils xz-utils make file screen wget time patch openssh-client \ 32 | curl locales openssl ca-certificates iproute2 iputils-ping python3 python3-yaml repo vim-nox && \ 33 | apt-get clean && \ 34 | rm -rf /var/lib/apt/lists/* && \ 35 | rm -rf /usr/share/man && \ 36 | rm -rf /usr/share/grub2 && \ 37 | rm -rf /usr/share/texmf/fonts && \ 38 | rm -rf /usr/share/texmf/doc && \ 39 | /usr/sbin/locale-gen en_US.UTF-8 && \ 40 | /usr/sbin/update-locale LANG=en_US.UTF-8 && \ 41 | curl -s -L -o /bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 && \ 42 | chmod +x /bin/dumb-init 43 | 44 | # Add wrlbuild user and hack to bypass missing iptables program 45 | RUN useradd --home-dir /home/wrlbuild --uid 1000 --gid 100 --shell /bin/bash wrlbuild && \ 46 | echo '#!/bin/sh' > /tmp/iptables && echo 'exit 0' >> /tmp/iptables && chmod +x /tmp/iptables && \ 47 | mv /tmp/iptables /sbin/iptables 48 | 49 | RUN mkdir /license-report && \ 50 | cd /license-report && \ 51 | curl --silent --remote-name https://raw.githubusercontent.com/WindRiver-OpenSourceLabs/license-report/master/generate_report.sh && \ 52 | sh generate_report.sh > report && \ 53 | rm /license-report/generate_report.sh 54 | 55 | ENTRYPOINT ["/bin/dumb-init"] 56 | 57 | CMD ["/bin/bash"] 58 | 59 | USER wrlbuild 60 | -------------------------------------------------------------------------------- /images/ubuntu1604_builder/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Wind River Systems Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /images/ubuntu1604_builder/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 Wind River Systems Inc. 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | # 10 | # The above copyright notice and this permission notice shall be included in all 11 | # copies or substantial portions of the Software. 12 | # 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | SHELL = /bin/bash #requires bash 22 | 23 | .DEFAULT_GOAL := ubuntu1604_64 24 | 25 | help: 26 | @echo "Make options to build docker images which have host tools to build WRLinux" 27 | @echo 28 | @grep -E '^[a-zA-Z][^:]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}' 29 | 30 | ubuntu1604_64: ## Build Ubuntu LTS image with required host tools 31 | ifndef TAG 32 | $(eval TAG=latest) 33 | endif 34 | ifndef REGISTRY 35 | $(eval REGISTRY=windriver) 36 | endif 37 | docker build --rm=true --pull -t $(REGISTRY)/$@:$(TAG) - < Dockerfile 38 | -------------------------------------------------------------------------------- /images/ubuntu1604_builder/README.md: -------------------------------------------------------------------------------- 1 | # Ubuntu 16.04 WRLinux Builder Docker Image 2 | 3 | This repository contains Dockerfile and scripts used to build the 4 | Ubuntu 16.04 WRLinux builder docker image hosted on Docker Hub. This 5 | image is part of the Wind River Linux Continuous Integration Project. 6 | 7 | ## Building the image 8 | 9 | To build the image windriver/ubuntu1604_64 run: 10 | 11 | make ubuntu1604_64 12 | 13 | To build the image with a different registry and tag run: 14 | 15 | make ubuntu1604_64 TAG=test REGISTRY=internal:5000 16 | 17 | ## Contributing 18 | 19 | Contributions submitted must be signed off under the terms of the Linux 20 | Foundation Developer's Certificate of Origin version 1.1. Please refer to: 21 | https://developercertificate.org 22 | 23 | To submit a patch: 24 | 25 | - Open a Pull Request on the GitHub project 26 | - Optionally create a GitHub Issue describing the issue addressed by the patch 27 | 28 | 29 | # License 30 | 31 | MIT License 32 | 33 | Copyright (c) 2017 Wind River Systems Inc. 34 | 35 | Permission is hereby granted, free of charge, to any person obtaining a copy 36 | of this software and associated documentation files (the "Software"), to deal 37 | in the Software without restriction, including without limitation the rights 38 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 39 | copies of the Software, and to permit persons to whom the Software is 40 | furnished to do so, subject to the following conditions: 41 | 42 | The above copyright notice and this permission notice shall be included in all 43 | copies or substantial portions of the Software. 44 | 45 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 46 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 47 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 48 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 49 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 50 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 51 | SOFTWARE. 52 | -------------------------------------------------------------------------------- /images/ubuntu1804/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 Wind River Systems Inc. 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | # 10 | # The above copyright notice and this permission notice shall be included in all 11 | # copies or substantial portions of the Software. 12 | # 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | FROM ubuntu:18.04 22 | 23 | MAINTAINER Konrad Scherer 24 | 25 | RUN dpkg --add-architecture i386 && \ 26 | apt-get update && \ 27 | DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confnew" -qy install --no-install-recommends \ 28 | texi2html chrpath \ 29 | diffstat subversion libgl1-mesa-dev libglu1-mesa-dev libsdl1.2-dev \ 30 | texinfo gawk gcc gcc-multilib help2man g++ git-core python-gtk2 bash cpio \ 31 | python python3 python3-pip python3-pexpect debianutils iputils-ping locales \ 32 | diffutils xz-utils make file screen sudo wget time patch openssh-client curl \ 33 | openssl ca-certificates iproute2 iputils-ping python3-yaml repo vim-nox \ 34 | uuid-runtime rsync && \ 35 | apt-get clean && \ 36 | rm -rf /var/lib/apt/lists/* && \ 37 | rm -rf /usr/share/man && \ 38 | rm -rf /usr/share/grub2 && \ 39 | rm -rf /usr/share/texmf/fonts && \ 40 | rm -rf /usr/share/texmf/doc && \ 41 | /usr/sbin/locale-gen en_US.UTF-8 && \ 42 | /usr/sbin/update-locale LANG=en_US.UTF-8 && \ 43 | curl -s -L -o /bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 && \ 44 | chmod +x /bin/dumb-init 45 | 46 | # Add wrlbuild user and hack to bypass missing iptables program 47 | RUN useradd --home-dir /home/wrlbuild --uid 1000 --gid 100 --create-home --shell /bin/bash wrlbuild && \ 48 | echo "wrlbuild ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \ 49 | echo '#!/bin/sh' > /tmp/iptables && echo 'exit 0' >> /tmp/iptables && chmod +x /tmp/iptables && \ 50 | mv /tmp/iptables /sbin/iptables 51 | 52 | RUN mkdir /license-report && \ 53 | cd /license-report && \ 54 | curl --silent --remote-name https://raw.githubusercontent.com/WindRiver-OpenSourceLabs/license-report/master/generate_report.sh && \ 55 | sh generate_report.sh > report && \ 56 | rm /license-report/generate_report.sh 57 | 58 | ENTRYPOINT ["/bin/dumb-init"] 59 | 60 | CMD ["/bin/bash"] 61 | 62 | USER wrlbuild 63 | -------------------------------------------------------------------------------- /images/ubuntu1804/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Wind River Systems Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /images/ubuntu1804/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 Wind River Systems Inc. 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | # 10 | # The above copyright notice and this permission notice shall be included in all 11 | # copies or substantial portions of the Software. 12 | # 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | SHELL = /bin/bash #requires bash 22 | 23 | .DEFAULT_GOAL := ubuntu1804_64 24 | 25 | help: 26 | @echo "Make options to build docker images which have host tools to build WRLinux" 27 | @echo 28 | @grep -E '^[a-zA-Z][^:]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}' 29 | 30 | ubuntu1804_64: ## Build Ubuntu LTS image with required host tools 31 | ifndef TAG 32 | $(eval TAG=latest) 33 | endif 34 | ifndef REGISTRY 35 | $(eval REGISTRY=windriver) 36 | endif 37 | docker build --rm=true --pull -t $(REGISTRY)/$@:$(TAG) - < Dockerfile 38 | -------------------------------------------------------------------------------- /images/ubuntu1804/README.md: -------------------------------------------------------------------------------- 1 | # Ubuntu 18.04 WRLinux Builder Docker Image 2 | 3 | This repository contains Dockerfile and scripts used to build the 4 | Ubuntu 18.04 WRLinux builder docker image hosted on Docker Hub. This 5 | image is part of the Wind River Linux Continuous Integration Project. 6 | 7 | ## Building the image 8 | 9 | To build the image windriver/ubuntu1804_64 run: 10 | 11 | make ubuntu1804_64 12 | 13 | To build the image with a different registry and tag run: 14 | 15 | make ubuntu1804_64 TAG=test REGISTRY=internal:5000 16 | 17 | ## Contributing 18 | 19 | Contributions submitted must be signed off under the terms of the Linux 20 | Foundation Developer's Certificate of Origin version 1.1. Please refer to: 21 | https://developercertificate.org 22 | 23 | To submit a patch: 24 | 25 | - Open a Pull Request on the GitHub project 26 | - Optionally create a GitHub Issue describing the issue addressed by the patch 27 | 28 | 29 | # License 30 | 31 | MIT License 32 | 33 | Copyright (c) 2017 Wind River Systems Inc. 34 | 35 | Permission is hereby granted, free of charge, to any person obtaining a copy 36 | of this software and associated documentation files (the "Software"), to deal 37 | in the Software without restriction, including without limitation the rights 38 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 39 | copies of the Software, and to permit persons to whom the Software is 40 | furnished to do so, subject to the following conditions: 41 | 42 | The above copyright notice and this permission notice shall be included in all 43 | copies or substantial portions of the Software. 44 | 45 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 46 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 47 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 48 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 49 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 50 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 51 | SOFTWARE. 52 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Welcome to CI Prototype! 5 | 12 | 13 | 14 |

Welcome to CI prototype!

15 |

If you see this page, the CI prototype is running.

16 | 17 |

The CI prototype consists of the following subprojects and their 18 | web interfaces can be accessed at the following location:.

19 | 20 |

Jenkins 21 |

Toaster Aggregator 22 |

Build Artifacts 23 | 24 |

For online documentation and support please refer to GitHub 25 | ci-scripts 26 | project.

27 | 28 | 29 | -------------------------------------------------------------------------------- /jenkins_build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (c) 2017 Wind River Systems Inc. 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | "$WORKSPACE"/ci-scripts/oe_build.sh \ 24 | --top="$WORKSPACE" --name="$NAME" --branch="$BRANCH" \ 25 | --host="$NODE_NAME" --setup_args="$SETUP_ARGS" --prebuild_cmd="$PREBUILD_CMD" \ 26 | --prebuild_cmd_for_test="$PREBUILD_CMD_FOR_TEST" \ 27 | --build_cmd_for_test="$BUILD_CMD_FOR_TEST" \ 28 | --build_cmd="$BUILD_CMD" --toaster="$TOASTER" \ 29 | --email=Konrad.Scherer@windriver.com 30 | -------------------------------------------------------------------------------- /jenkins_job_create.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) 2017-2018 Wind River Systems Inc. 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | # To ignore no-member pylint errors: 24 | # pylint: disable=E1101 25 | 26 | import os 27 | import sys 28 | import jenkins 29 | 30 | # import the jenkins connection code 31 | from common import get_jenkins 32 | 33 | 34 | def create_parser(): 35 | """Parse command line args""" 36 | from argparse import ArgumentParser 37 | from argparse import RawTextHelpFormatter 38 | 39 | descr = '''Create or update Jenkins job using local xml files''' 40 | 41 | op = ArgumentParser(description=descr, formatter_class=RawTextHelpFormatter) 42 | 43 | op.add_argument('--jenkins', dest='jenkins', required=False, 44 | help='Jenkins master endpoint.') 45 | 46 | op.add_argument("--jenkins_auth", dest="jenkins_auth", required=False, 47 | default='jenkins_auth.txt', 48 | help="Specify the file path for jenkins authentication infomation") 49 | 50 | op.add_argument('--job', dest='job', required=False, 51 | default='WRLinux_Build', 52 | help='Jenkins Job name. \nDefault WRLinux_Build') 53 | 54 | op.add_argument('--ci_branch', dest='ci_branch', required=False, 55 | default='master', 56 | help='The branch to use for the ci-scripts repo.' 57 | 'Used for local modifications.\nDefault master.') 58 | 59 | op.add_argument('--ci_repo', dest='ci_repo', required=False, 60 | help='The location of the ci-scripts repo.') 61 | 62 | op.add_argument("--git_credential", dest="git_credential", required=False, 63 | choices=['enable', 'disable'], 64 | help="Specify if jenkins need to use stored credential.") 65 | 66 | op.add_argument("--git_credential_id", dest="git_credential_id", required=False, 67 | help="Specify the credential id when git_credential is enabled. Default: git") 68 | 69 | return op 70 | 71 | 72 | def main(): 73 | """Main""" 74 | 75 | # Get options from command line 76 | parser = create_parser() 77 | opts = parser.parse_args(sys.argv[1:]) 78 | 79 | server = get_jenkins(opts) 80 | 81 | job_config = os.path.join('jobs', opts.job) + '.xml' 82 | xml_config = jenkins.EMPTY_CONFIG_XML 83 | if not os.path.exists(job_config): 84 | print("Could not find matching Job definition for " + opts.job) 85 | else: 86 | with open(job_config) as job_config_file: 87 | xml_config = job_config_file.read() 88 | if opts.ci_branch != 'master': 89 | # replace branch in xml definition of job 90 | import xml.etree.ElementTree as ET 91 | root = ET.fromstring(xml_config) 92 | branches = root.find('definition').find('scm').find('branches') 93 | branch = branches.find('hudson.plugins.git.BranchSpec').find('name') 94 | branch.text = '*/' + opts.ci_branch 95 | xml_config = ET.tostring(root, encoding="unicode") 96 | if opts.ci_repo: 97 | # replace git repo in xml definition of job 98 | import xml.etree.ElementTree as ET 99 | root = ET.fromstring(xml_config) 100 | ci_repos = root.find('definition').find('scm').find('userRemoteConfigs') 101 | ci_repo = ci_repos.find('hudson.plugins.git.UserRemoteConfig').find('url') 102 | ci_repo.text = opts.ci_repo 103 | xml_config = ET.tostring(root, encoding="unicode") 104 | 105 | try: 106 | server.get_job_config(opts.job) 107 | server.reconfig_job(opts.job, xml_config) 108 | except jenkins.NotFoundException: 109 | server.create_job(opts.job, xml_config) 110 | 111 | 112 | if __name__ == "__main__": 113 | main() 114 | -------------------------------------------------------------------------------- /jobs/Jenkinsfile-login: -------------------------------------------------------------------------------- 1 | node(params.BUILDER) { 2 | stage('Initialize Login') { 3 | dir('ci-scripts') { 4 | git(url:params.CI_REPO, branch:params.CI_BRANCH) 5 | } 6 | def hostname = "${NODE_NAME}" 7 | hostname = hostname[0..-10] 8 | 9 | // abuse docker again to get access to the ssh authorizedkeys file 10 | def docker_params = "--rm --name login-${BUILD_ID} --hostname ${hostname} -i --tmpfs /tmp --tmpfs /var/tmp -v /etc/localtime:/etc/localtime:ro -u 1000 -v ci_jenkins_agent:/home/jenkins -v /home/wrlbuild:/home/wrlbuild -e 'LANG=en_US.UTF-8' -e 'WORKSPACE=${WORKSPACE}' -e 'NODE_NAME=${NODE_NAME}' -e 'BUILD_DIR=${BUILD_DIR}' -e 'PUBLIC_SSH_KEY=${PUBLIC_SSH_KEY}'" 11 | 12 | // This docker image is only used to run the setup_workspace_login script 13 | // It only needs to have /home/wrlbuild with the same owner as host /home/wrlbuild 14 | // in order to get access to host /home/wrlbuild/.ssh/ directory 15 | image = "windriver/ubuntu1804_64" 16 | 17 | echo "Setup login for build ${BUILD_DIR} on ${NODE_NAME}" 18 | sh "docker run ${docker_params} ${image} ${WORKSPACE}/ci-scripts/setup_workspace_login.sh ${IMAGE_TYPE}" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /jobs/Login.xml: -------------------------------------------------------------------------------- 1 | ../images/jenkins-master/jobs/Login.xml -------------------------------------------------------------------------------- /jobs/WRLinux_Build.xml: -------------------------------------------------------------------------------- 1 | ../images/jenkins-master/jobs/WRLinux_Build.xml -------------------------------------------------------------------------------- /jobs/Walter.xml: -------------------------------------------------------------------------------- 1 | ../images/jenkins-master/jobs/Walter.xml -------------------------------------------------------------------------------- /jobs/devbuilds.xml: -------------------------------------------------------------------------------- 1 | ../images/jenkins-master/jobs/devbuilds.xml -------------------------------------------------------------------------------- /jobs/devbuilds/devbuild.xml: -------------------------------------------------------------------------------- 1 | ../../images/jenkins-master/jobs/devbuild.xml -------------------------------------------------------------------------------- /jobs/folder_create.xml: -------------------------------------------------------------------------------- 1 | ../images/jenkins-master/jobs/folder_create.xml -------------------------------------------------------------------------------- /jobs/get_job_config.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) 2017 Wind River Systems Inc. 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | import sys 24 | import ssl 25 | import jenkins 26 | 27 | if hasattr(ssl, '_create_unverified_context'): 28 | ssl._create_default_https_context = ssl._create_unverified_context 29 | 30 | 31 | def create_parser(): 32 | """Parse command line args""" 33 | from argparse import ArgumentParser 34 | 35 | descr = '''Retrieve and print xml config for a Jenkins Job''' 36 | 37 | op = ArgumentParser(description=descr) 38 | 39 | op.add_argument('--jenkins', dest='jenkins', required=True, 40 | help='Jenkins master endpoint.') 41 | 42 | op.add_argument('--job', dest='job', required=True, 43 | help='Jenkins Job name.') 44 | 45 | return op 46 | 47 | 48 | def main(): 49 | """Main""" 50 | parser = create_parser() 51 | opts = parser.parse_args(sys.argv[1:]) 52 | 53 | server = jenkins.Jenkins(opts.jenkins) 54 | 55 | job = server.get_job_config(opts.job) 56 | 57 | print(job) 58 | 59 | 60 | if __name__ == "__main__": 61 | main() 62 | -------------------------------------------------------------------------------- /layerindex/commands/layer_update.py: -------------------------------------------------------------------------------- 1 | """Update or create a Layer 2 | """ 3 | 4 | from django.core.management.base import BaseCommand, CommandError 5 | from layerindex.models import LayerItem, Branch, LayerBranch 6 | 7 | class Command(BaseCommand): 8 | help = 'Update or create a LayerItem with a new ' 9 | 10 | def add_arguments(self, parser): 11 | parser.add_argument('--branch', action='store', dest='branch', 12 | required=True, help='The LayerIndex branch this layer will be stored with.') 13 | parser.add_argument('--actual_branch', action='store', dest='actual_branch', 14 | required=False, help='The actual branch to use for the repository') 15 | parser.add_argument('--name', action='store', dest='name', 16 | required=True, help='The name of the Layer') 17 | parser.add_argument('--vcs_url', action='store', dest='vcs_url', 18 | required=True, help='Where to clone the layer from') 19 | parser.add_argument('--vcs_subdir', action='store', dest='vcs_subdir', 20 | required=False, help='Subdir of vcs_url to search for layer') 21 | 22 | def handle(self, *args, **options): 23 | branch = Branch.objects.get(name=options['branch']) 24 | 25 | layerItem, created = LayerItem.objects.get_or_create(name=options['name']) 26 | # if the layer is new, default it to published so that it can be accessed 27 | if created: 28 | layerItem.status = 'P' 29 | layerItem.layer_type = 'A' 30 | layerItem.summary = options['name'] 31 | layerItem.description = options['name'] 32 | 33 | layerItem.vcs_url = options['vcs_url'] 34 | layerItem.save() 35 | 36 | layerBranch, created = LayerBranch.objects.get_or_create(layer=layerItem, branch=branch) 37 | layerBranch.actual_branch = options.get('actual_branch', options['branch']) 38 | vcs_subdir = options.get('vcs_subdir') 39 | if vcs_subdir: 40 | layerBranch.vcs_subdir = vcs_subdir 41 | 42 | layerBranch.save() 43 | -------------------------------------------------------------------------------- /layerindex/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 Wind River Systems Inc. 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | # 10 | # The above copyright notice and this permission notice shall be included in all 11 | # copies or substantial portions of the Software. 12 | # 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | version: '3.4' 22 | services: 23 | layerindex: 24 | hostname: layerindex 25 | image: windriver/layerindex 26 | # ports: 27 | # - '5000:5000' 28 | environment: 29 | LAYERINDEX_ADMIN: "admin" 30 | LAYERINDEX_ADMIN_EMAIL: "admin@localhost" 31 | LAYERINDEX_ADMIN_PASS: "admin" 32 | GUNICORN_NUM_WORKERS: '1' 33 | GUNICORN_BIND: '0.0.0.0:5000' 34 | CELERY_NUM_WORKERS: 1 35 | STARTUP_DELAY: 5 36 | SECRET_KEY: "${SECRET_KEY:-1234}" 37 | RABBITMQ_DEFAULT_USER: "admin" 38 | RABBITMQ_DEFAULT_PASS: "mypass" 39 | depends_on: 40 | - mariadb 41 | - rabbit 42 | links: 43 | - rabbit 44 | - mariadb 45 | tmpfs: 46 | - /tmp:exec 47 | volumes: 48 | - layers_cache:/opt/layers 49 | - /etc/timezone:/etc/timezone:ro 50 | 51 | mariadb: 52 | image: mariadb 53 | # Enable UTF-8 for tables 54 | command: ["--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci"] 55 | environment: 56 | MYSQL_ROOT_PASSWORD: 'root' 57 | MYSQL_DATABASE: 'layerindex' 58 | MYSQL_USER: 'oelayer' 59 | MYSQL_PASSWORD: 'oelayer' 60 | LANG: 'en_US.UTF-8' 61 | tmpfs: 62 | - /tmp:exec 63 | healthcheck: 64 | test: ["CMD", "mysql", '--user=oelayer', '--password=oelayer', "-e", "show databases;"] 65 | interval: 5s 66 | timeout: 2s 67 | retries: 3 68 | start_period: 2m 69 | volumes: 70 | - /etc/timezone:/etc/timezone:ro 71 | 72 | rabbit: 73 | hostname: rabbit 74 | image: rabbitmq:3.6-alpine 75 | environment: 76 | RABBITMQ_DEFAULT_USER: "admin" 77 | RABBITMQ_DEFAULT_PASS: "mypass" 78 | 79 | volumes: 80 | layers_cache: 81 | -------------------------------------------------------------------------------- /layerindex/layerindex_branch_reload.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | BRANCH= 4 | RELOAD= 5 | 6 | echo "Command: $0" 7 | for i in "$@" 8 | do 9 | echo "Arg: $i" 10 | case $i in 11 | --branch*) BRANCH=${i#*=} ;; 12 | --reload) RELOAD='--fullreload' ;; 13 | *) echo "Unrecognized arg $i"; exit 1;; 14 | esac 15 | shift 16 | done 17 | 18 | # Validation of provided environment args 19 | if [ -z "$BRANCH" ]; then 20 | echo "Without a branch to use for updates, there is nothing to do" 21 | exit 1 22 | fi 23 | 24 | # Local layerindex will have project name based on build id to avoid conflicts 25 | COMPOSE_PROJECT_NAME=${PWD##*/} 26 | if [ -n "$BUILD_ID" ]; then 27 | export COMPOSE_PROJECT_NAME="build$BUILD_ID" 28 | fi 29 | 30 | DOCKER_EXEC=(docker-compose exec -T) 31 | 32 | "${DOCKER_EXEC[@]}" layerindex /bin/bash -c "cd /opt/layerindex/layerindex; ./update.py --branch=$BRANCH $RELOAD" 33 | -------------------------------------------------------------------------------- /layerindex/layerindex_export.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2017 Wind River Systems Inc. 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a copy 5 | # of this software and associated documentation files (the "Software"), to deal 6 | # in the Software without restriction, including without limitation the rights 7 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | # copies of the Software, and to permit persons to whom the Software is 9 | # furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in all 12 | # copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | # SOFTWARE. 21 | 22 | COMPOSE_PROJECT_NAME=${PWD##*/} 23 | if [ -n "$BUILD_ID" ]; then 24 | export COMPOSE_PROJECT_NAME="build$BUILD_ID" 25 | fi 26 | 27 | echo "Command: $0" 28 | for i in "$@" 29 | do 30 | echo "Arg: $i" 31 | case $i in 32 | --type=*) TYPE=${i#*=} ;; 33 | --branch=*) BRANCH=${i#*=} ;; 34 | --output=*) OUTPUT=${i#*=} ;; 35 | --output_format=*) OUTPUT_FORMAT=${i#*=} ;; 36 | --source=*) SOURCE=${i#*=} ;; 37 | *) ;; 38 | esac 39 | shift 40 | done 41 | 42 | if [ -z "$TYPE" ]; then 43 | TYPE=restapi-web 44 | fi 45 | 46 | if [ -z "$BRANCH" ]; then 47 | echo "Branch not defined" 48 | exit 1 49 | fi 50 | 51 | if [ -z "$OUTPUT" ]; then 52 | OUTPUT='/opt/mirror-index' 53 | fi 54 | 55 | if [ -z "$OUTPUT_FORMAT" ]; then 56 | OUTPUT_FORMAT=restapi 57 | fi 58 | 59 | if [ -z "$SOURCE" ]; then 60 | SOURCE=http://localhost:5000/layerindex/api/ 61 | fi 62 | 63 | DOCKER_EXEC=(docker-compose exec -T) 64 | 65 | TRANSFORM_CMD+=(--input "$TYPE" --branch "$BRANCH" --output "$OUTPUT" --output_format "$OUTPUT_FORMAT" --source "$SOURCE") 66 | 67 | # transform local running layerindex to mirror-index format 68 | echo 69 | echo "Exporting layerindex to $OUTPUT/layerindex.json" 70 | "${DOCKER_EXEC[@]}" layerindex /bin/bash -c "cd /opt/wrlinux-[9x]/bin; ./transform_index.py ${TRANSFORM_CMD[*]}" 71 | 72 | echo "Copying $OUTPUT/layerindex.json into the workarea" 73 | docker cp "${COMPOSE_PROJECT_NAME}_layerindex_1:${OUTPUT}/layerindex.json" . 74 | -------------------------------------------------------------------------------- /layerindex/layerindex_layer_reload.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Validation of provided environment args 4 | if [ -z "$LAYER_NAME" ]; then 5 | echo "Without a layer name, there is nothing to do" 6 | exit 1 7 | fi 8 | 9 | if [ -z "$BRANCH" ]; then 10 | echo "Without a branch to use for updates, there is nothing to do" 11 | exit 1 12 | fi 13 | 14 | # Local layerindex will have project name based on build id to avoid conflicts 15 | COMPOSE_PROJECT_NAME=${PWD##*/} 16 | if [ -n "$BUILD_ID" ]; then 17 | export COMPOSE_PROJECT_NAME="build$BUILD_ID" 18 | fi 19 | 20 | DOCKER_EXEC=(docker-compose exec -T) 21 | 22 | "${DOCKER_EXEC[@]}" layerindex /bin/bash -c "cd /opt/layerindex/layerindex; ./update.py --branch=$BRANCH -l $LAYER_NAME --fullreload" 23 | -------------------------------------------------------------------------------- /layerindex/layerindex_layer_update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Validation of provided environment args 4 | if [ -z "$DEVBUILD_LAYER_NAME" ]; then 5 | echo "Without a layer name, there is nothing to do" 6 | exit 1 7 | fi 8 | 9 | if [ -z "$BRANCH" ]; then 10 | echo "Without a branch to use for updates, there is nothing to do" 11 | exit 1 12 | fi 13 | 14 | # Local layerindex will have project name based on build id to avoid conflicts 15 | 16 | COMPOSE_PROJECT_NAME=${PWD##*/} 17 | if [ -n "$BUILD_ID" ]; then 18 | export COMPOSE_PROJECT_NAME="build$BUILD_ID" 19 | fi 20 | 21 | # Support only changing the actual branch or just the vcs_url. 22 | # If neither is provided, the layer will be updated for nothing 23 | 24 | ARGS=(--name $DEVBUILD_LAYER_NAME --branch $BRANCH) 25 | 26 | if [ -n "$DEVBUILD_LAYER_VCS_URL" ]; then 27 | ARGS+=(--vcs_url $DEVBUILD_LAYER_VCS_URL) 28 | fi 29 | 30 | if [ -n "$DEVBUILD_LAYER_ACTUAL_BRANCH" ]; then 31 | ARGS+=(--actual_branch $DEVBUILD_LAYER_ACTUAL_BRANCH) 32 | fi 33 | 34 | if [ -n "$DEVBUILD_LAYER_VCS_SUBDIR" ]; then 35 | # workaround for oe-core which has layer contents in meta subdir 36 | if [ "$DEVBUILD_LAYER_VCS_SUBDIR" != "openembedded-core" ]; then 37 | ARGS+=(--vcs_subdir $DEVBUILD_LAYER_VCS_SUBDIR) 38 | else 39 | ARGS+=(--vcs_subdir meta) 40 | fi 41 | fi 42 | 43 | DOCKER_EXEC=(docker-compose exec -T) 44 | 45 | "${DOCKER_EXEC[@]}" layerindex /bin/bash -xc "cd /opt/layerindex; python3 manage.py layer_update ${ARGS[*]}" 46 | 47 | "${DOCKER_EXEC[@]}" layerindex /bin/bash -c "cd /opt/layerindex/layerindex; ./update.py --branch=$BRANCH -l $DEVBUILD_LAYER_NAME --fullreload" 48 | 49 | -------------------------------------------------------------------------------- /layerindex/layerindex_stop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (c) 2017 Wind River Systems Inc. 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | if [ -n "$BUILD_ID" ]; then 24 | export COMPOSE_PROJECT_NAME="build$BUILD_ID" 25 | fi 26 | 27 | # stop and clean up containers and volumes 28 | docker-compose stop 29 | docker-compose rm -v -f 30 | docker-compose down -v 31 | -------------------------------------------------------------------------------- /poky_setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (c) 2017 Wind River Systems Inc. 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | source "$(dirname "$0")"/common.sh 24 | 25 | BRANCH=pyro 26 | SDKARCH=${SDKARCH:-$(uname -m)} 27 | 28 | echo "Command: $0" 29 | for i in "$@" 30 | do 31 | echo "Arg: $i" 32 | case $i in 33 | --branch=*) BRANCH=${i#*=} ;; 34 | *) ;; 35 | esac 36 | shift 37 | done 38 | 39 | git clone --branch "$BRANCH" --single-branch git://git.yoctoproject.org/poky 40 | mv poky/* . 41 | mv poky/.templateconf . 42 | 43 | BUILDTOOLS=$(curl -s -L https://raw.githubusercontent.com/WindRiver-Labs/wrlinux-9/WRLINUX_9_BASE/data/environment.d/04_wrl_buildtools.sh | grep BUILDTOOLS_REMOTE: | cut -d'-' -f 2- | cut -d'}' -f 1) 44 | 45 | BUILDTOOLS_REMOTE="$WORKSPACE/wrlinux-WRLinux-9-Base/$BUILDTOOLS.git" 46 | if [ ! -d "$BUILDTOOLS_REMOTE" ]; then 47 | BUILDTOOLS_REMOTE="https://github.com/WindRiver-Labs/$BUILDTOOLS" 48 | fi 49 | 50 | git clone "$BUILDTOOLS_REMOTE" buildtools 51 | 52 | mkdir bin 53 | 54 | BUILDTOOLSSDK=$(find buildtools -name "${SDKARCH}-buildtools-nativesdk-standalone-*.sh" 2>/dev/null | sort | head -n1) 55 | if [ -z "${BUILDTOOLSSDK}" ]; then 56 | echo "Unable to find buildtools-nativesdk-standalone archive for ${SDKARCH}." >&2 57 | echo >&2 58 | exit 1 59 | fi 60 | ${BUILDTOOLSSDK} -d bin/buildtools -y 61 | 62 | ENVIRON=$(find -L bin/buildtools -name "environment-setup-${SDKARCH}-*-linux" | head -n1) 63 | if [ -z "${ENVIRON}" ]; then 64 | echo "Error unable to load buildtools environment-setup file." >&2 65 | exit 1 66 | fi 67 | ln -sf "$ENVIRON" . 68 | -------------------------------------------------------------------------------- /scripts/cleanup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (c) 2017 Wind River Systems Inc. 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | cleanup() { 24 | local BUILD="$1" 25 | local TOP="$2" 26 | 27 | if [ -z "$NAME" ]; then 28 | echo "Error: Build NAME is not defined!" 29 | exit 1 30 | fi 31 | 32 | source "$TOP/common.sh" 33 | local BUILD_STATUS=$(get_stat 'Status') 34 | if [ "$BUILD_STATUS" == "PASSED" ]; then 35 | echo "Removing build directory $BUILD/$NAME" 36 | # fail if $BUILD is empty SC2115 37 | rm -rf "${BUILD:?}/$NAME" 38 | fi 39 | 40 | echo "Removing old build directories" 41 | 42 | #default threshold: 200G df uses 1Kb blocks so 1024 * 1024 * 200 43 | local DISK_THRESHOLD=209715200 44 | local REMAINING_DISK= 45 | 46 | local DAYS= 47 | for DAYS in 3 2 1 0; do 48 | REMAINING_DISK=$(get_remaining_disk_space /home/jenkins/workspace) 49 | if [ "$REMAINING_DISK" -lt "$DISK_THRESHOLD" ]; then 50 | echo "Removing sstate files that have not been accessed in $DAYS days" 51 | find /home/jenkins/workspace/*_sstate_cache -atime +"$DAYS" -delete 52 | 53 | echo "Removing build areas older than $DAYS days" 54 | find /home/jenkins/workspace/WRLinux_Build*/builds -maxdepth 1 -type d -name 'builds-*' -ctime +"$DAYS" -exec rm -rf {} \; 55 | else 56 | break 57 | fi 58 | done 59 | } 60 | 61 | cleanup "$@" 62 | 63 | exit 0 64 | -------------------------------------------------------------------------------- /scripts/display_build_log.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (c) 2017 Wind River Systems Inc. 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | # output build log to the Jenkins log. Useful if using Jenkins plugins to process 24 | # the build logs 25 | 26 | display_log() 27 | { 28 | local BUILD="$1" 29 | 30 | cat "$BUILD/00-wrbuild.log" 31 | } 32 | 33 | display_log "$@" 34 | 35 | exit 0 36 | -------------------------------------------------------------------------------- /scripts/report.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (c) 2017 Wind River Systems Inc. 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | function get_jenkins_log () { 24 | local BUILD="$1" 25 | 26 | if [[ "$JENKINS_URL" != *"wrs.com"* ]]; then 27 | JENKINS_URL=${JENKINS_URL::-9}.wrs.com/jenkins/ 28 | fi 29 | if [ -z "$JOB_BASE_NAME" ]; then 30 | JOB_BASE_NAME='WRLinux_Build' 31 | fi 32 | JENKINS_LOG_URL="${JENKINS_URL}job/${JOB_BASE_NAME}/${BUILD_ID}/consoleText" 33 | JENKINS_LOG=${BUILD}/jenkins_job_${BUILD_ID}_console.log 34 | 35 | # get jenkins console log 36 | echo "curl -k $JENKINS_LOG_URL -o $JENKINS_LOG" 37 | curl -k "$JENKINS_LOG_URL" -o "$JENKINS_LOG" 38 | rsync -avL "$JENKINS_LOG" "rsync://${RSYNC_SERVER}/${RSYNC_DEST_DIR}/" 39 | } 40 | 41 | report() { 42 | source "$WORKSPACE"/ci-scripts/common.sh 43 | 44 | local BUILD="$1" 45 | export HOME=/home/jenkins 46 | local REPORT_STATFILE=${BUILD}/summary_${BUILD_ID}.json 47 | 48 | get_jenkins_log "$BUILD" 49 | 50 | if [ -z "$REPORT_SERVER" ]; then 51 | echo "Do not know report server" 52 | exit 0 53 | fi 54 | 55 | command -v curl >/dev/null 2>&1 || { echo >&2 "curl required. Aborting."; exit 0; } 56 | 57 | # Handle build failure report 58 | if [ ! -f "$BUILD/teststats.json" ] || [[ "$TEST" == 'disable' ]]; then 59 | if [ "$TEST" != 'disable' ] && [ -f "$BUILD/00-PASS" ]; then 60 | echo "Report info: Build passed and teststats.json has not been generated." 61 | exit 0 62 | else 63 | create_report_statfile "$REPORT_STATFILE" "$JENKINS_URL" "$JOB_BASE_NAME" "$BUILD" 64 | 65 | if [ -f "$BUILD/00-PASS" ]; then 66 | echo " \"build_result\": \"PASSED\"" >> "$REPORT_STATFILE" 67 | elif [ -f "$BUILD/00-FAIL" ]; then 68 | echo " \"build_result\": \"FAILED\"" >> "$REPORT_STATFILE" 69 | fi 70 | 71 | WRL_VER=$(get_wrlinux_version "$BUILD") 72 | 73 | { 74 | echo " }," 75 | echo -e "\n \"test_info\": {" 76 | echo " \"wrl_ver\": \"$WRL_VER\"," 77 | echo " \"test_images\": \"${HTTP_ROOT}/${RSYNC_DEST_DIR}\"," 78 | echo " \"test_result\": \"NULL\"" 79 | echo " }" 80 | echo "}" 81 | } >> "$REPORT_STATFILE" 82 | 83 | rsync -avL "$REPORT_STATFILE" "rsync://${RSYNC_SERVER}/${RSYNC_DEST_DIR}/" 84 | fi 85 | else 86 | cp ${BUILD}/teststats.json "$REPORT_STATFILE" 87 | rsync -avL "$REPORT_STATFILE" "rsync://${RSYNC_SERVER}/${RSYNC_DEST_DIR}/" 88 | # It should not happen when build failed but test continues, print WARNING. 89 | if [ -f "$BUILD/00-FAIL" ]; then 90 | echo "WARNING from report: Build failed! Test should not continue." 91 | fi 92 | fi 93 | 94 | echo "Reporting to $REPORT_SERVER" 95 | current_date=$(date +%Y.%m.%d) 96 | # report to elasticsearch server 97 | curl -XPOST "${REPORT_SERVER}/wrigel-${current_date}/logs" -H "Content-Type: application/json" -d @"$REPORT_STATFILE" 98 | } 99 | 100 | report "$@" 101 | 102 | exit 0 103 | -------------------------------------------------------------------------------- /scripts/send_mail.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (c) 2017 Wind River Systems Inc. 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | send_mail() 24 | { 25 | local BUILD="$1" 26 | local TOP="$2" 27 | 28 | # for generate_mail function 29 | source "$TOP/common.sh" 30 | 31 | # email addresses come as comma separated list 32 | if [ -z "$EMAIL" ]; then 33 | echo "No one wants this email" 34 | exit 0 35 | fi 36 | if [ -z "$SMTPSERVER" ]; then 37 | echo "Do not know where to send the email" 38 | exit 0 39 | fi 40 | 41 | command -v git >/dev/null 2>&1 || { echo >&2 "git required. Aborting."; exit 0; } 42 | 43 | if [ ! -f "$BUILD/mail.txt" ]; then 44 | echo "Generating mail" 45 | generate_mail "$BUILD" 46 | fi 47 | 48 | echo "Send build failure email for $BUILD" 49 | 50 | # Build up set of --to addresses as bash array because it properly passes 51 | # sets of args to another program 52 | local ADDRESS= 53 | set -f; IFS=, 54 | for ADDRESS in $EMAIL ; do 55 | TO_STR=("${TO_STR[@]}" --to "$ADDRESS") 56 | done 57 | set +f; unset IFS 58 | 59 | # git send-email requires .gitconfig at writable location and perl requires that 60 | # LANG is a valid locale. The postbuild image meets these requirements 61 | git config --global user.email "ci-scripts@windriver.com" 62 | git config --global user.name "CI" 63 | git send-email --from=ci-scripts@windriver.com --quiet --confirm=never \ 64 | "${TO_STR[@]}" "--smtp-server=$SMTPSERVER" "$BUILD/mail.txt" 65 | if [ $? != 0 ]; then 66 | echo "git send fail email failed" 67 | exit 1 68 | fi 69 | } 70 | 71 | send_mail "$@" 72 | 73 | exit 0 74 | -------------------------------------------------------------------------------- /setup_workspace_login.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | IFS=$'\n\t' 4 | 5 | TYPE='build' 6 | if [[ -z "$1" ]]; then 7 | TYPE="$1" 8 | fi 9 | 10 | main() 11 | { 12 | if [ -z "$BUILD_DIR" ] || [ ! -f "$BUILD_DIR/${TYPE}_login.sh" ]; then 13 | echo "ERROR: Require build dir with ${TYPE}_login.sh for the login" 14 | exit 1 15 | fi 16 | 17 | if [ -z "$PUBLIC_SSH_KEY" ]; then 18 | echo "ERROR: Require a public ssh key" 19 | exit 1 20 | fi 21 | 22 | local SSH_DIR=/home/wrlbuild/.ssh 23 | if [ ! -d "$SSH_DIR" ]; then 24 | mkdir -p "$SSH_DIR" 25 | chmod 700 "$SSH_DIR" 26 | fi 27 | 28 | local AUTH_KEYS="$SSH_DIR/authorized_keys2" 29 | if [ ! -f "$AUTH_KEYS" ]; then 30 | touch "$AUTH_KEYS" 31 | chmod 600 "$AUTH_KEYS" 32 | fi 33 | 34 | # Since stamp file is created outside of docker, the build dir is not accessible 35 | # create a stamp file in the ssh dir with slashes replaced by hashes 36 | local LOGIN_STAMP="${SSH_DIR}/.${BUILD_DIR////#}.login" 37 | 38 | # add the ssh key to the authorized_keys2 file to allow passwordless 39 | # logins that start the same docker in the right place 40 | if grep -q "$BUILD_DIR" "$AUTH_KEYS"; then 41 | # is there actually a login in progress 42 | if [ -f "${LOGIN_STAMP}" ]; then 43 | echo "ERROR: A login has already been setup for ${BUILD_DIR}. Try again later" 44 | exit 1 45 | else 46 | # probably the last login attempt was aborted and the login never occurred. 47 | /bin/sed -i "\\#${BUILD_DIR}#d" "$AUTH_KEYS" 48 | fi 49 | else 50 | # if there isn't an entry in authorized_keys, then there shouldn't be a login stamp 51 | rm -f "$LOGIN_STAMP" 52 | fi 53 | 54 | CMD=$(cat "$BUILD_DIR/${TYPE}_login.sh") 55 | 56 | echo "Adding key for $BUILD_DIR to authorized keys" 57 | echo "command=\"touch ${LOGIN_STAMP}; $CMD; /bin/rm -f ${LOGIN_STAMP}; /bin/sed -i '\\#${BUILD_DIR}#d' $AUTH_KEYS\" ssh-rsa $PUBLIC_SSH_KEY $BUILD_DIR" >> "$AUTH_KEYS" 58 | 59 | # allow a minute for a login. If it doesn't happen, abort and remove the key 60 | local TIMEOUT=60 61 | local COUNTER=0 62 | local LOGIN_DETECTED=0 63 | while [ "$COUNTER" -lt "$TIMEOUT" ]; do 64 | if [ -f "$LOGIN_STAMP" ]; then 65 | echo "Login detected. Ending Jenkins Job" 66 | LOGIN_DETECTED=1 67 | break 68 | else 69 | echo "Waiting for login on $BUILD_DIR" 70 | COUNTER=$((COUNTER + 2)) 71 | sleep 2 72 | fi 73 | done 74 | 75 | # if no login was detected, cleanup and fail the job 76 | if [ "$LOGIN_DETECTED" == "0" ]; then 77 | echo "No login detected. Removing login entry and failing job" 78 | /bin/sed -i "\\#${BUILD_DIR}#d" "$AUTH_KEYS" 79 | exit 1 80 | fi 81 | exit 0 82 | } 83 | 84 | main "$@" 85 | -------------------------------------------------------------------------------- /test/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | false 6 | 7 | 8 | 9 | 5 10 | 10 11 | -1 12 | -1 13 | 14 | 15 | 16 | false 17 | 18 | 19 | 20 | 21 | BUILDER 22 | 23 | 24 | true 25 | 26 | 27 | BUILD_DIR 28 | 29 | 30 | true 31 | 32 | 33 | CI_BRANCH 34 | 35 | master 36 | true 37 | 38 | 39 | CI_REPO 40 | 41 | https://github.com/WindRiver-OpenSourceLabs/ci-scripts.git 42 | true 43 | 44 | 45 | PUBLIC_SSH_KEY 46 | 47 | 48 | true 49 | 50 | 51 | 52 | 53 | 54 | 55 | 2 56 | 57 | 58 | git://ala-lxgit.wrs.com/projects/wrlinux-ci/ci-scripts.git 59 | 60 | 61 | 62 | 63 | */master 64 | 65 | 66 | false 67 | 68 | 69 | 70 | jobs/Jenkinsfile-login 71 | true 72 | 73 | 74 | false 75 | -------------------------------------------------------------------------------- /test/custom_images.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | release: master-wr 3 | email: Konrad.Scherer@windriver.com 4 | distros: 5 | machines: 6 | - qemux86-64 7 | images: 8 | - wrlinux-image-glibc-core 9 | - wrlinux-image-glibc-std 10 | recipes: 11 | sdk: no 12 | sdk_ext: no 13 | sdk_machine: i686-mingw32 14 | repos: 15 | - dir: layers/meta-virtualization 16 | repo: git://ala-lxgit.wrs.com/wrpush/kscherer/meta-virtualization 17 | branch: pull-meta-virtualization-devbuild-20190604-1011-N2oltUQak0 18 | layers: 19 | - meta-virtualization 20 | -------------------------------------------------------------------------------- /test/fedora_build.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | release: master-wr 3 | email: Konrad.Scherer@windriver.com 4 | distros: 5 | machines: 6 | - qemux86-64 7 | images: 8 | recipes: 9 | sdk: no 10 | sdk_ext: no 11 | sdk_machine: i686-mingw32 12 | build_image: wr-docker-registry:5000/fedora29_64 13 | repos: 14 | - dir: layers/meta-virtualization 15 | repo: git://ala-lxgit.wrs.com/wrpush/kscherer/meta-virtualization 16 | branch: pull-meta-virtualization-devbuild-20190611-1109-g5ToijPkxK 17 | layers: 18 | - meta-virtualization 19 | -------------------------------------------------------------------------------- /test/recipes.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | release: master-wr 3 | email: Konrad.Scherer@windriver.com 4 | distros: 5 | machines: 6 | - qemux86-64 7 | images: 8 | recipes: 9 | - avahi 10 | - bind 11 | sdk: no 12 | sdk_ext: no 13 | sdk_machine: i686-mingw32 14 | repos: 15 | - dir: layers/meta-virtualization 16 | repo: git://ala-lxgit.wrs.com/wrpush/kscherer/meta-virtualization 17 | branch: pull-meta-virtualization-devbuild-20190604-1337-l52UezkTMo 18 | layers: 19 | - meta-virtualization 20 | -------------------------------------------------------------------------------- /test/sdk_core.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | release: master-wr 3 | email: Konrad.Scherer@windriver.com 4 | distros: 5 | machines: 6 | - qemux86-64 7 | images: 8 | - wrlinux-image-glibc-core 9 | recipes: 10 | sdk: true 11 | sdk_ext: false 12 | sdkmachine: x86_64 13 | build_image: 14 | repos: 15 | - dir: layers/meta-virtualization 16 | repo: git://ala-lxgit.wrs.com/wrpush/kscherer/meta-virtualization 17 | branch: pull-meta-virtualization-devbuild-20190620-1632-PeR9joi9DM 18 | layers: 19 | - meta-virtualization 20 | -------------------------------------------------------------------------------- /test/single_machine.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | release: master-wr 3 | email: Konrad.Scherer@windriver.com 4 | distros: 5 | machines: 6 | - qemux86-64 7 | images: 8 | - wrlinux-image-glibc-core 9 | recipes: 10 | sdk: no 11 | sdk_ext: no 12 | sdk_machine: x86_64 13 | build_image: 14 | test: enable 15 | repos: 16 | - dir: layers/meta-virtualization 17 | repo: git://ala-lxgit.wrs.com/wrpush/kscherer/meta-virtualization 18 | branch: pull-meta-virtualization-devbuild-20190531-1519-YVDt7oujhC 19 | layers: 20 | - meta-virtualization 21 | -------------------------------------------------------------------------------- /test/upload_devbuild.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | 4 | main() 5 | { 6 | local SERVER=https://ala-blade21.wrs.com 7 | local CI_REPO=git://ala-lxgit.wrs.com/projects/wrlinux-ci/ci-scripts 8 | local CI_BRANCH=master 9 | local DEVBUILD_ARGS= 10 | local LOCALCONF=no 11 | 12 | for i in "$@" 13 | do 14 | echo "Arg: $i" 15 | case $i in 16 | --server=*) SERVER=${i#*=} ;; 17 | --ci_repo=*) CI_REPO=${i#*=} ;; 18 | --ci_branch=*) CI_BRANCH=${i#*=} ;; 19 | --localconf=*) LOCALCONF=${i#*=} ;; 20 | --devbuild=*) DEVBUILD_ARGS=${i#*=} ;; 21 | *) ;; 22 | esac 23 | shift 24 | done 25 | 26 | if [ "${SERVER:0:8}" != 'https://' ]; then 27 | SERVER="https://$SERVER" 28 | fi 29 | 30 | if [ ! -f "$DEVBUILD_ARGS" ]; then 31 | echo "Invalid file: $DEVBUILD_ARGS" 32 | exit 1 33 | fi 34 | 35 | if [ "$LOCALCONF" != 'no' ] && [ ! -f "$LOCALCONF" ]; then 36 | echo "Invalid conf file: $LOCALCONF" 37 | exit 1 38 | fi 39 | 40 | local APITOKEN= 41 | APITOKEN=$(curl -k -s "$SERVER/auth/build_auth.txt" | tr -d '\n') 42 | 43 | local CRUMB= 44 | CRUMB=$(curl -k -s --user "$APITOKEN" \ 45 | "$SERVER"/jenkins/crumbIssuer/api/xml?xpath='concat(//crumbRequestField,":",//crumb)' ) 46 | 47 | local LOCALCONF_UPLOAD=LOCALCONF@/dev/null 48 | if [ -f "$LOCALCONF" ]; then 49 | LOCALCONF_UPLOAD=LOCALCONF@"$LOCALCONF" 50 | fi 51 | 52 | local PARAMS="token=devbuild&CI_REPO=$CI_REPO&CI_BRANCH=$CI_BRANCH" 53 | 54 | echo "Starting devbuild on $SERVER/jenkins" 55 | curl -X POST -k -H "$CRUMB" --user "$APITOKEN" \ 56 | --data-urlencode DEVBUILD_ARGS@"$DEVBUILD_ARGS" \ 57 | --data-urlencode "$LOCALCONF_UPLOAD" \ 58 | "$SERVER/jenkins/job/devbuilds/job/devbuild/buildWithParameters?$PARAMS" 59 | } 60 | 61 | main "$@" 62 | -------------------------------------------------------------------------------- /test_configure.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | # Copyright (c) 2018 Wind River Systems Inc. 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | import os 24 | import sys 25 | import yaml 26 | 27 | def main(): 28 | """Main""" 29 | 30 | WORKSPACE = os.environ['WORKSPACE'] 31 | TOP = WORKSPACE + '/ci-scripts/' 32 | LOCALCONF = 'conf/local.conf' 33 | TEST = os.environ['TEST'] 34 | TEST_CONFIGS_FILE = TOP + os.environ['TEST_CONFIGS_FILE'] 35 | 36 | if os.path.exists(LOCALCONF) == False: 37 | print("ERROR: The file does not exist: " + LOCALCONF) 38 | sys.exit(1) 39 | 40 | if TEST == 'disable' or TEST == '' or TEST is None: 41 | print('Test is not enabled') 42 | sys.exit(0) 43 | else: 44 | print('Test is enabled and set to ' + TEST) 45 | 46 | if TEST_CONFIGS_FILE is None: 47 | TEST_CONFIGS_FILE = 'configs/test_configs.yaml' 48 | 49 | if not os.path.exists(TEST_CONFIGS_FILE): 50 | print("ERROR: The file does not exist: " + TEST_CONFIGS_FILE) 51 | else: 52 | print("Test configuration file exists: " + TEST_CONFIGS_FILE) 53 | 54 | with open(TEST_CONFIGS_FILE) as test_configs_file: 55 | test_configs = yaml.safe_load(test_configs_file) 56 | if test_configs is None: 57 | sys.exit(1) 58 | 59 | # Write conf/local.conf 60 | with open(LOCALCONF, "a") as local_conf: 61 | for test_config in test_configs: 62 | if test_config['name'] == TEST: 63 | for build_option in test_config['build_options']: 64 | local_conf.write(build_option + "\n") 65 | 66 | if __name__ == "__main__": 67 | main() 68 | -------------------------------------------------------------------------------- /test_postprocess.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (c) 2017 Wind River Systems Inc. 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | 24 | function setup_post_scripts { 25 | local POST_DIR="$1" 26 | local POST_SCRIPTS="$2" 27 | local BUILD="$3" 28 | local SCRIPT= 29 | local COUNTER_STR= 30 | 31 | mkdir -p "${BUILD}/${POST_DIR}" 32 | 33 | COUNTER=0 34 | set -f; IFS=, 35 | for SCRIPT in $POST_SCRIPTS; do 36 | COUNTER_STR=$(printf "%02d" "$COUNTER") 37 | local SCRIPT_FULLPATH="$WORKSPACE/ci-scripts/scripts/${SCRIPT}.sh" 38 | if [ -f "$SCRIPT_FULLPATH" ]; then 39 | ln -s "$SCRIPT_FULLPATH" "${BUILD}/${POST_DIR}/${COUNTER_STR}-$SCRIPT" 40 | fi 41 | COUNTER=$((COUNTER + 1)) 42 | done 43 | set +f; unset IFS 44 | } 45 | 46 | run_post_scripts() 47 | { 48 | local BUILD="$1" 49 | local POST_SCRIPT_DIR="$2" 50 | 51 | if [ -d "$BUILD/$POST_SCRIPT_DIR" ]; then 52 | ( 53 | run-parts --arg="$BUILD" --arg="$WORKSPACE/ci-scripts" \ 54 | -- "$BUILD/$POST_SCRIPT_DIR" 55 | ) 56 | fi 57 | } 58 | 59 | main() 60 | { 61 | local BUILD="$WORKSPACE/builds/builds-$BUILD_ID" 62 | cd "$BUILD" || exit 1 63 | 64 | setup_post_scripts "post-test-success.d" "$POST_TEST_SUCCESS" "$BUILD" 65 | setup_post_scripts "post-test-fail.d" "$POST_TEST_FAIL" "$BUILD" 66 | 67 | if [ -f "00-TEST-PASS" ]; then 68 | run_post_scripts "$BUILD" "post-test-success.d" 69 | elif [ -f "00-TEST-FAIL" ]; then 70 | run_post_scripts "$BUILD" "post-test-fail.d" 71 | fi 72 | } 73 | 74 | main "$@" 75 | -------------------------------------------------------------------------------- /vars/Wrigel.groovy: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env groovy 2 | // -*- mode: groovy; tab-width: 2; groovy-indent-offset: 2 -*- 3 | // Copyright (c) 2017 Wind River Systems Inc. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | def call(devbuild) { 24 | 25 | def buildNumber = Integer.parseInt(env.BUILD_ID) 26 | 27 | println("Create devbuild for ${devbuild.email} on ${devbuild.release}") 28 | 29 | for ( repo in devbuild.repos ) { 30 | println("Dir: ${repo.dir}") 31 | println("Repo: ${repo.repo}") 32 | println("Branch: ${repo.branch}") 33 | for ( layer in repo.layers ) { 34 | println("Layer: ${layer}") 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /wr-lx-setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (c) 2017 Wind River Systems Inc. 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | if [ -z "$BRANCH" ]; then 24 | BRANCH=master 25 | fi 26 | SDKARCH=${SDKARCH:-$(uname -m)} 27 | WR_LX_SETUP=git://github.com/Wind-River/wr-lx-setup.git 28 | 29 | git clone --single-branch --branch "$BRANCH" "$WR_LX_SETUP" setup 2>&1 30 | 31 | BUILDTOOLS=$(curl -s -L https://raw.githubusercontent.com/WindRiver-Labs/wrlinux-9/WRLINUX_9_BASE/data/environment.d/04_wrl_buildtools.sh | grep BUILDTOOLS_REMOTE: | cut -d'-' -f 2- | cut -d'}' -f 1) 32 | 33 | BUILDTOOLS_REMOTE="$WORKSPACE/wrlinux-WRLinux-9-Base/$BUILDTOOLS.git" 34 | if [ ! -d "$BUILDTOOLS_REMOTE" ]; then 35 | BUILDTOOLS_REMOTE="https://github.com/WindRiver-Labs/$BUILDTOOLS" 36 | fi 37 | 38 | git clone "$BUILDTOOLS_REMOTE" buildtools 39 | 40 | mkdir bin 41 | 42 | BUILDTOOLSSDK=$(find buildtools -name "${SDKARCH}-buildtools-nativesdk-standalone-*.sh" 2>/dev/null | sort | head -n1) 43 | if [ -z "${BUILDTOOLSSDK}" ]; then 44 | echo "Unable to find buildtools-nativesdk-standalone archive for ${SDKARCH}." >&2 45 | echo >&2 46 | exit 1 47 | fi 48 | ${BUILDTOOLSSDK} -d bin/buildtools -y 49 | 50 | ENVIRON=$(find -L bin/buildtools -name "environment-setup-${SDKARCH}-*-linux" | head -n1) 51 | if [ -z "${ENVIRON}" ]; then 52 | echo "Error unable to load buildtools environment-setup file." >&2 53 | exit 1 54 | fi 55 | ln -sf "$ENVIRON" . 56 | . "./$ENVIRON" 57 | 58 | # When doing devbuilds, setup needs to use the local layerindex 59 | if [ -n "$DEVBUILD_LAYER_NAME" ]; then 60 | sed -i "s#http://layers.openembedded.org/layerindex/api/#http://layerindex:5000/layerindex/api/#" setup/bin/settings.py 61 | fi 62 | 63 | # drop first param which is name of this script 64 | shift 65 | ./setup/setup.sh "$@" 66 | -------------------------------------------------------------------------------- /yaml/composer.py: -------------------------------------------------------------------------------- 1 | 2 | __all__ = ['Composer', 'ComposerError'] 3 | 4 | from .error import MarkedYAMLError 5 | from .events import * 6 | from .nodes import * 7 | 8 | class ComposerError(MarkedYAMLError): 9 | pass 10 | 11 | class Composer: 12 | 13 | def __init__(self): 14 | self.anchors = {} 15 | 16 | def check_node(self): 17 | # Drop the STREAM-START event. 18 | if self.check_event(StreamStartEvent): 19 | self.get_event() 20 | 21 | # If there are more documents available? 22 | return not self.check_event(StreamEndEvent) 23 | 24 | def get_node(self): 25 | # Get the root node of the next document. 26 | if not self.check_event(StreamEndEvent): 27 | return self.compose_document() 28 | 29 | def get_single_node(self): 30 | # Drop the STREAM-START event. 31 | self.get_event() 32 | 33 | # Compose a document if the stream is not empty. 34 | document = None 35 | if not self.check_event(StreamEndEvent): 36 | document = self.compose_document() 37 | 38 | # Ensure that the stream contains no more documents. 39 | if not self.check_event(StreamEndEvent): 40 | event = self.get_event() 41 | raise ComposerError("expected a single document in the stream", 42 | document.start_mark, "but found another document", 43 | event.start_mark) 44 | 45 | # Drop the STREAM-END event. 46 | self.get_event() 47 | 48 | return document 49 | 50 | def compose_document(self): 51 | # Drop the DOCUMENT-START event. 52 | self.get_event() 53 | 54 | # Compose the root node. 55 | node = self.compose_node(None, None) 56 | 57 | # Drop the DOCUMENT-END event. 58 | self.get_event() 59 | 60 | self.anchors = {} 61 | return node 62 | 63 | def compose_node(self, parent, index): 64 | if self.check_event(AliasEvent): 65 | event = self.get_event() 66 | anchor = event.anchor 67 | if anchor not in self.anchors: 68 | raise ComposerError(None, None, "found undefined alias %r" 69 | % anchor, event.start_mark) 70 | return self.anchors[anchor] 71 | event = self.peek_event() 72 | anchor = event.anchor 73 | if anchor is not None: 74 | if anchor in self.anchors: 75 | raise ComposerError("found duplicate anchor %r; first occurrence" 76 | % anchor, self.anchors[anchor].start_mark, 77 | "second occurrence", event.start_mark) 78 | self.descend_resolver(parent, index) 79 | if self.check_event(ScalarEvent): 80 | node = self.compose_scalar_node(anchor) 81 | elif self.check_event(SequenceStartEvent): 82 | node = self.compose_sequence_node(anchor) 83 | elif self.check_event(MappingStartEvent): 84 | node = self.compose_mapping_node(anchor) 85 | self.ascend_resolver() 86 | return node 87 | 88 | def compose_scalar_node(self, anchor): 89 | event = self.get_event() 90 | tag = event.tag 91 | if tag is None or tag == '!': 92 | tag = self.resolve(ScalarNode, event.value, event.implicit) 93 | node = ScalarNode(tag, event.value, 94 | event.start_mark, event.end_mark, style=event.style) 95 | if anchor is not None: 96 | self.anchors[anchor] = node 97 | return node 98 | 99 | def compose_sequence_node(self, anchor): 100 | start_event = self.get_event() 101 | tag = start_event.tag 102 | if tag is None or tag == '!': 103 | tag = self.resolve(SequenceNode, None, start_event.implicit) 104 | node = SequenceNode(tag, [], 105 | start_event.start_mark, None, 106 | flow_style=start_event.flow_style) 107 | if anchor is not None: 108 | self.anchors[anchor] = node 109 | index = 0 110 | while not self.check_event(SequenceEndEvent): 111 | node.value.append(self.compose_node(node, index)) 112 | index += 1 113 | end_event = self.get_event() 114 | node.end_mark = end_event.end_mark 115 | return node 116 | 117 | def compose_mapping_node(self, anchor): 118 | start_event = self.get_event() 119 | tag = start_event.tag 120 | if tag is None or tag == '!': 121 | tag = self.resolve(MappingNode, None, start_event.implicit) 122 | node = MappingNode(tag, [], 123 | start_event.start_mark, None, 124 | flow_style=start_event.flow_style) 125 | if anchor is not None: 126 | self.anchors[anchor] = node 127 | while not self.check_event(MappingEndEvent): 128 | #key_event = self.peek_event() 129 | item_key = self.compose_node(node, None) 130 | #if item_key in node.value: 131 | # raise ComposerError("while composing a mapping", start_event.start_mark, 132 | # "found duplicate key", key_event.start_mark) 133 | item_value = self.compose_node(node, item_key) 134 | #node.value[item_key] = item_value 135 | node.value.append((item_key, item_value)) 136 | end_event = self.get_event() 137 | node.end_mark = end_event.end_mark 138 | return node 139 | 140 | -------------------------------------------------------------------------------- /yaml/cyaml.py: -------------------------------------------------------------------------------- 1 | 2 | __all__ = [ 3 | 'CBaseLoader', 'CSafeLoader', 'CFullLoader', 'CUnsafeLoader', 'CLoader', 4 | 'CBaseDumper', 'CSafeDumper', 'CDumper' 5 | ] 6 | 7 | from _yaml import CParser, CEmitter 8 | 9 | from .constructor import * 10 | 11 | from .serializer import * 12 | from .representer import * 13 | 14 | from .resolver import * 15 | 16 | class CBaseLoader(CParser, BaseConstructor, BaseResolver): 17 | 18 | def __init__(self, stream): 19 | CParser.__init__(self, stream) 20 | BaseConstructor.__init__(self) 21 | BaseResolver.__init__(self) 22 | 23 | class CSafeLoader(CParser, SafeConstructor, Resolver): 24 | 25 | def __init__(self, stream): 26 | CParser.__init__(self, stream) 27 | SafeConstructor.__init__(self) 28 | Resolver.__init__(self) 29 | 30 | class CFullLoader(CParser, FullConstructor, Resolver): 31 | 32 | def __init__(self, stream): 33 | CParser.__init__(self, stream) 34 | FullConstructor.__init__(self) 35 | Resolver.__init__(self) 36 | 37 | class CUnsafeLoader(CParser, UnsafeConstructor, Resolver): 38 | 39 | def __init__(self, stream): 40 | CParser.__init__(self, stream) 41 | UnsafeConstructor.__init__(self) 42 | Resolver.__init__(self) 43 | 44 | class CLoader(CParser, Constructor, Resolver): 45 | 46 | def __init__(self, stream): 47 | CParser.__init__(self, stream) 48 | Constructor.__init__(self) 49 | Resolver.__init__(self) 50 | 51 | class CBaseDumper(CEmitter, BaseRepresenter, BaseResolver): 52 | 53 | def __init__(self, stream, 54 | default_style=None, default_flow_style=False, 55 | canonical=None, indent=None, width=None, 56 | allow_unicode=None, line_break=None, 57 | encoding=None, explicit_start=None, explicit_end=None, 58 | version=None, tags=None, sort_keys=True): 59 | CEmitter.__init__(self, stream, canonical=canonical, 60 | indent=indent, width=width, encoding=encoding, 61 | allow_unicode=allow_unicode, line_break=line_break, 62 | explicit_start=explicit_start, explicit_end=explicit_end, 63 | version=version, tags=tags) 64 | Representer.__init__(self, default_style=default_style, 65 | default_flow_style=default_flow_style, sort_keys=sort_keys) 66 | Resolver.__init__(self) 67 | 68 | class CSafeDumper(CEmitter, SafeRepresenter, Resolver): 69 | 70 | def __init__(self, stream, 71 | default_style=None, default_flow_style=False, 72 | canonical=None, indent=None, width=None, 73 | allow_unicode=None, line_break=None, 74 | encoding=None, explicit_start=None, explicit_end=None, 75 | version=None, tags=None, sort_keys=True): 76 | CEmitter.__init__(self, stream, canonical=canonical, 77 | indent=indent, width=width, encoding=encoding, 78 | allow_unicode=allow_unicode, line_break=line_break, 79 | explicit_start=explicit_start, explicit_end=explicit_end, 80 | version=version, tags=tags) 81 | SafeRepresenter.__init__(self, default_style=default_style, 82 | default_flow_style=default_flow_style, sort_keys=sort_keys) 83 | Resolver.__init__(self) 84 | 85 | class CDumper(CEmitter, Serializer, Representer, Resolver): 86 | 87 | def __init__(self, stream, 88 | default_style=None, default_flow_style=False, 89 | canonical=None, indent=None, width=None, 90 | allow_unicode=None, line_break=None, 91 | encoding=None, explicit_start=None, explicit_end=None, 92 | version=None, tags=None, sort_keys=True): 93 | CEmitter.__init__(self, stream, canonical=canonical, 94 | indent=indent, width=width, encoding=encoding, 95 | allow_unicode=allow_unicode, line_break=line_break, 96 | explicit_start=explicit_start, explicit_end=explicit_end, 97 | version=version, tags=tags) 98 | Representer.__init__(self, default_style=default_style, 99 | default_flow_style=default_flow_style, sort_keys=sort_keys) 100 | Resolver.__init__(self) 101 | 102 | -------------------------------------------------------------------------------- /yaml/dumper.py: -------------------------------------------------------------------------------- 1 | 2 | __all__ = ['BaseDumper', 'SafeDumper', 'Dumper'] 3 | 4 | from .emitter import * 5 | from .serializer import * 6 | from .representer import * 7 | from .resolver import * 8 | 9 | class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver): 10 | 11 | def __init__(self, stream, 12 | default_style=None, default_flow_style=False, 13 | canonical=None, indent=None, width=None, 14 | allow_unicode=None, line_break=None, 15 | encoding=None, explicit_start=None, explicit_end=None, 16 | version=None, tags=None, sort_keys=True): 17 | Emitter.__init__(self, stream, canonical=canonical, 18 | indent=indent, width=width, 19 | allow_unicode=allow_unicode, line_break=line_break) 20 | Serializer.__init__(self, encoding=encoding, 21 | explicit_start=explicit_start, explicit_end=explicit_end, 22 | version=version, tags=tags) 23 | Representer.__init__(self, default_style=default_style, 24 | default_flow_style=default_flow_style, sort_keys=sort_keys) 25 | Resolver.__init__(self) 26 | 27 | class SafeDumper(Emitter, Serializer, SafeRepresenter, Resolver): 28 | 29 | def __init__(self, stream, 30 | default_style=None, default_flow_style=False, 31 | canonical=None, indent=None, width=None, 32 | allow_unicode=None, line_break=None, 33 | encoding=None, explicit_start=None, explicit_end=None, 34 | version=None, tags=None, sort_keys=True): 35 | Emitter.__init__(self, stream, canonical=canonical, 36 | indent=indent, width=width, 37 | allow_unicode=allow_unicode, line_break=line_break) 38 | Serializer.__init__(self, encoding=encoding, 39 | explicit_start=explicit_start, explicit_end=explicit_end, 40 | version=version, tags=tags) 41 | SafeRepresenter.__init__(self, default_style=default_style, 42 | default_flow_style=default_flow_style, sort_keys=sort_keys) 43 | Resolver.__init__(self) 44 | 45 | class Dumper(Emitter, Serializer, Representer, Resolver): 46 | 47 | def __init__(self, stream, 48 | default_style=None, default_flow_style=False, 49 | canonical=None, indent=None, width=None, 50 | allow_unicode=None, line_break=None, 51 | encoding=None, explicit_start=None, explicit_end=None, 52 | version=None, tags=None, sort_keys=True): 53 | Emitter.__init__(self, stream, canonical=canonical, 54 | indent=indent, width=width, 55 | allow_unicode=allow_unicode, line_break=line_break) 56 | Serializer.__init__(self, encoding=encoding, 57 | explicit_start=explicit_start, explicit_end=explicit_end, 58 | version=version, tags=tags) 59 | Representer.__init__(self, default_style=default_style, 60 | default_flow_style=default_flow_style, sort_keys=sort_keys) 61 | Resolver.__init__(self) 62 | 63 | -------------------------------------------------------------------------------- /yaml/error.py: -------------------------------------------------------------------------------- 1 | 2 | __all__ = ['Mark', 'YAMLError', 'MarkedYAMLError'] 3 | 4 | class Mark: 5 | 6 | def __init__(self, name, index, line, column, buffer, pointer): 7 | self.name = name 8 | self.index = index 9 | self.line = line 10 | self.column = column 11 | self.buffer = buffer 12 | self.pointer = pointer 13 | 14 | def get_snippet(self, indent=4, max_length=75): 15 | if self.buffer is None: 16 | return None 17 | head = '' 18 | start = self.pointer 19 | while start > 0 and self.buffer[start-1] not in '\0\r\n\x85\u2028\u2029': 20 | start -= 1 21 | if self.pointer-start > max_length/2-1: 22 | head = ' ... ' 23 | start += 5 24 | break 25 | tail = '' 26 | end = self.pointer 27 | while end < len(self.buffer) and self.buffer[end] not in '\0\r\n\x85\u2028\u2029': 28 | end += 1 29 | if end-self.pointer > max_length/2-1: 30 | tail = ' ... ' 31 | end -= 5 32 | break 33 | snippet = self.buffer[start:end] 34 | return ' '*indent + head + snippet + tail + '\n' \ 35 | + ' '*(indent+self.pointer-start+len(head)) + '^' 36 | 37 | def __str__(self): 38 | snippet = self.get_snippet() 39 | where = " in \"%s\", line %d, column %d" \ 40 | % (self.name, self.line+1, self.column+1) 41 | if snippet is not None: 42 | where += ":\n"+snippet 43 | return where 44 | 45 | class YAMLError(Exception): 46 | pass 47 | 48 | class MarkedYAMLError(YAMLError): 49 | 50 | def __init__(self, context=None, context_mark=None, 51 | problem=None, problem_mark=None, note=None): 52 | self.context = context 53 | self.context_mark = context_mark 54 | self.problem = problem 55 | self.problem_mark = problem_mark 56 | self.note = note 57 | 58 | def __str__(self): 59 | lines = [] 60 | if self.context is not None: 61 | lines.append(self.context) 62 | if self.context_mark is not None \ 63 | and (self.problem is None or self.problem_mark is None 64 | or self.context_mark.name != self.problem_mark.name 65 | or self.context_mark.line != self.problem_mark.line 66 | or self.context_mark.column != self.problem_mark.column): 67 | lines.append(str(self.context_mark)) 68 | if self.problem is not None: 69 | lines.append(self.problem) 70 | if self.problem_mark is not None: 71 | lines.append(str(self.problem_mark)) 72 | if self.note is not None: 73 | lines.append(self.note) 74 | return '\n'.join(lines) 75 | 76 | -------------------------------------------------------------------------------- /yaml/events.py: -------------------------------------------------------------------------------- 1 | 2 | # Abstract classes. 3 | 4 | class Event(object): 5 | def __init__(self, start_mark=None, end_mark=None): 6 | self.start_mark = start_mark 7 | self.end_mark = end_mark 8 | def __repr__(self): 9 | attributes = [key for key in ['anchor', 'tag', 'implicit', 'value'] 10 | if hasattr(self, key)] 11 | arguments = ', '.join(['%s=%r' % (key, getattr(self, key)) 12 | for key in attributes]) 13 | return '%s(%s)' % (self.__class__.__name__, arguments) 14 | 15 | class NodeEvent(Event): 16 | def __init__(self, anchor, start_mark=None, end_mark=None): 17 | self.anchor = anchor 18 | self.start_mark = start_mark 19 | self.end_mark = end_mark 20 | 21 | class CollectionStartEvent(NodeEvent): 22 | def __init__(self, anchor, tag, implicit, start_mark=None, end_mark=None, 23 | flow_style=None): 24 | self.anchor = anchor 25 | self.tag = tag 26 | self.implicit = implicit 27 | self.start_mark = start_mark 28 | self.end_mark = end_mark 29 | self.flow_style = flow_style 30 | 31 | class CollectionEndEvent(Event): 32 | pass 33 | 34 | # Implementations. 35 | 36 | class StreamStartEvent(Event): 37 | def __init__(self, start_mark=None, end_mark=None, encoding=None): 38 | self.start_mark = start_mark 39 | self.end_mark = end_mark 40 | self.encoding = encoding 41 | 42 | class StreamEndEvent(Event): 43 | pass 44 | 45 | class DocumentStartEvent(Event): 46 | def __init__(self, start_mark=None, end_mark=None, 47 | explicit=None, version=None, tags=None): 48 | self.start_mark = start_mark 49 | self.end_mark = end_mark 50 | self.explicit = explicit 51 | self.version = version 52 | self.tags = tags 53 | 54 | class DocumentEndEvent(Event): 55 | def __init__(self, start_mark=None, end_mark=None, 56 | explicit=None): 57 | self.start_mark = start_mark 58 | self.end_mark = end_mark 59 | self.explicit = explicit 60 | 61 | class AliasEvent(NodeEvent): 62 | pass 63 | 64 | class ScalarEvent(NodeEvent): 65 | def __init__(self, anchor, tag, implicit, value, 66 | start_mark=None, end_mark=None, style=None): 67 | self.anchor = anchor 68 | self.tag = tag 69 | self.implicit = implicit 70 | self.value = value 71 | self.start_mark = start_mark 72 | self.end_mark = end_mark 73 | self.style = style 74 | 75 | class SequenceStartEvent(CollectionStartEvent): 76 | pass 77 | 78 | class SequenceEndEvent(CollectionEndEvent): 79 | pass 80 | 81 | class MappingStartEvent(CollectionStartEvent): 82 | pass 83 | 84 | class MappingEndEvent(CollectionEndEvent): 85 | pass 86 | 87 | -------------------------------------------------------------------------------- /yaml/loader.py: -------------------------------------------------------------------------------- 1 | 2 | __all__ = ['BaseLoader', 'FullLoader', 'SafeLoader', 'Loader', 'UnsafeLoader'] 3 | 4 | from .reader import * 5 | from .scanner import * 6 | from .parser import * 7 | from .composer import * 8 | from .constructor import * 9 | from .resolver import * 10 | 11 | class BaseLoader(Reader, Scanner, Parser, Composer, BaseConstructor, BaseResolver): 12 | 13 | def __init__(self, stream): 14 | Reader.__init__(self, stream) 15 | Scanner.__init__(self) 16 | Parser.__init__(self) 17 | Composer.__init__(self) 18 | BaseConstructor.__init__(self) 19 | BaseResolver.__init__(self) 20 | 21 | class FullLoader(Reader, Scanner, Parser, Composer, FullConstructor, Resolver): 22 | 23 | def __init__(self, stream): 24 | Reader.__init__(self, stream) 25 | Scanner.__init__(self) 26 | Parser.__init__(self) 27 | Composer.__init__(self) 28 | FullConstructor.__init__(self) 29 | Resolver.__init__(self) 30 | 31 | class SafeLoader(Reader, Scanner, Parser, Composer, SafeConstructor, Resolver): 32 | 33 | def __init__(self, stream): 34 | Reader.__init__(self, stream) 35 | Scanner.__init__(self) 36 | Parser.__init__(self) 37 | Composer.__init__(self) 38 | SafeConstructor.__init__(self) 39 | Resolver.__init__(self) 40 | 41 | class Loader(Reader, Scanner, Parser, Composer, Constructor, Resolver): 42 | 43 | def __init__(self, stream): 44 | Reader.__init__(self, stream) 45 | Scanner.__init__(self) 46 | Parser.__init__(self) 47 | Composer.__init__(self) 48 | Constructor.__init__(self) 49 | Resolver.__init__(self) 50 | 51 | # UnsafeLoader is the same as Loader (which is and was always unsafe on 52 | # untrusted input). Use of either Loader or UnsafeLoader should be rare, since 53 | # FullLoad should be able to load almost all YAML safely. Loader is left intact 54 | # to ensure backwards compatability. 55 | class UnsafeLoader(Reader, Scanner, Parser, Composer, Constructor, Resolver): 56 | 57 | def __init__(self, stream): 58 | Reader.__init__(self, stream) 59 | Scanner.__init__(self) 60 | Parser.__init__(self) 61 | Composer.__init__(self) 62 | Constructor.__init__(self) 63 | Resolver.__init__(self) 64 | -------------------------------------------------------------------------------- /yaml/nodes.py: -------------------------------------------------------------------------------- 1 | 2 | class Node(object): 3 | def __init__(self, tag, value, start_mark, end_mark): 4 | self.tag = tag 5 | self.value = value 6 | self.start_mark = start_mark 7 | self.end_mark = end_mark 8 | def __repr__(self): 9 | value = self.value 10 | #if isinstance(value, list): 11 | # if len(value) == 0: 12 | # value = '' 13 | # elif len(value) == 1: 14 | # value = '<1 item>' 15 | # else: 16 | # value = '<%d items>' % len(value) 17 | #else: 18 | # if len(value) > 75: 19 | # value = repr(value[:70]+u' ... ') 20 | # else: 21 | # value = repr(value) 22 | value = repr(value) 23 | return '%s(tag=%r, value=%s)' % (self.__class__.__name__, self.tag, value) 24 | 25 | class ScalarNode(Node): 26 | id = 'scalar' 27 | def __init__(self, tag, value, 28 | start_mark=None, end_mark=None, style=None): 29 | self.tag = tag 30 | self.value = value 31 | self.start_mark = start_mark 32 | self.end_mark = end_mark 33 | self.style = style 34 | 35 | class CollectionNode(Node): 36 | def __init__(self, tag, value, 37 | start_mark=None, end_mark=None, flow_style=None): 38 | self.tag = tag 39 | self.value = value 40 | self.start_mark = start_mark 41 | self.end_mark = end_mark 42 | self.flow_style = flow_style 43 | 44 | class SequenceNode(CollectionNode): 45 | id = 'sequence' 46 | 47 | class MappingNode(CollectionNode): 48 | id = 'mapping' 49 | 50 | -------------------------------------------------------------------------------- /yaml/serializer.py: -------------------------------------------------------------------------------- 1 | 2 | __all__ = ['Serializer', 'SerializerError'] 3 | 4 | from .error import YAMLError 5 | from .events import * 6 | from .nodes import * 7 | 8 | class SerializerError(YAMLError): 9 | pass 10 | 11 | class Serializer: 12 | 13 | ANCHOR_TEMPLATE = 'id%03d' 14 | 15 | def __init__(self, encoding=None, 16 | explicit_start=None, explicit_end=None, version=None, tags=None): 17 | self.use_encoding = encoding 18 | self.use_explicit_start = explicit_start 19 | self.use_explicit_end = explicit_end 20 | self.use_version = version 21 | self.use_tags = tags 22 | self.serialized_nodes = {} 23 | self.anchors = {} 24 | self.last_anchor_id = 0 25 | self.closed = None 26 | 27 | def open(self): 28 | if self.closed is None: 29 | self.emit(StreamStartEvent(encoding=self.use_encoding)) 30 | self.closed = False 31 | elif self.closed: 32 | raise SerializerError("serializer is closed") 33 | else: 34 | raise SerializerError("serializer is already opened") 35 | 36 | def close(self): 37 | if self.closed is None: 38 | raise SerializerError("serializer is not opened") 39 | elif not self.closed: 40 | self.emit(StreamEndEvent()) 41 | self.closed = True 42 | 43 | #def __del__(self): 44 | # self.close() 45 | 46 | def serialize(self, node): 47 | if self.closed is None: 48 | raise SerializerError("serializer is not opened") 49 | elif self.closed: 50 | raise SerializerError("serializer is closed") 51 | self.emit(DocumentStartEvent(explicit=self.use_explicit_start, 52 | version=self.use_version, tags=self.use_tags)) 53 | self.anchor_node(node) 54 | self.serialize_node(node, None, None) 55 | self.emit(DocumentEndEvent(explicit=self.use_explicit_end)) 56 | self.serialized_nodes = {} 57 | self.anchors = {} 58 | self.last_anchor_id = 0 59 | 60 | def anchor_node(self, node): 61 | if node in self.anchors: 62 | if self.anchors[node] is None: 63 | self.anchors[node] = self.generate_anchor(node) 64 | else: 65 | self.anchors[node] = None 66 | if isinstance(node, SequenceNode): 67 | for item in node.value: 68 | self.anchor_node(item) 69 | elif isinstance(node, MappingNode): 70 | for key, value in node.value: 71 | self.anchor_node(key) 72 | self.anchor_node(value) 73 | 74 | def generate_anchor(self, node): 75 | self.last_anchor_id += 1 76 | return self.ANCHOR_TEMPLATE % self.last_anchor_id 77 | 78 | def serialize_node(self, node, parent, index): 79 | alias = self.anchors[node] 80 | if node in self.serialized_nodes: 81 | self.emit(AliasEvent(alias)) 82 | else: 83 | self.serialized_nodes[node] = True 84 | self.descend_resolver(parent, index) 85 | if isinstance(node, ScalarNode): 86 | detected_tag = self.resolve(ScalarNode, node.value, (True, False)) 87 | default_tag = self.resolve(ScalarNode, node.value, (False, True)) 88 | implicit = (node.tag == detected_tag), (node.tag == default_tag) 89 | self.emit(ScalarEvent(alias, node.tag, implicit, node.value, 90 | style=node.style)) 91 | elif isinstance(node, SequenceNode): 92 | implicit = (node.tag 93 | == self.resolve(SequenceNode, node.value, True)) 94 | self.emit(SequenceStartEvent(alias, node.tag, implicit, 95 | flow_style=node.flow_style)) 96 | index = 0 97 | for item in node.value: 98 | self.serialize_node(item, node, index) 99 | index += 1 100 | self.emit(SequenceEndEvent()) 101 | elif isinstance(node, MappingNode): 102 | implicit = (node.tag 103 | == self.resolve(MappingNode, node.value, True)) 104 | self.emit(MappingStartEvent(alias, node.tag, implicit, 105 | flow_style=node.flow_style)) 106 | for key, value in node.value: 107 | self.serialize_node(key, node, None) 108 | self.serialize_node(value, node, key) 109 | self.emit(MappingEndEvent()) 110 | self.ascend_resolver() 111 | 112 | -------------------------------------------------------------------------------- /yaml/tokens.py: -------------------------------------------------------------------------------- 1 | 2 | class Token(object): 3 | def __init__(self, start_mark, end_mark): 4 | self.start_mark = start_mark 5 | self.end_mark = end_mark 6 | def __repr__(self): 7 | attributes = [key for key in self.__dict__ 8 | if not key.endswith('_mark')] 9 | attributes.sort() 10 | arguments = ', '.join(['%s=%r' % (key, getattr(self, key)) 11 | for key in attributes]) 12 | return '%s(%s)' % (self.__class__.__name__, arguments) 13 | 14 | #class BOMToken(Token): 15 | # id = '' 16 | 17 | class DirectiveToken(Token): 18 | id = '' 19 | def __init__(self, name, value, start_mark, end_mark): 20 | self.name = name 21 | self.value = value 22 | self.start_mark = start_mark 23 | self.end_mark = end_mark 24 | 25 | class DocumentStartToken(Token): 26 | id = '' 27 | 28 | class DocumentEndToken(Token): 29 | id = '' 30 | 31 | class StreamStartToken(Token): 32 | id = '' 33 | def __init__(self, start_mark=None, end_mark=None, 34 | encoding=None): 35 | self.start_mark = start_mark 36 | self.end_mark = end_mark 37 | self.encoding = encoding 38 | 39 | class StreamEndToken(Token): 40 | id = '' 41 | 42 | class BlockSequenceStartToken(Token): 43 | id = '' 44 | 45 | class BlockMappingStartToken(Token): 46 | id = '' 47 | 48 | class BlockEndToken(Token): 49 | id = '' 50 | 51 | class FlowSequenceStartToken(Token): 52 | id = '[' 53 | 54 | class FlowMappingStartToken(Token): 55 | id = '{' 56 | 57 | class FlowSequenceEndToken(Token): 58 | id = ']' 59 | 60 | class FlowMappingEndToken(Token): 61 | id = '}' 62 | 63 | class KeyToken(Token): 64 | id = '?' 65 | 66 | class ValueToken(Token): 67 | id = ':' 68 | 69 | class BlockEntryToken(Token): 70 | id = '-' 71 | 72 | class FlowEntryToken(Token): 73 | id = ',' 74 | 75 | class AliasToken(Token): 76 | id = '' 77 | def __init__(self, value, start_mark, end_mark): 78 | self.value = value 79 | self.start_mark = start_mark 80 | self.end_mark = end_mark 81 | 82 | class AnchorToken(Token): 83 | id = '' 84 | def __init__(self, value, start_mark, end_mark): 85 | self.value = value 86 | self.start_mark = start_mark 87 | self.end_mark = end_mark 88 | 89 | class TagToken(Token): 90 | id = '' 91 | def __init__(self, value, start_mark, end_mark): 92 | self.value = value 93 | self.start_mark = start_mark 94 | self.end_mark = end_mark 95 | 96 | class ScalarToken(Token): 97 | id = '' 98 | def __init__(self, value, plain, start_mark, end_mark, style=None): 99 | self.value = value 100 | self.plain = plain 101 | self.start_mark = start_mark 102 | self.end_mark = end_mark 103 | self.style = style 104 | 105 | --------------------------------------------------------------------------------