├── .gitignore ├── docs ├── images │ ├── capture-20160205-1709.png │ ├── capture-20160303-1050.png │ ├── capture-20160303-1055.png │ ├── capture-20160404-0957.png │ ├── capture-20160404-0958.png │ ├── capture-20160405-1039.png │ ├── capture-20160405-1046.png │ ├── capture-20160405-1048.png │ ├── capture-20160405-1050.png │ ├── capture-20160405-1051.png │ ├── capture-20160423-0647.png │ ├── capture-20160423-0648.png │ ├── capture-20160707-0933.png │ └── capture-20160707-0934.png ├── README.md ├── howto-build-gdp.md ├── building-wtfapp-udooneo.md ├── configuring-access-control-via-github.md ├── testing-docker.md ├── easyjenkins-java10-demo.md ├── configure-kubernetes-slaves.md ├── preparation.md ├── building-easyjenkins.md ├── building-gdp-ivi9.md ├── building-gdp.md ├── building-android-udooneo.md ├── building-capic-native.md └── building-meta-ivi-qemux86-64.md ├── myscripts ├── hello.groovy ├── sysinfo.groovy ├── list_plugins.groovy ├── README.md └── add_slave_nodes.groovy ├── casc_configs ├── default.yaml ├── gmpowerhorse.yaml └── nemo.yaml ├── Jenkinsfile ├── .gitattributes ├── mydsl ├── seed_add_jenkins_slave.groovy ├── seed_build_gdp.groovy └── seed_configure_git.groovy ├── LICENSE ├── CHANGELOG.md ├── myjenkins ├── seed.groovy └── Dockerfile ├── docker-compose.yml ├── README.md └── runme.sh /.gitignore: -------------------------------------------------------------------------------- 1 | secrets 2 | -------------------------------------------------------------------------------- /docs/images/capture-20160205-1709.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gmacario/easy-jenkins/HEAD/docs/images/capture-20160205-1709.png -------------------------------------------------------------------------------- /docs/images/capture-20160303-1050.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gmacario/easy-jenkins/HEAD/docs/images/capture-20160303-1050.png -------------------------------------------------------------------------------- /docs/images/capture-20160303-1055.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gmacario/easy-jenkins/HEAD/docs/images/capture-20160303-1055.png -------------------------------------------------------------------------------- /docs/images/capture-20160404-0957.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gmacario/easy-jenkins/HEAD/docs/images/capture-20160404-0957.png -------------------------------------------------------------------------------- /docs/images/capture-20160404-0958.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gmacario/easy-jenkins/HEAD/docs/images/capture-20160404-0958.png -------------------------------------------------------------------------------- /docs/images/capture-20160405-1039.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gmacario/easy-jenkins/HEAD/docs/images/capture-20160405-1039.png -------------------------------------------------------------------------------- /docs/images/capture-20160405-1046.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gmacario/easy-jenkins/HEAD/docs/images/capture-20160405-1046.png -------------------------------------------------------------------------------- /docs/images/capture-20160405-1048.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gmacario/easy-jenkins/HEAD/docs/images/capture-20160405-1048.png -------------------------------------------------------------------------------- /docs/images/capture-20160405-1050.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gmacario/easy-jenkins/HEAD/docs/images/capture-20160405-1050.png -------------------------------------------------------------------------------- /docs/images/capture-20160405-1051.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gmacario/easy-jenkins/HEAD/docs/images/capture-20160405-1051.png -------------------------------------------------------------------------------- /docs/images/capture-20160423-0647.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gmacario/easy-jenkins/HEAD/docs/images/capture-20160423-0647.png -------------------------------------------------------------------------------- /docs/images/capture-20160423-0648.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gmacario/easy-jenkins/HEAD/docs/images/capture-20160423-0648.png -------------------------------------------------------------------------------- /docs/images/capture-20160707-0933.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gmacario/easy-jenkins/HEAD/docs/images/capture-20160707-0933.png -------------------------------------------------------------------------------- /docs/images/capture-20160707-0934.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gmacario/easy-jenkins/HEAD/docs/images/capture-20160707-0934.png -------------------------------------------------------------------------------- /myscripts/hello.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | hello.groovy 3 | 4 | See https://learnxinyminutes.com/docs/groovy/ 5 | */ 6 | 7 | println "Hello, world!" 8 | 9 | /* EOF */ 10 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | This directory contains a collections of step-by-step instructions for building embedded software distributions and components using easy-jenkins. 2 | 3 | [Pull Requests](https://github.com/gmacario/easy-jenkins/pulls) are welcome! 4 | -------------------------------------------------------------------------------- /casc_configs/default.yaml: -------------------------------------------------------------------------------- 1 | jenkins: 2 | systemMessage: "Jenkins configured automatically by Jenkins Configuration as Code Plugin\n\n" 3 | numExecutors: 3 4 | labelString: "docker linux" 5 | scmCheckoutRetryCount: 2 6 | mode: NORMAL 7 | 8 | # EOF 9 | -------------------------------------------------------------------------------- /Jenkinsfile: -------------------------------------------------------------------------------- 1 | pipeline { 2 | agent { label 'docker' } 3 | stages { 4 | stage('Build') { 5 | steps { 6 | sh '''#!/bin/bash 7 | 8 | docker --version 9 | docker-compose --version 10 | 11 | docker-compose build --pull 12 | 13 | # EOF''' 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/dealing-with-line-endings/ 2 | 3 | # Set the default behavior, in case people don't have core.autocrlf set. 4 | * text=auto 5 | 6 | # Explicitly declare text files you want to always be normalized and converted 7 | # to native line endings on checkout. 8 | *.c text 9 | *.h text 10 | 11 | # Declare files that will always have LF line endings on checkout. 12 | *.sh text eol=lf 13 | 14 | # Declare files that will always have CRLF line endings on checkout. 15 | *.sln text eol=crlf 16 | 17 | # Denote all files that are truly binary and should not be modified. 18 | *.pdf binary 19 | *.png binary 20 | *.jpg binary 21 | 22 | # EOF -------------------------------------------------------------------------------- /myscripts/sysinfo.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | sysinfo.groovy 3 | 4 | Assumes to run on a POSIX-like environment (i.e. Linux + bash) 5 | 6 | See https://learnxinyminutes.com/docs/groovy/ 7 | */ 8 | 9 | println "INFO: sysinfo.groovy" 10 | println "" 11 | 12 | println "INFO: Executing uname -a" 13 | println "uname -a".execute().text 14 | 15 | println "INFO: Executing id" 16 | println "id".execute().text 17 | 18 | println "INFO: Inspecting PATH" 19 | println System.getenv("PATH") 20 | println "" 21 | 22 | println "INFO: Executing df -h" 23 | println "df -h".execute().text 24 | 25 | //println "INFO: Executing sudo id" 26 | //println "sudo id".execute().text // java.io.IOException: Cannot run program "sudo": error=2, No such file or directory 27 | 28 | println "INFO: Executing printenv" 29 | println "printenv".execute().text 30 | 31 | /* EOF */ 32 | -------------------------------------------------------------------------------- /casc_configs/gmpowerhorse.yaml: -------------------------------------------------------------------------------- 1 | # File: casc_plugins/gmpowerhorse.yaml 2 | 3 | jenkins: 4 | agentProtocols: 5 | - "JNLP4-connect" 6 | - "Ping" 7 | authorizationStrategy: 8 | loggedInUsersCanDoAnything: 9 | allowAnonymousRead: false 10 | crumbIssuer: 11 | standard: 12 | excludeClientIPFromCrumb: false 13 | disableRememberMe: false 14 | labelString: "docker linux" 15 | mode: NORMAL 16 | numExecutors: 4 17 | primaryView: 18 | all: 19 | name: "all" 20 | quietPeriod: 5 21 | scmCheckoutRetryCount: 2 22 | securityRealm: 23 | local: 24 | allowsSignup: false 25 | enableCaptcha: false 26 | users: 27 | - id: "admin" 28 | password: ${adminpw:-passw0rd} 29 | slaveAgentPort: 50000 30 | systemMessage: "Jenkins configured automatically for gmpowerhorse by Jenkins Configuration as Code Plugin\n\n" 31 | views: 32 | - all: 33 | name: "all" 34 | 35 | # EOF 36 | -------------------------------------------------------------------------------- /mydsl/seed_add_jenkins_slave.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | Project: https://github.com/gmacario/easy-jenkins 3 | File: mydsl/seed_add_jenkins_slave.groovy 4 | 5 | References: 6 | - https://jenkinsci.github.io/job-dsl-plugin/# 7 | */ 8 | 9 | job('add_jenkins_slave') { 10 | scm { 11 | git('https://github.com/gmacario/easy-jenkins', '*/master') 12 | 13 | parameters { 14 | textParam('AgentList', 'build-yocto-slave', 'Names of the agent(s) to create (each line makes one agent)') 15 | stringParam('AgentDescription', 'Auto-created Jenkins agent', 'Description that will be set for _every_ created agent') 16 | stringParam('AgentExecutors', '2', 'Number of executors for the agent') 17 | stringParam('AgentHome', '/home/jenkins', 'Remote filesystem root for the agent') 18 | textParam('AgentLabels', 'yocto', 'Labels associated to the agent (each line makes one label)') 19 | } 20 | 21 | steps { 22 | systemGroovyScriptFile ('myscripts/add_slave_nodes.groovy') { 23 | // TODO 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Gianpaolo Macario 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 | -------------------------------------------------------------------------------- /mydsl/seed_build_gdp.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | Project: https://github.com/gmacario/easy-jenkins 3 | File: mydsl/seed_build_gdp.groovy 4 | */ 5 | 6 | /* 7 | Usage: 8 | 9 | Browse `${JENKINS_URL}`, then click **New Item** 10 | 11 | * Item Name: `seed_build_gdp` 12 | * Type: Freestyle project 13 | 14 | then click **OK**. 15 | 16 | Browse `${JENKINS_URL}/job/seed_build_gdp/configure` and change 17 | 18 | * Build 19 | - Add build step > Process Job DSLs 20 | - Use the provided DSL script: Yes 21 | - DSL Script: 22 | 23 | then click **Save**. 24 | 25 | Browse `${JENKINS_URL}/job/seed_build_gdp/`, then click **Build Now** 26 | 27 | Result: Project `build_gdp` will be listed in `${JENKINS_URL}` 28 | */ 29 | 30 | def jobName = "build_gdp" 31 | def gitUrl = "https://github.com/gmacario/genivi-demo-platform" 32 | def gitBranch = "qemux86-64" 33 | 34 | job(jobName) { 35 | label('yocto') 36 | scm { 37 | git(gitUrl, gitBranch) { 38 | // TODO 39 | } 40 | } 41 | steps { 42 | shell "id" 43 | shell "printenv" 44 | shell "ps axf" 45 | shell "bash -xec \"source init.sh && bitbake genivi-demo-platform\"" 46 | } 47 | } 48 | 49 | // EOF 50 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | Changelog 2 | ========= 3 | 4 | ## v1.y.z (NOT RELEASED YET) 5 | 6 | - myjenkins: Update to latest available plugins (#117) 7 | - myjenkins: Update to latest available plugins (#115) 8 | - docs: Add building-gdp.md (#114) 9 | 10 | ## v1.0.0 (2016-05-10) 11 | 12 | - Update CHANGELOG.md (#110) 13 | - myjenkins: Update to latest available plugins 14 | 15 | ## v1.0.0-rc1 (2016-04-28) 16 | 17 | - myjenkins: Update plugins (#109) 18 | - README.md: Add link to presentation at TorinoTech Night 19 | - docs: Update building-capic-native.md to CAPIC 0.2.1 (#108) 20 | - myjenkins: Update plugins (#105) 21 | - docs: Update to GDP-ivi9 release (#103) 22 | - docs: Update for Jenkins 2.0-beta2 (#102) 23 | - myjenkins: Rebase on Jenkins 2.0 image 24 | - docs/building-wtfapp-udooneo.md: Spelling fix 25 | - docs: Add building-gdp-ivi9.md (#100) 26 | - docker-compose.yml: Do not create unused volumes (#99) 27 | - docs: Add building-meta-ivi-qemux86-64.md (#97) 28 | - myjenkins: Update to latest available plugins 29 | - docs/build-gdp-ivi9-beta: Minor code reformatting 30 | - Update plugins.txt 31 | - Create CHANGELOG.md 32 | 33 | ## v0.1.0 (2016-03-25) 34 | 35 | - Initial public release. 36 | 37 | 38 | -------------------------------------------------------------------------------- /casc_configs/nemo.yaml: -------------------------------------------------------------------------------- 1 | jenkins: 2 | agentProtocols: 3 | - "JNLP4-connect" 4 | - "Ping" 5 | authorizationStrategy: 6 | loggedInUsersCanDoAnything: 7 | allowAnonymousRead: false 8 | # globalMatrix: 9 | # grantedPermissions: 10 | # - name: "anonymous" 11 | # permissions: 12 | # - "Overall/Read" 13 | # - "Job/Read" 14 | # - "View/Read" 15 | # - name: "authenticated" 16 | # permissions: 17 | # - "Overall/Administer" 18 | crumbIssuer: 19 | standard: 20 | excludeClientIPFromCrumb: false 21 | disableRememberMe: false 22 | labelString: "docker linux" 23 | mode: NORMAL 24 | numExecutors: 4 25 | scmCheckoutRetryCount: 2 26 | securityRealm: 27 | local: 28 | allowsSignup: false 29 | enableCaptcha: false 30 | users: 31 | - id: "admin" 32 | password: ${adminpw:-passw0rd} 33 | - id: "gp.macario" 34 | password: ${gpmacariopw:-samplepass} 35 | # - id: "bruno.mea" 36 | # password: ${adminpw:-samplepass} 37 | # - id: "michele.paglia" 38 | # password: ${adminpw:-samplepass} 39 | # - id: "alberto.gotta" 40 | # password: ${adminpw:-samplepass} 41 | systemMessage: "Jenkins configured automatically for nemo by Jenkins Configuration as Code Plugin\n\n" 42 | # EOF 43 | -------------------------------------------------------------------------------- /mydsl/seed_configure_git.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | Usage: 3 | 4 | Browse ${JENKINS_URL}/view/All/newJob 5 | 6 | * Item Name: seed-configure-git 7 | * Type: Freestyle project 8 | 9 | Browse ${JENKINS_URL}/job/seed_configure_git/configure 10 | 11 | * Restrict where this project can be run 12 | - Label Expression: master 13 | 14 | * Build > Add build step 15 | - Process Job DSLs 16 | - DSL Script: 17 | 18 | Browse ${JENKINS_URL}/job/seed_configure_git/build?delay=0sec 19 | 20 | */ 21 | 22 | def jobName = "configure_git" 23 | 24 | job(jobName) { 25 | 26 | // Warning: (script, line 26) plugin 'nodelabelparameter' needs to be installed 27 | /* parameters { 28 | nodeParam('build-yocto-slave') { 29 | description('select test host') 30 | defaultNodes(['node1']) 31 | allowedNodes(['node1', 'node2', 'node3']) 32 | trigger('multiSelectionDisallowed') 33 | eligibility('IgnoreOfflineNodeEligibility') 34 | } 35 | } */ 36 | 37 | steps { 38 | shell "id" 39 | shell "printenv" 40 | shell "ps axf" 41 | shell "git config -l" 42 | shell "echo \$(whoami)" 43 | shell "echo \$(hostname)" 44 | shell "git config --global user.name \"easy-jenkins\"" 45 | shell "git config --global user.email \"\$(whoami)@\$(hostname)\"" 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /myscripts/list_plugins.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | List all the installed Jenkins plugins 3 | 4 | Execute it from the Script Console: 5 | 6 | - Browse ${JENKINS_URL}/script 7 | - Paste this page 8 | - Click "Run" 9 | 10 | You may also execute it from the Scriptler plugin: 11 | 12 | - Browse ${JENKINS_URL}/scriptler 13 | */ 14 | 15 | // Jenkins APIs: 16 | // 17 | // http://javadoc.jenkins-ci.org/allclasses-noframe.html 18 | // http://javadoc.jenkins-ci.org/hudson/PluginManager.html 19 | // http://javadoc.jenkins-ci.org/hudson/PluginWrapper.html 20 | // http://javadoc.jenkins-ci.org/hudson/model/UpdateSite.Plugin.html 21 | 22 | import jenkins.model.Jenkins 23 | 24 | def debugPrint(String s) { 25 | //println "DEBUG: " + s 26 | } 27 | 28 | // println(Jenkins.instance.pluginManager.plugins) 29 | // println Jenkins.instance.pluginManager.getPlugins() 30 | // println "" 31 | 32 | println "# pluginName pluginVersion # latestVersion" 33 | for (p in Jenkins.instance.pluginManager.plugins.sort()) { 34 | debugPrint "p=" + p 35 | debugPrint "p.getClass()=" + p.getClass() 36 | debugPrint "p.getVersion()=" + p.getVersion() 37 | debugPrint "p.getBackupVersion()=" + p.getBackupVersion() 38 | debugPrint "p.hasUpdate()=" + p.hasUpdate() 39 | debugPrint "p.getUpdateInfo()=" + p.getUpdateInfo() 40 | 41 | line = p.toString() 42 | line = line.substring(line.lastIndexOf(':') + 1) 43 | if (p.hasUpdate()) { 44 | hudson.model.UpdateSite.Plugin usp = p.getUpdateInfo(); 45 | debugPrint "usp.title=" + usp.title 46 | debugPrint "usp.wiki=" + usp.wiki 47 | debugPrint "usp.version=" + usp.version 48 | line = line + " " + p.getVersion() + " # " + usp.version 49 | } else { 50 | line = line + " " + p.getVersion() 51 | } 52 | // debugPrint p.api.toString() 53 | // debugPrint p.getInfo() 54 | println line 55 | // println "# ---------------------" 56 | } 57 | 58 | // println Jenkins.instance.getViews() 59 | -------------------------------------------------------------------------------- /myscripts/README.md: -------------------------------------------------------------------------------- 1 | # easy-jenkins/myscripts 2 | 3 | This directory contains a collection of useful Jenkins scripts. 4 | 5 | ### How to run the scripts 6 | 7 | Jenkins offers a scripting language based on [Groovy](http://www.groovy-lang.org/) to simplify administration tasks. 8 | 9 | #### From Jenkins Script Console 10 | 11 | The easiest way for running a Jenkins script is via the Jenkins Script Console which you may access via a web browser opening the 12 | `$JENKINS_URL/script` URL, for instance . 13 | 14 | See https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Script+Console for details. 15 | 16 | #### From a shell 17 | 18 | You may also run the scripts directly from a shell (i.e. Bash) 19 | 20 | ``` 21 | $ curl -d "script=" http://jenkins/script 22 | ``` 23 | 24 | Alternatively you may get a plain/text response with the following command 25 | 26 | ``` 27 | $ curl -d "script=" http://jenkins/scriptText 28 | ``` 29 | 30 | According to the HTTP protocol, you will get a "Error 403" in case you have no rights to access the Jenkins Script Console -- in this case you may provide the `--user 'username:password'` option to curl to submit the proper user credentials. 31 | 32 | Error 401 will be returned if the credentials are not valid. 33 | 34 | If you add the `-s` option to curl the debugging information will be stripped, and only the actual result from the Jenkins server will be printed. 35 | 36 | #### A few examples 37 | 38 | ``` 39 | $ curl -d "script=$(<./myscripts/hello.groovy)" http://192.168.99.100:9080/scriptText 40 | ``` 41 | 42 | ``` 43 | $ curl -sd "script=$(<./myscripts/hello.groovy)" http://mv-linux-powerhorse.solarma.it:9080/scriptText 44 | ``` 45 | 46 | ``` 47 | $ curl --user 'username:password' -d "script=$(<./myscripts/hello.groovy)" https://build.automotivelinux.org/scriptText 48 | ``` 49 | 50 | ### See also 51 | 52 | * https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Script+Console 53 | * https://wiki.jenkins-ci.org/display/JENKINS/Scriptler+Plugin 54 | * https://github.com/jenkinsci/jenkins-scripts 55 | * https://www.cloudbees.com/jenkins/juc-2015/presentations/JUC-2015-USEast-Groovy-With-Jenkins-McCollum.pdf 56 | * https://learnxinyminutes.com/docs/groovy/ 57 | 58 | 59 | -------------------------------------------------------------------------------- /myjenkins/seed.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | Project: https://github.com/gmacario/easy-jenkins 3 | File: myjenkins/seed.groovy 4 | 5 | Adapted from https://github.com/gmacario/cdeasy/blob/master/docker/jenkins/seed.groovy 6 | 7 | If copied on the Jenkins master under `/usr/share/jenkins/ref/init.groovy.d/` 8 | this script will automatically be run every time the Jenkins master is started 9 | 10 | To test the script: 11 | - Browse ${JENKINS_URL}/script to access the Jenkins Script Console 12 | - Paste the contents of this file 13 | - Click "Run" 14 | */ 15 | 16 | import jenkins.model.*; 17 | import hudson.model.FreeStyleProject; 18 | import hudson.plugins.git.GitSCM; 19 | import hudson.tasks.Shell; 20 | import javaposse.jobdsl.plugin.*; 21 | 22 | def url = "https://github.com/gmacario/easy-jenkins.git" 23 | def jobName = "seed" 24 | 25 | println "DEBUG: List all nodes" 26 | for (node in Jenkins.instance.getNodes()) { 27 | println "DEBUG: node " + node 28 | } 29 | 30 | // TODO: If jobName exists should delete it 31 | map = Jenkins.instance.getItemMap() 32 | println "DEBUG: map = " + map 33 | if (map.containsKey(jobName)) { 34 | println "ERROR: project " + jobName + " already exists" 35 | return 1; 36 | } 37 | 38 | project = Jenkins.instance.createProject(FreeStyleProject, jobName) 39 | def gitScm = new GitSCM(url) 40 | gitScm.branches = [new hudson.plugins.git.BranchSpec("*/master")] 41 | project.scm = gitScm 42 | 43 | project.getBuildersList().clear() 44 | 45 | project.getBuildersList().add(new Shell("echo Hello world")); 46 | 47 | // project.getBuildersList().add(new Shell("docker pull niaquinto/gradle")); 48 | // project.getBuildersList().add(new Shell("docker run -v \$PWD:/usr/bin/app --entrypoint=gradle niaquinto/gradle build")); 49 | // 50 | // project.getBuildersList().add(new ExecuteDslScripts( 51 | // new ExecuteDslScripts.ScriptLocation("false","mydsl/**/*.groovy",null), 52 | // false, 53 | // RemovedJobAction.IGNORE, 54 | // RemovedViewAction.IGNORE, 55 | // LookupStrategy.JENKINS_ROOT, 56 | // "src/main/groovy") 57 | // ); 58 | 59 | project.save() 60 | 61 | // println "DEBUG: Executing printenv" 62 | // println "printenv".execute().text 63 | 64 | println "INFO: Trigger the build with 'curl \${JENKINS_URL}/job/" + jobName + "/build'" 65 | 66 | // EOF 67 | -------------------------------------------------------------------------------- /docs/howto-build-gdp.md: -------------------------------------------------------------------------------- 1 | ## Introduction 2 | 3 | 4 | 5 | This document explains how to build from sources my fork of the [GENIVI Demo Platform](http://projects.genivi.org/genivi-demo-platform/home) using Jenkins. 6 | 7 | This procedure may be used as a regression test suite for the [gmacario/easy-jenkins](https://github.com/gmacario/easy-jenkins) project. 8 | 9 | The following instructions were tested on 10 | 11 | * Docker client: itm-gmacario-w7 (MS Windows 7 64-bit, Docker Toolbox 1.10.0) 12 | * Docker engine: mv-linux-powerhorse (Ubuntu 14.04.3 LTS 64-bit, Docker Engine 1.10.0) 13 | 14 | ## Preparation 15 | 16 | Refer to [preparation.md](https://github.com/gmacario/easy-jenkins/blob/master/docs/preparation.md) for details. 17 | 18 | ## Build project `build_gdp` 19 | 20 | 21 | 22 | Browse `${JENKINS_URL}/job/build_gdp/`, then click **Build Now** 23 | 24 | You may watch the build logs at `${JENKINS_URL}/job/build_gdp/lastBuild/console` 25 | 26 | 27 | 28 | ``` 29 | Started by user anonymous 30 | [EnvInject] - Loading node environment variables. 31 | Building remotely on build-yocto-slave (yocto) in workspace /home/jenkins/workspace/build_gdp 32 | Cloning the remote Git repository 33 | Cloning repository https://github.com/gmacario/genivi-demo-platform 34 | ... 35 | NOTE: Running task 4393 of 4394 (ID: 7, /home/jenkins/workspace/build_gdp/gdp-src-build/../meta-genivi-demo/recipes-demo-platform/images/genivi-demo-platform.bb, do_rootfs) 36 | NOTE: recipe genivi-demo-platform-1.3+snapshot-20160205-r0: task do_rootfs: Started 37 | NOTE: recipe genivi-demo-platform-1.3+snapshot-20160205-r0: task do_rootfs: Succeeded 38 | NOTE: Running noexec task 4394 of 4394 (ID: 11, /home/jenkins/workspace/build_gdp/gdp-src-build/../meta-genivi-demo/recipes-demo-platform/images/genivi-demo-platform.bb, do_build) 39 | NOTE: Tasks Summary: Attempted 4394 tasks of which 22 didn't need to be rerun and all succeeded. 40 | 41 | Summary: There were 16 WARNING messages shown. 42 | Notifying upstream projects of job completion 43 | Finished: SUCCESS 44 | ``` 45 | 46 | **NOTE**: A full build takes about 5 hours to complete on a dual-Xeon(R) CPU X5450 @3.00 GHz and 16 GB RAM. 47 | 48 | Browse `${JENKINS_URL}/job/build_gdp/ws/gdp-src-build/tmp/deploy/images/qemux86-64/` to inspect the build results. 49 | 50 | ![Build results of project build_gdp](images/capture-20160205-1709.png) 51 | 52 | 53 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | # ================================================================================= 2 | # Project: https://github.com/gmacario/easy-jenkins 3 | # 4 | # File: docker-compose.yml 5 | # 6 | # References: 7 | # - Compose file reference: https://docs.docker.com/compose/compose-file/ 8 | # ================================================================================= 9 | 10 | version: '3.3' 11 | 12 | services: 13 | myjenkins: 14 | # image: jenkins:latest 15 | build: myjenkins 16 | environment: 17 | - CASC_JENKINS_CONFIG 18 | # - CASC_JENKINS_CONFIG:${CASC_JENKINS_CONFIG} 19 | # - CASC_JENKINS_CONFIG:/var/jenkins_home/casc_configs/default.yaml 20 | # - CASC_JENKINS_CONFIG:/var/jenkins_home/casc_configs 21 | ports: 22 | - "9080:8080" 23 | - "50000:50000" 24 | # tty: true 25 | # privileged: true 26 | network_mode: "bridge" 27 | volumes: 28 | - jenkins_home:/var/jenkins_home 29 | - /var/run/docker.sock:/var/run/docker.sock 30 | - "${PWD}/casc_configs:/var/jenkins_home/casc_configs:ro" 31 | secrets: 32 | - adminpw # Initial administrator user password 33 | # - gpmacariopw 34 | # - agent_private_key # SSH private key for connecting ssh slaves 35 | # - github # Github username with password as an example 36 | 37 | # build-yocto-slave: 38 | # image: gmacario/build-yocto:latest 39 | # user: jenkins 40 | # entrypoint: "" 41 | # command: "java -jar /usr/share/jenkins/slave.jar -jnlpUrl http://master:8080/computer/build-yocto-slave/slave-agent.jnlp" 42 | # links: 43 | # - myjenkins:master 44 | # volumes: 45 | # - data:/home/jenkins 46 | 47 | nexus: 48 | image: sonatype/nexus3:latest 49 | ports: 50 | - "9081:8081" 51 | - "9123:9123" 52 | network_mode: "bridge" 53 | 54 | # Be careful with newlines in your secrets, make sure to remove them 55 | # before running docker-compose up. 56 | secrets: 57 | adminpw: 58 | file: ${PWD}/secrets/adminpw 59 | # gpmacariopw: 60 | # file: ${PWD}/secrets/gpmacariopw 61 | # agent_private_key: 62 | # # This should point to the private key you want your jenkins master to use 63 | # # when connecting to slaves. For example in AWS this would be your .pem file 64 | # file: ~/.ssh/id_rsa 65 | # github: 66 | # file: /var/deploy/secrets/github 67 | 68 | volumes: 69 | jenkins_home: 70 | # data: 71 | # downloads: 72 | # sstate-cache: 73 | 74 | # EOF 75 | -------------------------------------------------------------------------------- /docs/building-wtfapp-udooneo.md: -------------------------------------------------------------------------------- 1 | # Building the WTF Android Application for the UDOO NEO 2 | 3 | This document explains how to build from sources the [WTF App](https://github.com/WillyShakes/UdooWtf) Android Application for the [UDOO Neo](http://www.udoo.org/udoo-neo/) using [easy-jenkins](https://github.com/gmacario/easy-jenkins). 4 | 5 | The following instructions were tested on 6 | 7 | * Docker client: mac-tizy (HW: MacBook Pro; SW: OS X 10.11.3, Docker Toolbox 10.0) 8 | * Docker engine: mv-linux-powerhorse (HW: HP xw8600 Workstation, SW: Ubuntu 14.04.4 LTS 64-bit, Docker 1.10.0) 9 | 10 | ## Preparation 11 | 12 | * Install and configure easy-jenkins - please refer to [preparation.md](https://github.com/gmacario/easy-jenkins/blob/master/docs/preparation.md) for details. 13 | * Verify that the Jenkins Dashboard is accessible at `${DOCKER_URL}` (example: http://192.168.99.100:9080/) 14 | 15 | ## Step-by-step instructions 16 | 17 | ### Configure project `build_wtfapp_udooneo` 18 | 19 | Browse `${JENKINS_URL}`, then click **New Item** 20 | - Item name: `build_wtfapp_udooneo` 21 | - Type: **Freestyle project** 22 | 23 | then click **OK**. 24 | 25 | Inside the project configuration page, fill-in the following information: 26 | - Discard Old Builds: Yes 27 | - Strategy: Log Rotation 28 | - Days to keep builds: (none) 29 | - Max # of builds to keep: 2 30 | - Source Code Management: Git 31 | - Repositories 32 | - Repository URL: `https://github.com/WillyShakes/UdooWtf` 33 | - Credentials: - none - 34 | - Branches to build 35 | - Branch Specifier (blank for 'any'): `*/master` 36 | - Repository browser: (Auto) 37 | - Build Environment 38 | - Build inside a Docker container: Yes 39 | - Docker image to use: Pull docker image from repository 40 | - Image id/tag: `gmacario/android-devenv` 41 | - Build 42 | - Execute shell 43 | - Command 44 | 45 | ``` 46 | #!/bin/bash -xe 47 | 48 | export JAVA_HOME= 49 | chmod a+x gradlew 50 | ./gradlew 51 | 52 | # EOF 53 | ``` 54 | - Post-build Actions 55 | - Archive the artifacts 56 | - Files to archive: `TODO` 57 | 58 | then click **Save** 59 | 60 | ### Build project `build_wtfapp_udooneo` 61 | 62 | 63 | 64 | Browse `${JENKINS_URL}/job/build_wtfapp_udooneo`, then click **Build Now** 65 | 66 | You may watch the build logs at `${JENKINS_URL}/job/build_wtfapp_udooneo/lastBuild/console` 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /myscripts/add_slave_nodes.groovy: -------------------------------------------------------------------------------- 1 | /** 2 | * This script is meant to be executed by a parameterized job in Jenkins 3 | * and will then create new agents (slaves) as per the parameters 4 | * 5 | * SUGGESTED PAIRED PARAMETERS IN JENKINS (type, name, default values, description): 6 | * 7 | * Text - AgentList - "build-yocto-slave" - Names of the agent(s) to create (each line makes one agent) 8 | * String - AgentDescription - "Auto-created Jenkins agent" - Description that will be set for _every_ created agent 9 | * String - AgentExecutors - 2 - Number of executors for the agent 10 | * String - AgentHome - "/home/jenkins" - Remote filesystem root for the agent 11 | * Text - AgentLabels - "/home/jenkins" - Remote filesystem root for the agent 12 | */ 13 | 14 | import hudson.model.Node.Mode 15 | import hudson.slaves.* 16 | import jenkins.model.Jenkins 17 | 18 | /* 19 | //Handy debug logging 20 | Jenkins.instance.nodes.each { 21 | println "BEFORE - Agent: $it" 22 | } 23 | */ 24 | 25 | // FIXME: Extend it to run as a Job DSL Build step 26 | // using the [Job DSL Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Job+DSL+Plugin) 27 | // rather than the [Groovy plugin](https://wiki.jenkins-ci.org/display/JENKINS/Groovy+plugin) 28 | 29 | // The "build" object is added by the Jenkins Groovy plugin and can resolve parameters and such 30 | String agentList = build.buildVariableResolver.resolve('AgentList') 31 | String agentDescription = build.buildVariableResolver.resolve('AgentDescription') 32 | String agentHome = build.buildVariableResolver.resolve('AgentHome') 33 | String agentExecutors = build.buildVariableResolver.resolve('AgentExecutors') 34 | String agentLabels = build.buildVariableResolver.resolve('AgentLabels') 35 | 36 | agentList.eachLine { 37 | // There is a constructor that also takes a list of properties (env vars) at the end, but haven't needed that yet 38 | DumbSlave dumb = new DumbSlave(it, // Agent name, usually matches the host computer's machine name 39 | agentDescription, // Agent description 40 | agentHome, // Workspace on the agent's computer 41 | agentExecutors, // Number of executors 42 | Mode.EXCLUSIVE, // "Usage" field, EXCLUSIVE is "only tied to node", NORMAL is "any" 43 | agentLabels, // Labels 44 | new JNLPLauncher(), // Launch strategy, JNLP is the Java Web Start setting services use 45 | RetentionStrategy.INSTANCE) // Is the "Availability" field and INSTANCE means "Always" 46 | 47 | Jenkins.instance.addNode(dumb) 48 | println "Agent '$it' created with $agentExecutors executors, home '$agentHome' and labels '$agentLabels'" 49 | } 50 | 51 | /* 52 | Jenkins.instance.nodes.each { 53 | println "AFTER - Agent: $it" 54 | } 55 | */ 56 | 57 | // EOF 58 | -------------------------------------------------------------------------------- /myjenkins/Dockerfile: -------------------------------------------------------------------------------- 1 | # Project: gmacario/easy-jenkins 2 | # 3 | # Extend the standard Jenkins LTS Docker image with: 4 | # - Jenkins workflow plugins 5 | # - Docker 6 | # 7 | # Based on https://github.com/camiloribeiro/cdeasy 8 | 9 | FROM jenkins/jenkins 10 | # FROM jenkins/jenkins:lts 11 | # FROM jenkins/jenkins-experimental:latest-jdk10-incrementals 12 | 13 | USER root 14 | RUN apt-get update -qq && \ 15 | apt-cache search groovy && \ 16 | apt-get install -qqy \ 17 | apt-transport-https \ 18 | ca-certificates \ 19 | curl \ 20 | wget \ 21 | lxc \ 22 | iptables \ 23 | dos2unix \ 24 | groovy 25 | 26 | # Install gosu 27 | RUN curl -o /usr/local/bin/gosu -fsSL \ 28 | "https://github.com/tianon/gosu/releases/download/1.7/gosu-$(dpkg --print-architecture)" && \ 29 | chmod +x /usr/local/bin/gosu 30 | 31 | # Install Docker 32 | RUN wget -qO- https://get.docker.com/ | sh 33 | RUN usermod -aG docker jenkins 34 | 35 | # Add user "jenkins" to group "docker" of the Docker host 36 | # (on boot2docker, group "docker" has gid=100) 37 | RUN usermod -aG 100 jenkins 38 | 39 | # Install docker-compose 40 | RUN curl -o /usr/local/bin/docker-compose -fsSL \ 41 | "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" && \ 42 | chmod +x /usr/local/bin/docker-compose 43 | 44 | # Workaround to prevent install-plugins.sh to fail 45 | RUN mkdir -p /usr/share/jenkins/ref/plugins/tmp 46 | 47 | ENV JENKINS_UC_EXPERIMENTAL=https://updates.jenkins.io/experimental 48 | 49 | # Install additional Jenkins plugins 50 | RUN install-plugins.sh \ 51 | ansicolor \ 52 | ant \ 53 | antisamy-markup-formatter \ 54 | blueocean \ 55 | blueocean-pipeline-editor \ 56 | build-timeout \ 57 | command-launcher \ 58 | configuration-as-code \ 59 | configuration-as-code-support \ 60 | delivery-pipeline-plugin \ 61 | docker-build-publish \ 62 | docker-custom-build-environment \ 63 | docker-plugin \ 64 | email-ext \ 65 | ez-templates \ 66 | git \ 67 | git-client \ 68 | github-branch-source \ 69 | github-oauth \ 70 | github-organization-folder \ 71 | github-pullrequest \ 72 | gradle \ 73 | greenballs \ 74 | groovy \ 75 | htmlpublisher \ 76 | jenkins-multijob-plugin \ 77 | job-dsl \ 78 | jobConfigHistory \ 79 | join \ 80 | kubernetes \ 81 | kubernetes-cli \ 82 | ldap \ 83 | mailer \ 84 | mapdb-api \ 85 | matrix-auth \ 86 | matrix-project \ 87 | mercurial \ 88 | mock-slave \ 89 | pam-auth \ 90 | pipeline-github-lib \ 91 | publish-over-ssh \ 92 | resource-disposer \ 93 | run-condition \ 94 | sectioned-view \ 95 | ssh-slaves \ 96 | subversion \ 97 | timestamper \ 98 | translation \ 99 | view-job-filters \ 100 | windows-slaves \ 101 | workflow-aggregator \ 102 | workflow-job \ 103 | workflow-support \ 104 | ws-cleanup 105 | 106 | # "workflow-support:incrementals;org.jenkins-ci.plugins.workflow;2.19-rc295.e017dc58c0a3" \ 107 | 108 | COPY seed.groovy /usr/share/jenkins/ref/init.groovy.d/seed.groovy 109 | 110 | RUN touch /var/run/docker.sock 111 | 112 | USER jenkins 113 | 114 | # EOF 115 | -------------------------------------------------------------------------------- /docs/configuring-access-control-via-github.md: -------------------------------------------------------------------------------- 1 | # Configuring Access Control in Jenkins via GitHub 2 | 3 | After a default installation of easy-jenkins, the Jenkins instance can be controlled by whoever has accesses to `${JENKINS_URL}`. 4 | This may be acceptable when your server is located behind a company firewall, but is definitely not suitable for publicly exposed servers. 5 | 6 | This document explains how to enable access control, delegating user authentication to [GitHub](https://github.com/). 7 | 8 | **NOTE**: In the configuration described in this page, `${JENKINS_URL}` corresponds to http://myserver.example.com:9080/ -- please replace details for your own instance of easy-jenkins wherever appropriate. 9 | 10 | ### Create a GitHub application registration 11 | 12 | 1. Visit https://github.com/settings/applications/new to create a GitHub application registration. 13 | 2. The values for application name, homepage URL, or application description don't matter. They can be customized however desired. 14 | 3. However, the authorization callback URL takes a specific value. It must be http://myserver.example.com:9080/securityRealm/finishLogin where http://myserver.example.com:9080/ is the location of the Jenkins server. 15 | 16 | According to our example, fill in the following 17 | 18 | * Application name: `easy-jenkins@myserver.example.com:9080` 19 | * Homepage URL: `http://myserver.example.com:9080/` 20 | * Application description: `Testing OAuth with easy-jenkins` 21 | * Authorization callback URL: `http://myserver.example.com:9080/securityRealm/finishLogin` 22 | 23 | then click **Register application**. 24 | 25 | Keep the result page open, and take note of the following values (they will be used to configure the Github Authentication Plugin as explained in the following section) 26 | 27 | * Client ID: xxx 28 | * Client Secret: yyy 29 | 30 | ### Configure Global Security in Jenkins 31 | 32 | Browse `${JENKINS_URL}` > Manage Jenkins > Configure Global Security 33 | 34 | * Enable security: Yes 35 | * TCP port for JNLP agents: Fixed: 5000 36 | * Disable remember me: No 37 | * Access Control 38 | - Security Realm: Github Authentication Plugin 39 | - Global GitHub OAuth Settings 40 | - GitHub Web URI: `https://github.com` 41 | - GitHub API URI: `https://api.github.com` 42 | - Client ID: xxx (paste the value from the GitHub page above) 43 | - Client Secret: yyy (paste the value from the GitHub page above) 44 | - OAuth Scope(s): `read:org,user:email` 45 | - Authorization: Logged-in users can do anything (See NOTE below) 46 | * Allow anonymous read access: No 47 | * Markup Formatter: Plain text 48 | * Prevent Cross Site Request Forgery exploits: No 49 | * Plugin Manager 50 | * Use browser for metadata download: No 51 | * Enable Slave->Master Access Control: Yes 52 | 53 | then click **Save**. 54 | 55 | **NOTE**: In order to achieve a finer grain of access control choose instead 56 | 57 | * Authorization: Project-based Matrix Authorization Strategy 58 | 59 | then add each single GitHub user/group you want to enable. 60 | 61 | **IMPORTANT**: Make sure you give all rights at least to one legitimate user, otherwise after clicking "Save" you will not be able to login any more! 62 | 63 | ### See also 64 | 65 | * https://jenkins.io/solutions/github/ 66 | * https://wiki.jenkins-ci.org/display/JENKINS/Github+OAuth+Plugin#GithubOAuthPlugin-Setup 67 | * https://developer.github.com/v3/oauth/ 68 | 69 | 70 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # easy-jenkins 2 | 3 | Easily deploy a [Jenkins](https://jenkins-ci.org/) CI/CD infrastructure via [docker-machine](https://www.docker.com/docker-machine) and [docker-compose](https://www.docker.com/docker-compose). 4 | 5 | Please see [CHANGELOG](CHANGELOG.md) for main changes since previous release. 6 | 7 | Here is [a presentation about easy-jenkins](http://gmacario.github.io/images/easybuild-torinotech-2016-04-01.pdf) which explains the motivations behind this project. 8 | 9 | ### TL;DR 10 | 11 | ``` 12 | $ git clone https://github.com/gmacario/easy-jenkins 13 | $ cd easy-jenkins 14 | $ ./runme.sh 15 | ``` 16 | 17 | If the script executes successfully it will display a message like the following: 18 | 19 | ``` 20 | INFO: Now browse http://192.168.99.100:9080/ to access the Jenkins dashboard 21 | ``` 22 | 23 | The Jenkins dashboard may then be accessed by opening the displayed URL using a recent Internet browser. 24 | 25 | The behavior of the `runme.sh` script may be customized through some environment variables - please refer to the comments inside the script for details. 26 | 27 | You will also be reminded to use the following command 28 | 29 | ``` 30 | INFO: Run the following command to configure your shell: 31 | INFO: eval $(docker-machine env easy-jenkins) 32 | ``` 33 | 34 | in order to setup the environment variables so that `docker-compose` and `docker` will interact with the correct Docker engine. 35 | 36 | ### System Requirements 37 | 38 | In order to run easy-jenkins you need a recent 64-bit x86 host with: 39 | 40 | 1. Minimum HW requirements: a dual-core CPU, 8 GB RAM, 100 GB disk space 41 | 2. The most recent version of [Docker](https://www.docker.com/) tools (see Note 1) 42 | * Docker Engine (see Note 2) 43 | * Docker Compose 44 | * Docker Machine 45 | 5. A recent Internet browser (i.e. [Google Chrome](https://www.google.com/chrome/)) 46 | 6. A fast Internet connection 47 | 48 | **Note 1**: By installing [Docker Toolbox](https://docs.docker.com/toolbox/) (either on [OS X](http://www.apple.com/osx/) or [MS Windows](http://www.microsoft.com/en-us/windows)) you will get all the Docker tools (i.e. docker, docker-compose, docker-machine, etc.) required by easy-jenkins. 49 | 50 | **Note 2**: Thanks to docker-machine you can configure easy-jenkins to deploy and run the containers on a remote Docker engine, for instance: 51 | 52 | 1. A fast, multi-core server on your local network 53 | 2. An instance on a public cloud, such as [Amazon EC2](https://aws.amazon.com/it/ec2/), [DigitalOcean](https://www.digitalocean.com/), etc. 54 | 55 | ### I installed easy-jenkins, now what can I do? 56 | 57 | Basically whatever you can do with Jenkins. 58 | 59 | * A comprehensive collection of tutorials and reference manuals on Jenkins can be found at [jenkins.io/doc][1]. 60 | * The [CloudBeesTV channel on YouTube][2] features a rich collection of tutorials and webinars. 61 | * If you prefer a book instead, check the excellent (even though a little outdated) [Jenkins: The Definitive Guide][3]. 62 | * Finally, under the [docs/][4] subdirectory of this repository you can find some examples about how to use easy-jenkins. 63 | 64 | [1]: https://jenkins.io/doc/ 65 | [2]: https://www.youtube.com/user/CloudBeesTV 66 | [3]: https://archive.org/details/jenkins 67 | [4]: docs/ 68 | 69 | ### License 70 | 71 | easy-jenkins is licensed under the MIT License - for details please see the `LICENSE` file. 72 | 73 | Copyright (C) 2016-2019, [Gianpaolo Macario](http://gmacario.github.io/) 74 | -------------------------------------------------------------------------------- /docs/testing-docker.md: -------------------------------------------------------------------------------- 1 | # Testing Docker configuration inside easy-jenkins 2 | 3 | This procedure is used to verify the correct installation of [Docker](https://www.docker.com/) tools inside service `myjenkins`, a.k.a. the Jenkins `master` node. 4 | 5 | ## Preparation 6 | 7 | Install easy-jenkins from https://github.com/gmacario/easy-jenkins 8 | 9 | Refer to [preparation.md](https://github.com/gmacario/easy-jenkins/blob/master/docs/preparation.md) for details. 10 | 11 | ## Step-by-step instructions 12 | 13 | ### Configure project `test_docker` 14 | 15 | * Browse `${JENKINS_URL}`, then click **New Item** 16 | - Item name: `test_docker` 17 | - Type: **Freestyle project** 18 | 19 | then click **OK**. 20 | 21 | * Inside the project configuration page, fill-in the following information: 22 | - Restrict where this project can be run: `master` 23 | - Build 24 | - Add build step > Execute shell 25 | - Command 26 | 27 | ``` 28 | #!/bin/bash -xe 29 | 30 | id 31 | pwd 32 | 33 | docker --version 34 | docker-compose --version 35 | docker-machine --version || true 36 | 37 | docker version 38 | docker info 39 | docker images 40 | docker ps -a 41 | docker volume ls 42 | docker network ls 43 | 44 | # EOF 45 | ``` 46 | 47 | then click **Save** 48 | 49 | ### Build project `test_docker` 50 | 51 | * Browse `${JENKINS_URL}/job/test_docker`, then click **Build Now** 52 | 53 | Result: SUCCESS 54 | 55 | 56 | 57 | Inspect `${JENKINS_URL}/job/test_docker/lastBuild/console` 58 | 59 | ``` 60 | Started by user anonymous 61 | [EnvInject] - Loading node environment variables. 62 | Building on master in workspace /var/jenkins_home/jobs/test_docker/workspace 63 | [workspace] $ /bin/bash -xe /tmp/hudson2149809609450450021.sh 64 | + id 65 | uid=0(root) gid=0(root) groups=0(root) 66 | + pwd 67 | /var/jenkins_home/jobs/test_docker/workspace 68 | + docker --version 69 | Docker version 1.10.1, build 9e83765 70 | + docker-compose --version 71 | docker-compose version 1.6.0, build d99cad6 72 | + docker-machine --version 73 | /tmp/hudson2149809609450450021.sh: line 8: docker-machine: command not found 74 | + true 75 | + docker version 76 | Client: 77 | Version: 1.10.1 78 | API version: 1.22 79 | Go version: go1.5.3 80 | Git commit: 9e83765 81 | Built: Thu Feb 11 19:09:42 2016 82 | OS/Arch: linux/amd64 83 | 84 | Server: 85 | Version: 1.10.1 86 | API version: 1.22 87 | Go version: go1.5.3 88 | Git commit: 9e83765 89 | Built: Thu Feb 11 19:09:42 2016 90 | OS/Arch: linux/amd64 91 | + docker info 92 | Containers: 0 93 | Running: 0 94 | Paused: 0 95 | Stopped: 0 96 | Images: 0 97 | Server Version: 1.10.1 98 | Storage Driver: devicemapper 99 | Pool Name: docker-0:32-181-pool 100 | Pool Blocksize: 65.54 kB 101 | Base Device Size: 10.74 GB 102 | Backing Filesystem: ext4 103 | Data file: /dev/loop0 104 | Metadata file: /dev/loop1 105 | Data Space Used: 305.7 MB 106 | Data Space Total: 107.4 GB 107 | Data Space Available: 47.65 GB 108 | Metadata Space Used: 729.1 kB 109 | Metadata Space Total: 2.147 GB 110 | Metadata Space Available: 2.147 GB 111 | Udev Sync Supported: false 112 | Deferred Removal Enabled: false 113 | Deferred Deletion Enabled: false 114 | Deferred Deleted Device Count: 0 115 | Data loop file: /var/lib/docker/devicemapper/devicemapper/data 116 | WARNING: Usage of loopback devices is strongly discouraged for production use. Either use `--storage-opt dm.thinpooldev` or use `--storage-opt dm.no_warn_on_loop_devices=true` to suppress this warning. 117 | Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata 118 | Library Version: 1.02.90 (2014-09-01) 119 | Execution Driver: native-0.2 120 | Logging Driver: json-file 121 | Plugins: 122 | Volume: local 123 | Network: null host bridge 124 | Kernel Version: 4.1.17-boot2docker 125 | Operating System: Debian GNU/Linux 8 (jessie) (containerized) 126 | OSType: linux 127 | Architecture: x86_64 128 | CPUs: 2 129 | Total Memory: 1.956 GiB 130 | Name: 61d3e4cd8e76 131 | ID: ZHXV:WTIC:XCQE:2M2S:XIMR:PYLQ:Z37D:CMFI:3AJI:7C5W:YROR:FB7X 132 | WARNING: bridge-nf-call-iptables is disabled 133 | WARNING: bridge-nf-call-ip6tables is disabled 134 | + docker images 135 | REPOSITORY TAG IMAGE ID CREATED SIZE 136 | + docker ps 137 | CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 138 | + docker volume ls 139 | DRIVER VOLUME NAME 140 | Notifying upstream projects of job completion 141 | Finished: SUCCESS 142 | ``` 143 | 144 | Notice that there are no containers inside this Docker engine - which means it is a different engine from the one where easy-jenkins services are running. 145 | 146 | **TODO**: Do not use Docker-in-Docker for service myjenkins. See related https://github.com/gmacario/easy-jenkins/issues/31 147 | 148 | 149 | -------------------------------------------------------------------------------- /docs/easyjenkins-java10-demo.md: -------------------------------------------------------------------------------- 1 | # Preparing easy-jenkins demo, 2018-06-22 2 | 3 | ## Executive Summary 4 | 5 | This document details the steps to reproduce the demo given by [@gmacario](https://github.com/gmacario) during the last day of the [Jenkins & Java 10+ Hackathon](https://jenkins.io/blog/2018/06/08/jenkins-java10-hackathon/) which took place on 2018-06-22. 6 | 7 | YouTube Video: (from 18:52 to 28:10) 8 | 9 | See 10 | 11 | ## Prerequisites 12 | 13 | Please refer to section "System Requirements" of 14 | 15 | ## Step-by-step instructions 16 | 17 | Login to a Bash shell on the machine where you installed Docker (in our example, login as _gmacario@mac-tizy_) 18 | 19 | ### Deploy easy-jenkins inside a VirtualBox VM 20 | 21 | Clone easy-jenkins source code from GitHub 22 | 23 | ```shell 24 | mkdir -p $HOME/github/gmacario && cd $HOME/github/gmacario && \ 25 | [ ! -e easy-jenkins ] && git clone https://github.com/gmacario/easy-jenkins 26 | ``` 27 | 28 | Switch to development branch 29 | 30 | ```shell 31 | cd $HOME/github/gmacario/easy-jenkins && \ 32 | git checkout feature/install-nexus-oss && git pull --all --prune 33 | ``` 34 | 35 | Bring-up easy-jenkins 36 | 37 | ```shell 38 | cd $HOME/github/gmacario/easy-jenkins && \ 39 | ./runme.sh 40 | ``` 41 | 42 | If everything is OK, you should get an output similar to the following: 43 | 44 | ``` 45 | ... 46 | Creating easy-jenkins_myjenkins_1 ... done 47 | INFO: Run the following command to configure your shell: 48 | INFO: eval $(docker-machine env easy-jenkins) 49 | INFO: Browse http://192.168.99.100:9080/ to access the Jenkins dashboard 50 | INFO: Initial administrator password: c253570cfcec43b79e92f47008dc0ac0 51 | gmacario@mac-tizy:~/github/gmacario/easy-jenkins (wip/try-java10-jcasc)$ 52 | ``` 53 | 54 | **NOTE**: Take note of the displayed URL and initial administrator password (they may differ from the ones shown here) since you will need them later on. 55 | 56 | (Optional) Check docker-compose logs 57 | 58 | ```shell 59 | eval $(docker-machine env easy-jenkins) && \ 60 | docker-compose logs -f 61 | ``` 62 | 63 | ### Configure easy-jenkins instance 64 | 65 | Browse `${JENKINS_URL}` -- example: 66 | 67 | * On page "Unlock Jenkins", paste the Jenkins initial administrator password (see output of `./runme.sh` or type `docker-compose logs`), then click "Continue" 68 | * On page "Getting Started", click "Install suggested plugins" 69 | * On page "Create First Admin User", fill in the requested details, then click "Save and Continue" 70 | * On page "Instance Configuration", accept the proposed value for Jenkins URL, then click "Save and Finish" 71 | * If requested, click button "Restart" and refresh the browser until you get the "Welcome to Jenkins!" login page 72 | * On page "Welcome to Jenkins!", login with the credentials of the first admin user you have created, then click "Sign in" 73 | * On the main Jenkins dashboard page, click "Build Executor Status", then click the "Configure" icon of node "master" and fill in the following data 74 | - Labels: `docker` 75 | - Click "Save" 76 | 77 | 78 | ### Install sample Pipelines (my-jenkins-pipelines) 79 | 80 | Browse `${JENKINS_URL}` 81 | 82 | * Click "Open Blue Ocean" 83 | * Click "Create a new Pipeline" 84 | * Where do you store your code? GitHub 85 | * Connect to GitHub: Create an access token 86 | - On page "New personal access token" fill in the following data: 87 | - Token description: Choose a meaningful name (example: `easy-jenkins @mac-tizy`) 88 | - Click "Generate token" 89 | - Copy the access token and paste it to the Pipeline setup page, then click "Connect" 90 | * Which organization does the repository belong to? An organization you belong to (example: `gmacario`) 91 | * Choose a repository: my-jenkins-pipelines (you may fork it from ) 92 | * Click "Create Pipeline" 93 | 94 | Result: TODO 95 | 96 | ### Tear-down 97 | 98 | ```shell 99 | cd $HOME/github/gmacario/easy-jenkins && \ 100 | eval $(docker-machine env easy-jenkins) && \ 101 | docker-compose down -v && \ 102 | docker-machine stop easy-jenkins 103 | ``` 104 | 105 | ## If anything fails... 106 | 107 | Logged as gmacario@mac-tizy 108 | 109 | ### Demo easy-jenkins@gmpowerhorse 110 | 111 | ```shell 112 | cd && \ 113 | source $HOME/.bashrc && \ 114 | gmhome-tunnel.sh 115 | ``` 116 | 117 | (Optional) Login to remote Docker Host with the following command 118 | 119 | ```shell 120 | ssh -p 20022 gmacario@localhost 121 | ``` 122 | 123 | * Browse 124 | * Click "Open Blue Ocean" 125 | * Inspect pipeline "my-jenkins-pipelines" 126 | * Inspect pipeline "my-genivi-pipelines" 127 | * Inspect pipeline "easy-jenkins" 128 | 129 | ### Demo easy-jenkins@cc-vm1 130 | 131 | NOTE: Currently on easy-jenkins master 132 | 133 | * Browse 134 | * Click "Open Blue Ocean" 135 | * Inspect pipeline "my-jenkins-pipelines" 136 | * Inspect pipeline "easy-jenkins" 137 | 138 | (Optional) Login to remote Docker Host with the following command 139 | 140 | ```shell 141 | ssh -p root@cc-vm1.solarma.it 142 | ``` 143 | 144 | 145 | -------------------------------------------------------------------------------- /docs/configure-kubernetes-slaves.md: -------------------------------------------------------------------------------- 1 | # Configure Kubernetes slaves on easy-jenkins 2 | 3 | **WORK-IN-PROGRESS* 4 | 5 | ### Introduction 6 | 7 | This document explains how to configure easy-enkins to connect to a Kubernetes cluster. 8 | 9 | Tested on cc-vm1.solarma.it (Ubuntu 16.04.x LTS 64-bit) and Kubernetes cluster "kube-101" on GCP. 10 | 11 | ### References 12 | 13 | * 14 | 15 | * sections 16 | - Running locally with minikube 17 | - Running in Google Container Engine GKE 18 | 19 | ### Step-by-step instructions 20 | 21 | #### Connect to the Kubernetes cluster on GCP 22 | 23 | Browse > Kubernetes Engine > Clusters 24 | 25 | * Select cluster "kube-101" 26 | - In tab "Details", section "Cluster", take note of Endpoint (public IP address) 27 | - Click "Show credentials" 28 | - Click "Connect" 29 | 30 | Alternatively, install the Google Cloud SDK and type the following commands 31 | 32 | ```shell 33 | gcloud init 34 | gcloud container clusters list 35 | gcloud container clusters describe kube-101 \ 36 | --zone europe-west1-b --project kubernetes-workshop-218213 37 | gcloud container clusters get-credentials kube-101 \ 38 | --zone europe-west1-b --project kubernetes-workshop-218213 39 | ``` 40 | 41 | #### Create namespace on Kubernetes cluster 42 | 43 | Inspect the Kubernetes cluster and create a new namespace "easy-jenkins" 44 | 45 | ```shell 46 | kubectl config view 47 | kubectl cluster-info 48 | kubectl get namespaces 49 | kubectl create namespace easy-jenkins 50 | ``` 51 | 52 | Jenkins > Manage Jenkins > Configure System 53 | 54 | * Cloud > Add a new cloud > Kubernetes 55 | - Name: `kube-101` (from GCP console > Clusters) 56 | - Kubernetes URL: (paste from GCP console: Cluster Details > Endpoint) 57 | - Kubernetes server certificate key: (paste from GCP console: Cluster credentials > Cluster CA certificate) 58 | - Disable https certificate check: No 59 | - Kubernetes Namespace: `easy-jenkins` 60 | - Credentials > Add > Jenkins 61 | - Domain: Global credentials (unrestricted) 62 | - Kind: Username with password 63 | - Scope: Global (Jenkins, nodes, items, all child items, etc) 64 | - Username: `admin` (paste from GCP console: Cluster credentials > Username) 65 | - Password: (paste from GCP console: Cluster credentials > Password) 66 | - ID: (empty) 67 | - Description: (empty) 68 | - Click "Add" 69 | 70 | Click "Test Connection" and make sure that 71 | 72 | > Connection test successful 73 | 74 | Continue configuring Kubernetes Cloud "kube-101" 75 | 76 | - Jenkins URL: 77 | - Jenkins tunnel: (empty) 78 | - Connection Timeout: 0 (leave default) 79 | - Read Timeout: 0 (leave default) 80 | - Container Cap: 10 (leave default) 81 | - Pod Retention: Never 82 | - Images > Kubernetes Pod Template 83 | - Name: `jnlp slave` 84 | - Namespace: (emtpy) 85 | - Labels: (empty) 86 | - Usage: Use this node as much as possible (TODO) 87 | - The name of the pod template to inherit from: (empty) 88 | - Containers > Add > Container Template 89 | - Name: (empty) 90 | - Docker image: `jenkins/jnlp-slave` 91 | - Always pull image: No 92 | - Working directory: `/home/jenkins` 93 | - Command to run: `/bin/sh -c` 94 | - Arguments to pass to the command: `cat` 95 | - Allocate pseudo-TTY: Yes 96 | - EnvVars: (none) 97 | - EnvVars: (none) 98 | - Volumes: (none) 99 | - Max number of instances: (empty) 100 | - Pod Retention: Default 101 | - Time in minutes to retain slave when idle: (empty) 102 | - Time in seconds for Pod deadline: (empty) 103 | - Time in seconds for Jenkins connection: 100 (default) 104 | - Annotations: (none) 105 | - Raw yaml for the Pod: (empty) 106 | 107 | then click "Save" 108 | 109 | ### Execute a sample pipeline on kube-101 110 | 111 | TODO 112 | 113 | 114 | Test: 115 | 116 | Jenkins > Open Blue Ocean > New Pipeline 117 | 118 | * Where do you store your code? GitHub 119 | * Which organization does the repository belong to? gmacario 120 | * Choose a repository: test-jenkins-kubernetes-plugin 121 | 122 | The multibranch pipeline is loaded and started, however the build of branch "feature/kube-declarative-pipeline" never starts 123 | 124 | ![screenshot from 2018-10-05 15-04-22](https://user-images.githubusercontent.com/75182/46536832-f892c380-c8af-11e8-8f53-172d5d2d54ac.png) 125 | 126 | This situation can also be detected by looking at the Kubernetes dashboard of cluster "kube-101", namespace "easy-jenkins": 127 | 128 | ![screenshot from 2018-10-05 15-09-12](https://user-images.githubusercontent.com/75182/46537099-be75f180-c8b0-11e8-9c62-c26fcc2300eb.png) 129 | 130 | It looks look like that the Pods `mypod-kr0c7-xxxx` running inside Kubernetes cluster "kube-101" on GCP are unable to connect to our Jenkins master, since the URL is behind a corporate firewall. 131 | 132 | Closing issue, will reopen when we able to test both Jenkins master as well as the slaves deployed on the same Kubernetes cluster, or at least with some capability of communicating to each other. 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /docs/preparation.md: -------------------------------------------------------------------------------- 1 | ## Installing and preparing easy-jenkins 2 | 3 | On a bash shell on the Docker Client, type the following commands to install [easy-jenkins](https://github.com/gmacario/easy-jenkins): 4 | 5 | ``` 6 | $ git clone https://github.com/gmacario/easy-jenkins 7 | $ cd easy-jenkins 8 | $ ./runme.sh 9 | ``` 10 | 11 | Notice that the `runme.sh` will try to create a docker-machine if this is not already available. 12 | 13 | A more complex invocation may be used to create the containers to a different docker-machine (in the following example, `mv-linux-powerhorse`): 14 | 15 | ``` 16 | $ git clone https://github.com/gmacario/easy-jenkins 17 | $ cd easy-jenkins 18 | $ eval $(docker-machine env mv-linux-powerhorse) # OPTIONAL - if docker-engine on a different machine 19 | $ docker-compose stop; docker-compose rm -f; docker-compose build --pull 20 | $ ./runme.sh 21 | ``` 22 | 23 | The `$ docker-compose ...` commands are used to make sure the machine runs the most updated images as defined by easy-jenkins. 24 | 25 | If the installation is successful, the following messages will be displayed on the launching terminal: 26 | 27 | ``` 28 | gmacario@ITM-GMACARIO-W7 MINGW64 ~/easy-jenkins (master) 29 | $ ./runme.sh 30 | INFO: Docker machine mv-linux-powerhorse exists, skipping docker-machine create 31 | INFO: Using Docker machine mv-linux-powerhorse 32 | Creating easyjenkins_myjenkins_1 33 | Creating easyjenkins_build-yocto-slave_1 34 | INFO: Browse http://192.168.12.22:9080/ to access the Jenkins dashboard 35 | INFO: Run the following command to configure your shell: 36 | INFO: eval $(docker-machine env mv-linux-powerhorse) 37 | 38 | gmacario@ITM-GMACARIO-W7 MINGW64 ~/easy-jenkins (master) 39 | $ 40 | ``` 41 | 42 | Take note of the `${JENKINS_URL}` (in our example, ) where the Jenkins dashboard could be accessed. 43 | 44 | Watch docker-compose logs until line `INFO: Jenkins is fully up and running` is displayed: 45 | 46 | ``` 47 | $ eval $(docker-machine env easy-jenkins) 48 | $ docker-compose logs 49 | ... 50 | myjenkins_1 | INFO: Completed initialization 51 | myjenkins_1 | Feb 02, 2016 7:05:31 AM hudson.WebAppMain$3 run 52 | myjenkins_1 | INFO: Jenkins is fully up and running 53 | ... 54 | ``` 55 | 56 | Browse `${JENKINS_URL}` as explained by the `INFO: Browse xxx to access the Jenkins dashboard` message above and verify that the Jenkins dashboard is displayed correctly. 57 | 58 | ### Running Jenkins for the first time 59 | 60 | Jenkins 2.0 requires to supply an Administrator password before the actual configuration may be completed. 61 | 62 | ![Getting Started - Unlock Jenkins](images/capture-20160405-1039.png) 63 | 64 | Find the Administrator password using `docker-compose logs` as in the following example 65 | 66 | ``` 67 | $ eval $(docker-machine env easy-jenkins) 68 | $ docker-compose logs 69 | ... 70 | myjenkins_1 | INFO: 71 | myjenkins_1 | 72 | myjenkins_1 | ************************************************************* 73 | myjenkins_1 | ************************************************************* 74 | myjenkins_1 | ************************************************************* 75 | myjenkins_1 | 76 | myjenkins_1 | Jenkins initial setup is required. An admin user has been created and a password generated. 77 | myjenkins_1 | Please use the following password to proceed to installation: 78 | myjenkins_1 | 79 | myjenkins_1 | 9805450d56d6418dae8b92ebd3f3098c 80 | myjenkins_1 | 81 | myjenkins_1 | This may also be found at: /var/jenkins_home/secrets/initialAdminPassword 82 | myjenkins_1 | 83 | myjenkins_1 | ************************************************************* 84 | myjenkins_1 | ************************************************************* 85 | myjenkins_1 | ************************************************************* 86 | ... 87 | ``` 88 | 89 | **TODO**: Display Administrator password using `docker-compose logs | grep xxx` inside `run.sh`. 90 | 91 | Fill in the password in the form, then click **Continue**. 92 | 93 | The following page will be displayed 94 | 95 | ![Getting Started - Customize Jenkins](images/capture-20160405-1046.png) 96 | 97 | Choose **Install suggested plugins**. 98 | 99 | **TODO**: Check whether plugins are already installed from the list at `myjenkins/plugins.txt`. 100 | 101 | You will then be shown the "Getting Started - Create First Admin User" page 102 | 103 | ![Getting Started - Create First Admin User](images/capture-20160405-1048.png) 104 | 105 | * Username: `xxx` 106 | * Password: `xxx` 107 | * Confirm password: `xxx` 108 | * Full name: `xxx` 109 | * E-mail address: `xxx` 110 | 111 | then click **Save and Finish**. 112 | 113 | If everything is OK, a page "Jenkins is ready!" will be displayed. 114 | 115 | ![Getting Started - Jenkins is ready](images/capture-20160405-1050.png) 116 | 117 | Click **Start using Jenkins** to proceed. 118 | 119 | The Jenkins dashboard should be displayed 120 | 121 | ![Jenkins Dashboard](images/capture-20160405-1051.png) 122 | 123 | 124 | ### Build project `seed` 125 | 126 | Browse `${JENKINS_URL}/job/seed`, then click **Build Now** 127 | 128 | Result: The following projects will be generated and show up in the Jenkins dashboard: 129 | 130 | 1. add_jenkins_slave 131 | 2. build_gdp 132 | 3. configure_git 133 | 134 | 142 | 143 | 158 | 159 | 171 | 172 | 173 | -------------------------------------------------------------------------------- /docs/building-easyjenkins.md: -------------------------------------------------------------------------------- 1 | # Building easy-jenkins inside easy-jenkins 2 | 3 | This document contains instructions for building easy-jenkins inside easy-jenkins. 4 | 5 | This procedure may be useful to verify non-regressions of a new feature/bugfix before merging it to the master branch. 6 | 7 | ## Preparation 8 | 9 | * Install and configure easy-jenkins - please refer to [preparation.md](https://github.com/gmacario/easy-jenkins/blob/master/docs/preparation.md) for details. 10 | * Verify that the Jenkins Dashboard is accessible at `${DOCKER_URL}` (example: http://192.168.99.100:9080/) 11 | 12 | ## Step-by-step instructions 13 | 14 | ### Configure project `build_easyjenkins` 15 | 16 | * Browse `${JENKINS_URL}`, then click **New Item** 17 | - Item name: `build_easyjenkins` 18 | - Type: **Freestyle project** 19 | 20 | then click **OK**. 21 | 22 | **TODO**: Configure a Pipeline instead than a Freestyle project 23 | 24 | * Inside the project configuration page, fill-in the following information: 25 | - Discard Old Builds: Yes 26 | - Strategy: Log Rotation 27 | - Days to keep builds: (none) 28 | - Max # of builds to keep: 5 29 | - Restrict where this project can be run: `master` (TODO: Define and use label `docker`) 30 | - Source Code Management: Git 31 | - Repositories 32 | - Repository URL: `https://github.com/gmacario/easy-jenkins` 33 | - Credentials: - none - 34 | - Branches to build 35 | - Branch Specifier (blank for `any`): `*/master` (TODO?) 36 | - Repository browser: (Auto) 37 | - Build 38 | - Add build step > Execute shell 39 | - Command 40 | 41 | ``` 42 | #!/bin/bash -xe 43 | 44 | docker-compose build --pull 45 | ./runme.sh 46 | 47 | # EOF 48 | ``` 49 | 50 | then click **Save** 51 | 52 | ### Build project `build_easyjenkins` 53 | 54 | 55 | 56 | * Browse `${JENKINS_URL}/job/build_easyjenkins`, then click **Build Now** 57 | 58 | Result: SUCCESS 59 | 60 | ``` 61 | Started by user anonymous 62 | [EnvInject] - Loading node environment variables. 63 | Building in workspace /var/jenkins_home/jobs/build_easyjenkins/workspace 64 | Cloning the remote Git repository 65 | Cloning repository https://github.com/gmacario/easy-jenkins 66 | > git init /var/jenkins_home/jobs/build_easyjenkins/workspace # timeout=10 67 | Fetching upstream changes from https://github.com/gmacario/easy-jenkins 68 | > git --version # timeout=10 69 | > git -c core.askpass=true fetch --tags --progress https://github.com/gmacario/easy-jenkins +refs/heads/*:refs/remotes/origin/* 70 | > git config remote.origin.url https://github.com/gmacario/easy-jenkins # timeout=10 71 | > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10 72 | > git config remote.origin.url https://github.com/gmacario/easy-jenkins # timeout=10 73 | Fetching upstream changes from https://github.com/gmacario/easy-jenkins 74 | > git -c core.askpass=true fetch --tags --progress https://github.com/gmacario/easy-jenkins +refs/heads/*:refs/remotes/origin/* 75 | > git rev-parse refs/remotes/origin/master^{commit} # timeout=10 76 | > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10 77 | Checking out Revision 207f490c51814f47d1f686f818d5bfcd5ed126d3 (refs/remotes/origin/master) 78 | > git config core.sparsecheckout # timeout=10 79 | > git checkout -f 207f490c51814f47d1f686f818d5bfcd5ed126d3 80 | First time build. Skipping changelog. 81 | [workspace] $ /bin/bash -xe /tmp/hudson4273555466691351036.sh 82 | + docker-compose build --pull 83 | Building myjenkins 84 | Step 1 : FROM jenkins:latest 85 | latest: Pulling from library/jenkins 86 | ... 87 | Step 11 : RUN /usr/local/bin/plugins.sh /usr/share/jenkins/plugins.txt 88 | ---> Running in f8121831d46a 89 | Downloading ace-editor:1.0.1 90 | Downloading ant:1.2 91 | Downloading antisamy-markup-formatter:1.3 92 | Downloading authentication-tokens:1.2 93 | Downloading branch-api:1.3 94 | Downloading build-flow-plugin:0.18 95 | Downloading build-flow-test-aggregator:1.2 96 | Downloading build-pipeline-plugin:1.5.1 97 | Downloading cloudbees-folder:5.2.1 98 | Downloading conditional-buildstep:1.3.3 99 | Downloading credentials:1.25 100 | Downloading cvs:2.12 101 | Downloading dashboard-view:2.9.7 102 | Downloading delivery-pipeline-plugin:0.9.8 103 | Downloading docker-build-publish:1.1 104 | Downloading docker-commons:1.3.1 105 | Downloading docker-custom-build-environment:1.6.5 106 | Downloading docker-plugin:0.16.0 107 | Downloading docker-workflow:1.3 108 | Downloading durable-task:1.7 109 | Downloading envinject:1.92.1 110 | Downloading external-monitor-job:1.4 111 | Downloading ghprb:1.30.4 112 | Downloading git:2.4.2 113 | Downloading git-client:1.19.5 114 | Downloading git-server:1.6 115 | Downloading github:1.17.1 116 | Downloading github-api:1.72 117 | Downloading github-oauth:0.22.2 118 | Downloading github-pullrequest:0.0.1-rc3 119 | Downloading greenballs:1.15 120 | Downloading groovy:1.29 121 | Downloading htmlpublisher:1.11 122 | Downloading icon-shim:2.0.3 123 | Downloading javadoc:1.3 124 | Downloading jenkins-multijob-plugin:1.20 125 | Downloading job-dsl:1.43 126 | Downloading jobConfigHistory:2.12 127 | Downloading join:1.19 128 | Downloading jquery:1.11.2-0 129 | Downloading jquery-detached:1.2 130 | Downloading junit:1.10 131 | Downloading ldap:1.11 132 | Downloading mailer:1.16 133 | Downloading mapdb-api:1.0.6.0 134 | Downloading matrix-auth:1.3 135 | Downloading matrix-project:1.6 136 | Downloading maven-plugin:2.12.1 137 | Downloading mercurial:1.54 138 | Downloading mock-slave:1.8 139 | Downloading multiple-scms:0.5 140 | Downloading pam-auth:1.2 141 | Downloading parameterized-trigger:2.30 142 | Downloading plain-credentials:1.1 143 | Downloading promoted-builds:2.25 144 | Downloading run-condition:1.0 145 | Downloading scm-api:1.0 146 | Downloading script-security:1.17 147 | Downloading scriptler:2.9 148 | Downloading sectioned-view:1.20 149 | Downloading ssh-agent:1.9 150 | Downloading ssh-credentials:1.11 151 | Downloading ssh-slaves:1.10 152 | Downloading subversion:2.5.7 153 | Downloading token-macro:1.12.1 154 | Downloading translation:1.12 155 | Downloading view-job-filters:1.27 156 | Downloading windows-slaves:1.1 157 | Downloading workflow-aggregator:1.13 158 | Downloading workflow-api:1.13 159 | Downloading workflow-basic-steps:1.13 160 | Downloading workflow-cps:1.13 161 | Downloading workflow-cps-global-lib:1.13 162 | Downloading workflow-durable-task-step:1.13 163 | Downloading workflow-job:1.13 164 | Downloading workflow-multibranch:1.13 165 | Downloading workflow-scm-step:1.13 166 | Downloading workflow-step-api:1.13 167 | Downloading workflow-support:1.13 168 | ---> 92c933702341 169 | Removing intermediate container f8121831d46a 170 | Step 12 : COPY start.sh /tmp/start.sh 171 | ---> 7ec474f8be5f 172 | Removing intermediate container 3278e7a1dcb4 173 | Step 13 : RUN chmod +x /tmp/start.sh && dos2unix /tmp/start.sh 174 | ---> Running in 666f31c47faf 175 | dos2unix: converting file /tmp/start.sh to Unix format ... 176 |  ---> 094a055a3c4b 177 | Removing intermediate container 666f31c47faf 178 | Step 14 : COPY seed.groovy /usr/share/jenkins/ref/init.groovy.d/seed.groovy 179 | ---> 92151d6f447b 180 | Removing intermediate container 95be18e0b67f 181 | Step 15 : RUN touch /var/run/docker.sock 182 | ---> Running in 4d17b4ab2adb 183 | ---> fa36902b47d1 184 | Removing intermediate container 4d17b4ab2adb 185 | Step 16 : ENTRYPOINT /bin/bash -c /tmp/start.sh 186 | ---> Running in b415a4449403 187 | ---> a306135e21f1 188 | Removing intermediate container b415a4449403 189 | Successfully built a306135e21f1 190 | + ./runme.sh 191 | WARNING: Cannot find docker-machine - assuming environment variables are already defined 192 | Creating network "workspace_default" with the default driver 193 | Creating workspace_myjenkins_1 194 | Notifying upstream projects of job completion 195 | Finished: SUCCESS 196 | ``` 197 | 198 | 199 | -------------------------------------------------------------------------------- /docs/building-gdp-ivi9.md: -------------------------------------------------------------------------------- 1 | # Building GDP-ivi9 for qemux86-64 using easy-jenkins 2 | 3 | **NOTE**: This is an historical document for the GDP-ivi9 release - for more recent developments please refer to [building-gdp.md](building-gdp.md). 4 | 5 | 6 | 7 | This document explains how to build from sources the [GENIVI Demo Platform](https://at.projects.genivi.org/wiki/x/aoCw) using [Jenkins](https://jenkins-ci.org/). 8 | 9 | The actual build is executed inside a [Docker custom build environment](https://wiki.jenkins-ci.org/display/JENKINS/CloudBees+Docker+Custom+Build+Environment+Plugin) which is automatically spun by the Jenkins server. 10 | 11 | The following instructions have been tested on: 12 | 13 | * Docker client: itm-gmacario-w7 (MS Windows 7 64-bit, Docker Toolbox 1.10.2) 14 | * Docker engine: alm-gm-ubu15 (Ubuntu 14.04.4 LTS 64-bit, Docker 1.10.3, Docker Compose 1.6.2) 15 | 16 | ## Preparation 17 | 18 | * Install and configure [easy-jenkins](https://github.com/gmacario/easy-jenkins) - please refer to [preparation.md](https://github.com/gmacario/easy-jenkins/blob/master/docs/preparation.md) for details. 19 | * Verify that the Jenkins Dashboard is accessible at `${DOCKER_URL}` (example: http://192.168.99.100:9080/) 20 | 21 | ## Step-by-step instructions 22 | 23 | ### Create folder `GENIVI` 24 | 25 | Browse `${DOCKER_URL}`, then click **New Item** 26 | 27 | * Name: `GENIVI` 28 | * Type: **Folder** 29 | 30 | then click **OK**. Inside the project configuration page, review configuration, then click **OK**. 31 | 32 | ### Create project `build_gdp_ivi9` 33 | 34 | 35 | 36 | Browse `${DOCKER_URL}/job/GENIVI`, then click **New Item** 37 | 38 | * Name: `build_gdp_ivi9` 39 | * Type: **Freestyle project** 40 | 41 | then click **OK**. Inside the project configuration page, add the following information: 42 | 43 | * Discard Old Builds: Yes 44 | - Strategy: Log Rotation 45 | - Days to keep build: (none) 46 | - Max # of builds to keep: 2 47 | * Source Code Management: Git 48 | - Repositories 49 | - Repository URL: `git://git.projects.genivi.org/genivi-demo-platform.git` 50 | - Credentials: - none - 51 | - Branches to build 52 | - Branch Specifier (blank for 'any'): `*/qemux86-64` 53 | - Repository browser: (Auto) 54 | * Build Environment 55 | - Build inside a Docker container: Yes 56 | - Docker image to use: Pull docker image from repository 57 | - Image id/tag: `gmacario/build-yocto-genivi` 58 | - Advanced... 59 | - force Pull: Yes 60 | - Verbose: Yes 61 | * Build 62 | - Execute shell 63 | - Command 64 | 65 | ``` 66 | #!/bin/bash -xe 67 | 68 | # DEBUG 69 | id 70 | pwd 71 | ls -la 72 | printenv | sort 73 | 74 | # Configure git 75 | git config --global user.name "easy-jenkins" 76 | git config --global user.email "$(whoami)@$(hostname)" 77 | 78 | # Configure the build 79 | source init.sh 80 | 81 | # Prevent error "Do not use Bitbake as root" 82 | [ $(whoami) = "root" ] && touch conf/sanity.conf 83 | 84 | # Perform the actual build 85 | bitbake genivi-demo-platform 86 | 87 | # EOF 88 | ``` 89 | 90 | * Post-build Actions 91 | - Archive the artifacts 92 | - Files to archive: `gdp-src-build/tmp/deploy/images/*/*.manifest` 93 | 94 | then click **Save**. 95 | 96 | ### Build project `build_gdp_ivi9` 97 | 98 | Browse `${JENKINS_URL}/job/GENIVI/job/build_gdp_ivi9/`, then click **Build Now**. 99 | 100 | You may watch the build logs at `${JENKINS_URL}/job/GENIVI/job/build_gdp_ivi9/lastBuild/console` 101 | 102 | 103 | 104 | ``` 105 | Started by user anonymous 106 | [EnvInject] - Loading node environment variables. 107 | Building in workspace /var/jenkins_home/workspace/GENIVI/build_gdp_ivi9 108 | Cloning the remote Git repository 109 | Cloning repository git://git.projects.genivi.org/genivi-demo-platform.git 110 | > git init /var/jenkins_home/workspace/GENIVI/build_gdp_ivi9 # timeout=10 111 | Fetching upstream changes from git://git.projects.genivi.org/genivi-demo-platform.git 112 | > git --version # timeout=10 113 | > git -c core.askpass=true fetch --tags --progress git://git.projects.genivi.org/genivi-demo-platform.git +refs/heads/*:refs/remotes/origin/* 114 | > git config remote.origin.url git://git.projects.genivi.org/genivi-demo-platform.git # timeout=10 115 | > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10 116 | > git config remote.origin.url git://git.projects.genivi.org/genivi-demo-platform.git # timeout=10 117 | Fetching upstream changes from git://git.projects.genivi.org/genivi-demo-platform.git 118 | > git -c core.askpass=true fetch --tags --progress git://git.projects.genivi.org/genivi-demo-platform.git +refs/heads/*:refs/remotes/origin/* 119 | > git rev-parse refs/remotes/origin/qemux86-64^{commit} # timeout=10 120 | > git rev-parse refs/remotes/origin/origin/qemux86-64^{commit} # timeout=10 121 | Checking out Revision efd5d1d8b43779d968541493fdc3a8f9c52509fc (refs/remotes/origin/qemux86-64) 122 | > git config core.sparsecheckout # timeout=10 123 | > git checkout -f efd5d1d8b43779d968541493fdc3a8f9c52509fc 124 | First time build. Skipping changelog. 125 | Pull Docker image gmacario/build-yocto-genivi from repository ... 126 | $ docker pull gmacario/build-yocto-genivi 127 | Using default tag: latest 128 | latest: Pulling from gmacario/build-yocto-genivi 129 | ... 130 | Parsing recipes: 100% || Time: 00:00:41 131 | 132 | Parsing of 1644 .bb files complete (0 cached, 1644 parsed). 2139 targets, 277 skipped, 0 masked, 0 errors. 133 | [1;29mNOTE[0m: [29mResolving any missing task queue dependencies[0m 134 | 135 | Build Configuration: 136 | BB_VERSION = "1.26.0" 137 | BUILD_SYS = "x86_64-linux" 138 | NATIVELSBSTRING = "Ubuntu-14.04" 139 | TARGET_SYS = "x86_64-poky-linux" 140 | MACHINE = "qemux86-64" 141 | DISTRO = "poky-ivi-systemd" 142 | DISTRO_VERSION = "9.0.1" 143 | TUNE_FEATURES = "m64 core2" 144 | TARGET_FPU = "" 145 | meta 146 | meta-yocto 147 | meta-yocto-bsp = "(detachedfrom900d7d6):900d7d6b59c36b2bdbd1c85febec99e80ab54f95" 148 | meta-ivi 149 | meta-ivi-bsp = "(detachedfromc6c4be2):c6c4be2e454545fd913ef39f5806990157e8d30a" 150 | meta-oe 151 | meta-filesystems 152 | meta-ruby = "(detachedfroma7c1a2b):a7c1a2b0e6947740758136216e45ca6ca66321fc" 153 | meta-qt5 = "(detachedfrom90919b9):90919b9d86988e7da01fa2c0a07246b5b5600a5d" 154 | meta-genivi-demo = "(detachedfrom8d73cb3):8d73cb3c2922fd4bb7040fb13094e4d7aff25272" 155 | meta-rust = "(detachedfromf13ac9d):f13ac9d48ae928b761d7be204fa8f877d41e7099" 156 | 157 | [1;29mNOTE[0m: [29mPreparing RunQueue[0m 158 | [1;29mNOTE[0m: [29mExecuting SetScene Tasks[0m 159 | [1;29mNOTE[0m: [29mExecuting RunQueue Tasks[0m 160 | No currently running tasks (1 of 4447) 161 | ... 162 | [42A[JCurrently 1 running tasks (4446 of 4447): 163 | 0: genivi-demo-platform-1.3+snapshot-20160422-r0 do_rootfs (pid 12904) 164 | [113A[JNo currently running tasks (4446 of 4447) 165 | [42A[J[1;29mNOTE[0m: [29mTasks Summary: Attempted 4447 tasks of which 22 didn't need to be rerun and all succeeded.[0m 166 | 167 | Summary: There were 14 WARNING messages shown. 168 | Stopping Docker container after build completion 169 | $ docker kill 0f46e6cbe3e2967ff03545042eea165ad1a32f041a3aaf116f8b30d4c4f4ab2b 170 | 0f46e6cbe3e2967ff03545042eea165ad1a32f041a3aaf116f8b30d4c4f4ab2b 171 | $ docker rm --force 0f46e6cbe3e2967ff03545042eea165ad1a32f041a3aaf116f8b30d4c4f4ab2b 172 | 0f46e6cbe3e2967ff03545042eea165ad1a32f041a3aaf116f8b30d4c4f4ab2b 173 | Archiving artifacts 174 | Notifying upstream projects of job completion 175 | Finished: SUCCESS 176 | ``` 177 | 178 | **NOTE**: A full build starting from an empty workspace takes about 6 hours to complete (Docker Engine running on a quad-core Intel(R) Xeon(TM) CPU X6550 @2.00GHz, 4 GB RAM + 16 GB swap). 179 | 180 | ![Artifacts of project build_gdp_ivi9](images/capture-20160423-0647.png) 181 | 182 | Browse `${JENKINS_URL}/job/GENIVI/job/build_gdp_ivi9/ws/gdp-src-build/tmp/deploy/images/qemux86-64/` to inspect the build results. 183 | 184 | ![Workspace of project build_gdp_ivi9](images/capture-20160423-0648.png) 185 | 186 | 187 | -------------------------------------------------------------------------------- /runme.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # ============================================================================= 3 | # Project: easy-jenkins 4 | # 5 | # Description: Top-level script to start the Docker containers 6 | # 7 | # Usage examples: 8 | # 9 | # 1. Create Docker machine with default configuration 10 | # $ ./runme.sh 11 | # 12 | # 2. Customize Docker machine VM configuration 13 | # $ VM=test-vm VM_NUM_CPUS=3 VM_MEM_SIZEMB=1024 VM_DISK_SIZEMB=10000 \ 14 | # ./runme.sh 15 | # ============================================================================= 16 | 17 | # ----------------------------------------------------------------------------- 18 | # Check version "maj.min.pat" 19 | # 20 | # Parameters: 21 | # * have_maj_min_pat: Installed version - example: "0.5.6" 22 | # * want_maj_min_pat: Required version - example: "0.6.0" 23 | # 24 | # Return: 25 | # * 0 if installed version is >= than required version 26 | # * 1 otherwise 27 | # 28 | is_version_ok () { 29 | result=1 30 | # echo "DEBUG: line $LINENO: is_version_ok(have_maj_min_pat=$1, want_maj_min_pat=$2)" 31 | 32 | have_maj=$(echo $1 | sed -e 's/\..*//') 33 | have_min_pat=$(echo $1 | sed -e 's/^[0-9]*\.//') 34 | have_min=$(echo $have_min_pat | sed -e 's/\..*//') 35 | have_pat=$(echo $have_min_pat | sed -e 's/^[0-9]*\.//') 36 | # echo "DEBUG: line $LINENO: have_maj=$have_maj, have_min=$have_min, have_pat=$have_pat" 37 | 38 | want_maj=$(echo $2 | sed -e 's/\..*//') 39 | want_min_pat=$(echo $2 | sed -e 's/^[0-9]*\.//') 40 | want_min=$(echo $want_min_pat | sed -e 's/\..*//') 41 | want_pat=$(echo $want_min_pat | sed -e 's/^[0-9]*\.//') 42 | # echo "DEBUG: line $LINENO: want_maj=$want_maj, want_min=$have_min, want_pat=$want_pat" 43 | 44 | if [ $have_maj -gt $want_maj ]; then 45 | # echo "DEBUG: line $LINENO: Case have_maj $have_maj > $want_maj ==> OK" 46 | result=0 47 | elif [ $have_maj -eq $want_maj ]; then 48 | # echo "DEBUG: line $LINENO: Case have_maj $have_maj == $want_maj" 49 | if [ $have_min -gt $want_min ]; then 50 | # echo "DEBUG: line $LINENO: Case have_min $have_min > $want_min ==> OK" 51 | result=0 52 | elif [ $have_min -eq $want_min ]; then 53 | # echo "DEBUG: line $LINENO: Case have_min $have_min == 5" 54 | if [ $have_pat -ge $want_pat ]; then 55 | # echo "DEBUG: line $LINENO: Case have_pat $have_pat >= $want_pat ==> OK" 56 | result=0 57 | fi 58 | fi 59 | fi 60 | # echo "DEBUG: line $LINENO: Return result=$result" 61 | return $result 62 | } 63 | 64 | # ----------------------------------------------------------------------------- 65 | 66 | set -e 67 | 68 | # docker-machine 69 | if ! which docker-machine >/dev/null; then 70 | echo "WARNING: Cannot find docker-machine - assuming environment variables are already defined" 71 | USE_DOCKER_MACHINE=false 72 | fi 73 | 74 | if [[ "${VM}" = "" ]]; then 75 | # If VM is not defined, try setting it to active docker-machine 76 | # otherwise just pick a default name 77 | if ${USE_DOCKER_MACHINE}; then 78 | VM=$(docker-machine active) || VM=easy-jenkins 79 | fi 80 | fi 81 | [[ "${VM_NUM_CPUS}" = "" ]] && VM_NUM_CPUS=2 82 | [[ "${VM_MEM_SIZEMB}" = "" ]] && VM_MEM_SIZEMB=2048 83 | [[ "${VM_DISK_SIZEMB}" = "" ]] && VM_DISK_SIZEMB=50000 84 | [[ "${USE_DOCKER_MACHINE}" = "" ]] && USE_DOCKER_MACHINE=true 85 | 86 | # Check prerequisites 87 | 88 | # docker-machine 89 | if ${USE_DOCKER_MACHINE}; then 90 | result=$(docker-machine --version) 91 | # echo "DEBUG: line $LINENO: result=$result" 92 | have_maj_min_pat=$(echo $result | sed -e 's/^.*version //' | sed -e 's/\,.*$//') 93 | # echo "DEBUG: line $LINENO: have_maj_min_pat=$have_maj_min_pat" 94 | want_maj_min_pat="0.6.0" 95 | # echo "DEBUG: line $LINENO: want_maj_min_pat=$want_maj_min_pat" 96 | if ! is_version_ok $have_maj_min_pat $want_maj_min_pat; then 97 | echo "ERROR: Should install docker-machine >= $want_maj_min_pat (have $have_maj_min_pat)" 98 | exit 1 99 | fi 100 | fi # if ${USE_DOCKER_MACHINE} 101 | 102 | # docker 103 | if ! which docker >/dev/null; then 104 | echo "ERROR: Cannot find docker - Please see https://docs.docker.com/engine/installation/" 105 | exit 1 106 | fi 107 | result=$(docker --version) 108 | # echo "DEBUG: line $LINENO: result=$result" 109 | have_maj_min_pat=$(echo $result | sed -e 's/^.*version //' | sed -e 's/\,.*$//') 110 | # echo "DEBUG: line $LINENO: have_maj_min_pat=$have_maj_min_pat" 111 | want_maj_min_pat="18.02.0" 112 | # echo "DEBUG: line $LINENO: want_maj_min_pat=$want_maj_min_pat" 113 | if ! is_version_ok $have_maj_min_pat $want_maj_min_pat; then 114 | echo "ERROR: Should install docker >= $want_maj_min_pat (have $have_maj_min_pat)" 115 | exit 1 116 | fi 117 | 118 | # docker-compose 119 | if ! which docker-compose >/dev/null; then 120 | echo "ERROR: Cannot find docker-compose - Please see https://docs.docker.com/compose/install/" 121 | exit 1 122 | fi 123 | result=$(docker-compose --version) 124 | # echo "DEBUG: line $LINENO: result=$result" 125 | have_maj_min_pat=$(echo $result | sed -e 's/^.*version //' | sed -e 's/\,.*$//') 126 | # echo "DEBUG: line $LINENO: have_maj_min_pat=$have_maj_min_pat" 127 | want_maj_min_pat="1.18.0" 128 | # echo "DEBUG: line $LINENO: want_maj_min_pat=$want_maj_min_pat" 129 | if ! is_version_ok $have_maj_min_pat $want_maj_min_pat; then 130 | echo "ERROR: Should install docker-compose >= $want_maj_min_pat (have $have_maj_min_pat)" 131 | exit 1 132 | fi 133 | 134 | if ${USE_DOCKER_MACHINE}; then 135 | result=$(docker-machine --version) 136 | # echo "DEBUG: line $LINENO: result=$result" 137 | have_maj_min_pat=$(echo $result | sed -e 's/^.*version //' | sed -e 's/\,.*$//') 138 | # echo "DEBUG: line $LINENO: have_maj_min_pat=$have_maj_min_pat" 139 | want_maj_min_pat="0.6.0" 140 | # echo "DEBUG: line $LINENO: want_maj_min_pat=$want_maj_min_pat" 141 | if ! is_version_ok $have_maj_min_pat $want_maj_min_pat; then 142 | echo "ERROR: Should install docker-machine >= $want_maj_min_pat (have $have_maj_min_pat)" 143 | exit 1 144 | fi 145 | 146 | # docker-machine ls 147 | if docker-machine ls | grep -w ${VM} >/dev/null; then 148 | echo "INFO: Docker machine ${VM} exists, skipping docker-machine create" 149 | else 150 | echo "INFO: Creating VirtualBox VM ${VM} (cpu:${VM_NUM_CPUS}, memory:${VM_MEM_SIZEMB} MB, disk:${VM_DISK_SIZEMB} MB)" 151 | docker-machine create --driver virtualbox \ 152 | --virtualbox-cpu-count "${VM_NUM_CPUS}" \ 153 | --virtualbox-memory "${VM_MEM_SIZEMB}" \ 154 | --virtualbox-disk-size "${VM_DISK_SIZEMB}" \ 155 | ${VM} 156 | fi 157 | echo "INFO: Using Docker machine ${VM}" 158 | if docker-machine status ${VM} | grep -v Running >/dev/null; then 159 | docker-machine start ${VM} 160 | fi 161 | 162 | # docker-machine env ${VM} 163 | eval $(docker-machine env ${VM}) 164 | fi # if ${USE_DOCKER_MACHINE} ... 165 | 166 | if [ "${CASC_JENKINS_CONFIG}" = "" ]; then 167 | CASC_JENKINS_CONFIG="casc_configs/$(hostname).yaml" 168 | if [ ! -e "${CASC_JENKINS_CONFIG}" ]; then 169 | echo "WARNING: Could not find ${CASC_JENKINS_CONFIG} -- using default" 170 | CASC_JENKINS_CONFIG="casc_configs/default.yaml" 171 | fi 172 | export CASC_JENKINS_CONFIG="/var/jenkins_home/${CASC_JENKINS_CONFIG}" 173 | fi 174 | echo "DEBUG: CASC_JENKINS_CONFIG=${CASC_JENKINS_CONFIG}" 175 | 176 | # echo "DEBUG: Inspecting environment variables" 177 | # printenv | sort 178 | 179 | if [ ! -e "secrets/adminpw" ]; then 180 | echo "WARNING: Cannot find file secrets/adminpw - Creating it" 181 | INITIAL_PASS="Ver!s4cr4tpa55wd" 182 | mkdir -p secrets 183 | echo "${INITIAL_PASS}" > secrets/adminpw 184 | echo "INFO: Initial Jenkins admin password: ${INITIAL_PASS}" 185 | fi 186 | 187 | docker-compose up -d 188 | 189 | # Wait a reasonable time to make sure initialAdminPassword is generated 190 | sleep 30 191 | 192 | if ${USE_DOCKER_MACHINE}; then 193 | echo "INFO: Run the following command to configure your shell:" 194 | echo "INFO: eval \$(docker-machine env ${VM})" 195 | echo "INFO: Browse http://$(docker-machine ip ${VM}):9080/ to access the Jenkins dashboard" 196 | fi # if ${USE_DOCKER_MACHINE} ... 197 | 198 | INITIAL_PASS=$(docker-compose exec -T myjenkins sh -c \ 199 | "[ -e /var/jenkins_home/secrets/initialAdminPassword ] && cat /var/jenkins_home/secrets/initialAdminPassword") 200 | 201 | if [ "${INITIAL_PASS}" != "" ]; then 202 | echo "INFO: Initial Jenkins admin password: ${INITIAL_PASS}" 203 | fi 204 | 205 | # EOF 206 | -------------------------------------------------------------------------------- /docs/building-gdp.md: -------------------------------------------------------------------------------- 1 | # Building GDP for qemux86-64 using easy-jenkins 2 | 3 | 4 | 5 | This document explains how to build from sources the [GENIVI Development Platform](https://at.projects.genivi.org/wiki/x/aoCw) using [Jenkins](https://jenkins.io/). 6 | 7 | The actual build is executed inside a [Docker custom build environment](https://wiki.jenkins-ci.org/display/JENKINS/CloudBees+Docker+Custom+Build+Environment+Plugin) which is automatically spun by the Jenkins server. 8 | 9 | The following instructions have been tested on: 10 | 11 | * Docker client: itm-gmacario-w7 (MS Windows 7 64-bit, Docker Toolbox 1.11.0) 12 | * Docker engine: alm-gm-ubu15.alm.mentorg.com (Ubuntu 14.04.4 LTS 64-bit, Docker 1.11.2, Docker Compose 1.6.2) 13 | 14 | ## Preparation 15 | 16 | * Install and configure [easy-jenkins](https://github.com/gmacario/easy-jenkins) - please refer to [preparation.md](https://github.com/gmacario/easy-jenkins/blob/master/docs/preparation.md) for details. 17 | * Verify that the Jenkins Dashboard is accessible at `${DOCKER_URL}` (example: http://192.168.99.100:9080/) 18 | 19 | ## Step-by-step instructions 20 | 21 | ### Create folder `GENIVI` 22 | 23 | Browse `${DOCKER_URL}`, then click **New Item** 24 | 25 | * Name: `GENIVI` 26 | * Type: **Folder** 27 | 28 | then click **OK**. Inside the project configuration page, review configuration, then click **OK**. 29 | 30 | ### Create project `build_gdp` 31 | 32 | 33 | 34 | Browse `${DOCKER_URL}/job/GENIVI`, then click **New Item** 35 | 36 | * Name: `build_gdp` 37 | * Type: **Freestyle project** 38 | 39 | then click **OK**. Inside the project configuration page, add the following information: 40 | 41 | * Discard Old Builds: Yes 42 | - Strategy: Log Rotation 43 | - Days to keep build: (none) 44 | - Max # of builds to keep: 2 45 | * Source Code Management: Git 46 | - Repositories 47 | - Repository URL: `https://github.com/GENIVI/genivi-dev-platform.git` 48 | - Credentials: - none - 49 | - Branches to build 50 | - Branch Specifier (blank for 'any'): `*/master` 51 | - Repository browser: (Auto) 52 | * Build Environment 53 | - Build inside a Docker container: Yes 54 | - Docker image to use: Pull docker image from repository 55 | - Image id/tag: `gmacario/build-yocto` 56 | - Advanced... 57 | - force Pull: Yes 58 | - Verbose: Yes 59 | * Build 60 | - Execute shell 61 | - Command 62 | 63 | ``` 64 | #!/bin/bash -xe 65 | 66 | # DEBUG 67 | id 68 | pwd 69 | ls -la 70 | printenv | sort 71 | 72 | # Configure git 73 | git config --global user.name "easy-jenkins" 74 | git config --global user.email "$(whoami)@$(hostname)" 75 | 76 | # Configure the build 77 | source init.sh qemux86-64 78 | 79 | # Prevent error "Do not use Bitbake as root" 80 | [ $(whoami) = "root" ] && touch conf/sanity.conf 81 | 82 | # Perform the actual build 83 | bitbake genivi-dev-platform 84 | 85 | # TODO: bitbake genivi-dev-platform-sdk 86 | 87 | # EOF 88 | ``` 89 | 90 | * Post-build Actions 91 | - Archive the artifacts 92 | - Files to archive: `gdp-src-build/tmp/deploy/images/*/*.manifest` 93 | 94 | then click **Save**. 95 | 96 | ### Build project `build_gdp` 97 | 98 | Browse `${JENKINS_URL}/job/GENIVI/job/build_gdp/`, then click **Build Now**. 99 | 100 | You may watch the build logs at `${JENKINS_URL}/job/GENIVI/job/build_gdp/lastBuild/console` 101 | 102 | 103 | 104 | ``` 105 | Started by user anonymous 106 | [EnvInject] - Loading node environment variables. 107 | Building in workspace /var/jenkins_home/workspace/GENIVI/build_gdp 108 | Cloning the remote Git repository 109 | Cloning repository https://github.com/GENIVI/genivi-dev-platform.git 110 | > git init /var/jenkins_home/workspace/GENIVI/build_gdp # timeout=10 111 | Fetching upstream changes from https://github.com/GENIVI/genivi-dev-platform.git 112 | > git --version # timeout=10 113 | > git -c core.askpass=true fetch --tags --progress https://github.com/GENIVI/genivi-dev-platform.git +refs/heads/*:refs/remotes/origin/* 114 | > git config remote.origin.url https://github.com/GENIVI/genivi-dev-platform.git # timeout=10 115 | > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10 116 | > git config remote.origin.url https://github.com/GENIVI/genivi-dev-platform.git # timeout=10 117 | Fetching upstream changes from https://github.com/GENIVI/genivi-dev-platform.git 118 | > git -c core.askpass=true fetch --tags --progress https://github.com/GENIVI/genivi-dev-platform.git +refs/heads/*:refs/remotes/origin/* 119 | > git rev-parse refs/remotes/origin/master^{commit} # timeout=10 120 | > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10 121 | Checking out Revision b173a7941f1fa18fee03b4140b047c46f8c83fb0 (refs/remotes/origin/master) 122 | > git config core.sparsecheckout # timeout=10 123 | > git checkout -f b173a7941f1fa18fee03b4140b047c46f8c83fb0 124 | First time build. Skipping changelog. 125 | Pull Docker image gmacario/build-yocto from repository ... 126 | $ docker pull gmacario/build-yocto 127 | Unable to find image 'alpine:3.2' locally 128 | 3.2: Pulling from library/alpine 129 | bfc185be0245: Pulling fs layer 130 | bfc185be0245: Download complete 131 | bfc185be0245: Pull complete 132 | Digest: sha256:9c6c40abb6a9180603068a413deca450ef13c381974b392a25af948ca87c3c14 133 | Status: Downloaded newer image for alpine:3.2 134 | Docker container 6b2027bdf3364402d2cfa3262e2454181e60dc86a9d7c1787dbbd1d0537ff729 started to host the build 135 | $ docker exec --tty 6b2027bdf3364402d2cfa3262e2454181e60dc86a9d7c1787dbbd1d0537ff729 env 136 | [build_gdp] $ docker exec --tty --user 1000:1000 6b2027bdf3364402d2cfa3262e2454181e60dc86a9d7c1787dbbd1d0537ff729 env 'BASH_FUNC_copy_reference_file%%=() { f="${1%/}"; 137 | b="${f%.override}"; 138 | echo "$f" >> "$COPY_REFERENCE_FILE_LOG"; 139 | rel="${b:23}"; 140 | dir=$(dirname "${b}"); 141 | echo " $f -> $rel" >> "$COPY_REFERENCE_FILE_LOG"; 142 | if [[ ! -e $JENKINS_HOME/${rel} || $f = *.override ]]; then 143 | echo "copy $rel to JENKINS_HOME" >> "$COPY_REFERENCE_FILE_LOG"; 144 | mkdir -p "$JENKINS_HOME/${dir:23}"; 145 | cp -r "${f}" "$JENKINS_HOME/${rel}"; 146 | [[ ${rel} == plugins/*.jpi ]] && touch "$JENKINS_HOME/${rel}.pinned"; 147 | fi 148 | }' BUILD_CAUSE=MANUALTRIGGER BUILD_CAUSE_MANUALTRIGGER=true BUILD_DISPLAY_NAME=#1 BUILD_ID=1 BUILD_NUMBER=1 BUILD_TAG=jenkins-GENIVI-build_gdp-1 CA_CERTIFICATES_JAVA_VERSION=20140324 CLASSPATH= COPY_REFERENCE_FILE_LOG=/var/jenkins_home/copy_reference_file.log EXECUTOR_NUMBER=1 GIT_BRANCH=origin/master GIT_COMMIT=b173a7941f1fa18fee03b4140b047c46f8c83fb0 GIT_URL=https://github.com/GENIVI/genivi-dev-platform.git HOME=/var/jenkins_home HOSTNAME=997b00299e13 HUDSON_HOME=/var/jenkins_home HUDSON_SERVER_COOKIE=718d63cf95036d01 JAVA_DEBIAN_VERSION=8u91-b14-1~bpo8+1 JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 JAVA_VERSION=8u91 JENKINS_HOME=/var/jenkins_home JENKINS_SERVER_COOKIE=718d63cf95036d01 JENKINS_SHA=35dcb66a4f4d43d9cbbb8109e57b079e1292ff5e JENKINS_SLAVE_AGENT_PORT=50000 JENKINS_UC=https://updates.jenkins.io JENKINS_VERSION=2.11 JOB_BASE_NAME=build_gdp JOB_NAME=GENIVI/build_gdp LANG=C.UTF-8 NODE_LABELS=master NODE_NAME=master PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PWD=/ ROOT_BUILD_CAUSE=MANUALTRIGGER ROOT_BUILD_CAUSE_MANUALTRIGGER=true SHLVL=2 TERM=xterm TINI_SHA=fa23d1e20732501c3bb8eeeca423c89ac80ed452 TINI_VERSION=0.9.0 WORKSPACE=/var/jenkins_home/workspace/GENIVI/build_gdp /bin/bash -xe /tmp/hudson4625947790545199077.sh 149 | + id 150 | uid=1000(jenkins) gid=1000(jenkins) groups=1000(jenkins) 151 | + pwd 152 | /var/jenkins_home/workspace/GENIVI/build_gdp 153 | ... 154 | Parsing of 1732 .bb files complete (0 cached, 1732 parsed). 2291 targets, 328 skipped, 0 masked, 0 errors. 155 | NOTE: Resolving any missing task queue dependencies 156 | 157 | Build Configuration: 158 | BB_VERSION = "1.28.0" 159 | BUILD_SYS = "x86_64-linux" 160 | NATIVELSBSTRING = "Ubuntu-14.04" 161 | TARGET_SYS = "x86_64-poky-linux" 162 | MACHINE = "qemux86-64" 163 | DISTRO = "poky-ivi-systemd" 164 | DISTRO_VERSION = "10.0.0" 165 | TUNE_FEATURES = "m64 core2" 166 | TARGET_FPU = "" 167 | meta 168 | meta-yocto 169 | meta-yocto-bsp = "HEAD:fc45deac89ef63ca1c44e763c38ced7dfd72cbe1" 170 | meta-ivi 171 | meta-ivi-bsp = "HEAD:9d72380c1d50d0c3469b85c3a43fe612b5ee1dd9" 172 | meta-oe 173 | meta-filesystems 174 | meta-ruby = "HEAD:ad6133a2e95f4b83b6b3ea413598e2cd5fb3fd90" 175 | meta-qt5 = "HEAD:ea37a0bc987aa9484937ad68f762b4657c198617" 176 | meta-genivi-dev = "HEAD:94dce439766f04d80abbf0fec88cfa07800a3573" 177 | meta-rust = "HEAD:f13ac9d48ae928b761d7be204fa8f877d41e7099" 178 | meta-oic = "HEAD:69146eaf8bc05c74c377e731b7e16d82854a4659" 179 | meta-erlang = "HEAD:4d7eacc8e6593934ed5b0c8abc3d3e9dc339d849" 180 | meta-rvi = "HEAD:de9d548fe35e2cee8688faaae910b4f6f7fea17e" 181 | 182 | NOTE: Preparing RunQueue 183 | NOTE: Executing SetScene Tasks 184 | NOTE: Executing RunQueue Tasks 185 | ... 186 | Currently 1 running tasks (4784 of 4785): 187 | 0: genivi-dev-platform-1.3+snapshot-20160706-r0 do_rootfs (pid 5193) 188 | No currently running tasks (4784 of 4785) 189 | NOTE: Tasks Summary: Attempted 4785 tasks of which 33 didn't need to be rerun and all succeeded. 190 | 191 | Summary: There were 6 WARNING messages shown. 192 | Stopping Docker container after build completion 193 | Archiving artifacts 194 | Notifying upstream projects of job completion 195 | Finished: SUCCESS 196 | ``` 197 | 198 | **NOTE**: A full build starting from an empty workspace takes about 6 hours to complete (Docker Engine running on a quad-core Intel(R) Xeon(TM) CPU X6550 @2.00GHz, 4 GB RAM + 16 GB swap). 199 | 200 | ![Artifacts of project build_gdp](images/capture-20160707-0933.png) 201 | 202 | Browse `${JENKINS_URL}/job/GENIVI/job/build_gdp/ws/gdp-src-build/tmp/deploy/images/qemux86-64/` to inspect the build results. 203 | 204 | ![Workspace of project build_gdp_ivi9](images/capture-20160707-0934.png) 205 | 206 | 207 | -------------------------------------------------------------------------------- /docs/building-android-udooneo.md: -------------------------------------------------------------------------------- 1 | # Building an Android 5.1.1 image for the UDOO Neo 2 | 3 | **WORK-IN-PROGRESS** 4 | 5 | This document explains how to build from sources an [Android](https://source.android.com/) image for the [UDOO Neo](http://www.udoo.org/udoo-neo/) using [easy-jenkins](https://github.com/gmacario/easy-jenkins). 6 | 7 | The following instructions were tested on 8 | 9 | * Docker client: mac-tizy (HW: MacBook Pro; SW: OS X 10.11.3, Docker Toolbox 10.0) 10 | * Docker engine: mv-linux-powerhorse (HW: HP xw8600 Workstation, SW: Ubuntu 14.04.4 LTS 64-bit, Docker 1.10.3) 11 | 12 | ## Preparation 13 | 14 | * Install and configure easy-jenkins - please refer to [preparation.md](https://github.com/gmacario/easy-jenkins/blob/master/docs/preparation.md) for details. 15 | * Verify that the Jenkins Dashboard is accessible at `${DOCKER_URL}` (example: http://192.168.99.100:9080/) 16 | 17 | ## Step-by-step instructions 18 | 19 | ### Configure project `build_android_udooneo` 20 | 21 | Browse `${JENKINS_URL}`, then click **New Item** 22 | - Item name: `build_android_udooneo` 23 | - Type: **Freestyle project** 24 | 25 | then click **OK**. 26 | 27 | Inside the project configuration page, fill-in the following information: 28 | - Discard Old Builds: Yes 29 | - Strategy: Log Rotation 30 | - Days to keep builds: (none) 31 | - Max # of builds to keep: 2 32 | - Source Code Management: None 33 | - Build Environment 34 | - Build inside a Docker container: Yes 35 | - Docker image to use: Pull docker image from repository 36 | - Image id/tag: `gmacario/build-aosp` 37 | - Advanced... 38 | - force Pull: Yes 39 | - Build 40 | - Execute shell 41 | - Command 42 | 43 | ``` 44 | #!/bin/bash -xe 45 | 46 | # DEBUG 47 | id 48 | pwd 49 | ls -la 50 | printenv | sort 51 | cat /etc/passwd 52 | 53 | # Global configs (required by repo) 54 | git config --global user.name "easy-jenkins" 55 | git config --global user.email "jenkins@${HOSTNAME}" 56 | git config --global color.ui auto 57 | 58 | # From https://source.android.com/source/downloading.html 59 | repo init -u https://github.com/UDOOboard/android_udoo_platform_manifest -b android-5.1.1 60 | repo sync --force-sync 61 | 62 | # Workaround for https://github.com/gmacario/easy-jenkins/issues/85 63 | export WITHOUT_HOST_CLANG=true 64 | 65 | # From README_compile_Android.txt 66 | source build/envsetup.sh 67 | lunch udooneo_6sx-eng 68 | make -j 8 69 | ./prepare_distro.sh 70 | 71 | # EOF 72 | ``` 73 | - Post-build Actions 74 | - Archive the artifacts 75 | - Files to archive: `out/TODO` 76 | 77 | then click **Save** 78 | 79 | ### Build project `build_android_udooneo` 80 | 81 | Browse `${JENKINS_URL}/job/build_android_udooneo`, then click **Build Now** 82 | 83 | You may watch the build logs at `${JENKINS_URL}/job/build_android_udooneo/lastBuild/console` 84 | 85 | 86 | 87 | ``` 88 | Started by user anonymous 89 | [EnvInject] - Loading node environment variables. 90 | Building in workspace /var/jenkins_home/jobs/build_android_udooneo/workspace 91 | Pull Docker image gmacario/build-aosp:feat-aosp-uboottools from repository ... 92 | $ docker pull gmacario/build-aosp:feat-aosp-uboottools 93 | Docker container 979360a119f5cb28ef5d82654e642a7fef8076b1d0e65e4ac0f4f7a22d66614e started to host the build 94 | $ docker exec --tty 979360a119f5cb28ef5d82654e642a7fef8076b1d0e65e4ac0f4f7a22d66614e env 95 | ... 96 | + make -j 8 97 | ++ date +%s 98 | + local start_time=1458145403 99 | ++ get_make_command 100 | ++ echo command make 101 | + command make -j 8 102 | + make -j 8 103 | ============================================ 104 | PLATFORM_VERSION_CODENAME=REL 105 | PLATFORM_VERSION=5.1.1 106 | TARGET_PRODUCT=udooneo_6sx 107 | TARGET_BUILD_VARIANT=eng 108 | TARGET_BUILD_TYPE=release 109 | TARGET_BUILD_APPS= 110 | TARGET_ARCH=arm 111 | TARGET_ARCH_VARIANT=armv7-a-neon 112 | TARGET_CPU_VARIANT=cortex-a9 113 | TARGET_2ND_ARCH= 114 | TARGET_2ND_ARCH_VARIANT= 115 | TARGET_2ND_CPU_VARIANT= 116 | HOST_ARCH=x86_64 117 | HOST_OS=linux 118 | HOST_OS_EXTRA=Linux-3.13.0-79-generic-x86_64-with-Ubuntu-16.04-xenial 119 | HOST_BUILD_TYPE=release 120 | BUILD_ID=2.1.0-ga-rc3 121 | OUT_DIR=out 122 | ============================================ 123 | including ./abi/cpp/Android.mk ... 124 | ... 125 | including ./tools/external/fat32lib/Android.mk ... 126 | No private recovery resources for TARGET_DEVICE udooneo_6sx 127 | build/core/main.mk:1056: warning: overriding recipe for target 'clean' 128 | external/tools/iw/Makefile:126: warning: ignoring old recipe for target 'clean' 129 | host Executable: validatekeymaps (out/host/linux-x86/obj32/EXECUTABLES/validatekeymaps_intermediates/validatekeymaps) 130 | host Executable: acp (out/host/linux-x86/obj32/EXECUTABLES/acp_intermediates/acp) 131 | mkdir -p out/target/product/udooneo_6sx/obj/KERNEL_OBJ 132 | for ubootplat in imx6sx:udoo_neo_android_defconfig; do \ 133 | UBOOT_PLATFORM=`echo $ubootplat | cut -d':' -f1`; \ 134 | UBOOT_CONFIG=`echo $ubootplat | cut -d':' -f2`; \ 135 | UBOOT_DIR="bootable/bootloader/uboot-imx"; \ 136 | echo ; \ 137 | echo ; \ 138 | make -C $UBOOT_DIR distclean ARCH=arm CROSS_COMPILE=`pwd`/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-; \ 139 | make -C $UBOOT_DIR $UBOOT_CONFIG ARCH=arm CROSS_COMPILE=`pwd`/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-; \ 140 | make -C $UBOOT_DIR ARCH=arm CROSS_COMPILE=`pwd`/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-; \ 141 | dd if=$UBOOT_DIR/SPL of=$UBOOT_DIR/u-boot.imx bs=1K seek=0 conv=notrunc; \ 142 | dd if=$UBOOT_DIR/u-boot.img of=$UBOOT_DIR/u-boot.imx bs=1K seek=68; \ 143 | install -D $UBOOT_DIR/u-boot.imx out/target/product/udooneo_6sx/u-boot-$UBOOT_PLATFORM.imx; \ 144 | done 145 | rm -f out/target/product/udooneo_6sx/kernel 146 | 147 | 148 | host StaticLib: libziparchive-host_32 (out/host/linux-x86/obj32/STATIC_LIBRARIES/libziparchive-host_intermediates/libziparchive-host.a) 149 | make -C kernel_imx udoo_neo_android_defconfig ARCH=arm CROSS_COMPILE=`pwd`/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi- LOADADDR=0x80008000 O=`pwd`/out/target/product/udooneo_6sx/obj/KERNEL_OBJ 150 | CLEAN examples/standalone 151 | host StaticLib: libzipfile_32 (out/host/linux-x86/obj32/STATIC_LIBRARIES/libzipfile_intermediates/libzipfile.a) 152 | CLEAN tools 153 | CLEAN tools/lib tools/common 154 | CLEAN scripts/basic 155 | CLEAN scripts/kconfig 156 | CLEAN spl/arch spl/board spl/common spl/drivers spl/fs spl/lib spl/u-boot-spl spl/u-boot-spl.bin spl/u-boot-spl.lds spl/u-boot-spl.map 157 | host SharedLib: libunwind-ptrace_32 (out/host/linux-x86/obj32/lib/libunwind-ptrace.so) 158 | GEN /var/jenkins_home/jobs/build_android_udooneo/workspace/out/target/product/udooneo_6sx/obj/KERNEL_OBJ/Makefile 159 | CLEAN u-boot.lds u-boot.map u-boot.imx u-boot.bin u-boot.srec u-boot u-boot.img SPL System.map 160 | preparing StaticLib: libunwindbacktrace_32 [including out/host/linux-x86/obj32/STATIC_LIBRARIES/libunwind_intermediates/libunwind.a] 161 | CLEAN include/config include/generated spl 162 | CLEAN .config include/autoconf.mk include/autoconf.mk.dep include/config.h 163 | host StaticLib: libLLVMSupport_32 (out/host/linux-x86/obj32/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport.a) 164 | host StaticLib: libbccRenderscript_32 (out/host/linux-x86/obj32/STATIC_LIBRARIES/libbccRenderscript_intermediates/libbccRenderscript.a) 165 | HOSTCC scripts/basic/fixdep 166 | host StaticLib: libbccExecutionEngine_32 (out/host/linux-x86/obj32/STATIC_LIBRARIES/libbccExecutionEngine_intermediates/libbccExecutionEngine.a) 167 | host StaticLib: libbccCore_32 (out/host/linux-x86/obj32/STATIC_LIBRARIES/libbccCore_intermediates/libbccCore.a) 168 | host StaticLib: libunwindbacktrace_32 (out/host/linux-x86/obj32/STATIC_LIBRARIES/libunwindbacktrace_intermediates/libunwindbacktrace.a) 169 | # 170 | # configuration written to .config 171 | # 172 | make -C kernel_imx -j8 prepare ARCH=arm CROSS_COMPILE=`pwd`/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi- LOADADDR=0x80008000 O=`pwd`/out/target/product/udooneo_6sx/obj/KERNEL_OBJ 173 | make[1]: warning: -jN forced in submake: disabling jobserver mode. 174 | host StaticLib: libbccSupport_32 (out/host/linux-x86/obj32/STATIC_LIBRARIES/libbccSupport_intermediates/libbccSupport.a) 175 | HOSTCC scripts/kconfig/conf.o 176 | SHIPPED scripts/kconfig/zconf.hash.c 177 | SHIPPED scripts/kconfig/zconf.tab.c 178 | SHIPPED scripts/kconfig/zconf.lex.c 179 | host StaticLib: librsloader_32 (out/host/linux-x86/obj32/STATIC_LIBRARIES/librsloader_intermediates/librsloader.a) 180 | host C++: dalvikvm_32 <= art/dalvikvm/dalvikvm.cc 181 | if [ ! -e include/config/auto.conf ]; then make -f /var/jenkins_home/jobs/build_android_udooneo/workspace/kernel_imx/Makefile silentoldconfig ; fi 182 | CHK include/config/kernel.release 183 | GEN /var/jenkins_home/jobs/build_android_udooneo/workspace/out/target/product/udooneo_6sx/obj/KERNEL_OBJ/Makefile 184 | HOSTCC scripts/kconfig/zconf.tab.o 185 | CHK include/generated/uapi/linux/version.h 186 | host SharedLib: libnativehelper_32 (out/host/linux-x86/obj32/lib/libnativehelper.so) 187 | prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6//x86_64-linux/bin/ld: error: out/host/linux-x86/obj32/SHARED_LIBRARIES/libnativehelper_intermediates/JNIHelp.o: unsupported reloc 43 against global symbol std::string::_Rep::_S_empty_rep_storage 188 | prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6//x86_64-linux/bin/ld: error: out/host/linux-x86/obj32/SHARED_LIBRARIES/libnativehelper_intermediates/JNIHelp.o: unsupported reloc 43 against global symbol std::string::_Rep::_S_empty_rep_storage 189 | prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6//x86_64-linux/bin/ld: error: out/host/linux-x86/obj32/SHARED_LIBRARIES/libnativehelper_intermediates/JNIHelp.o: unsupported reloc 43 against global symbol std::string::_Rep::_S_empty_rep_storage 190 | prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6//x86_64-linux/bin/ld: error: out/host/linux-x86/obj32/SHARED_LIBRARIES/libnativehelper_intermediates/JNIHelp.o: unsupported reloc 43 against global symbol std::string::_Rep::_S_empty_rep_storage 191 | ... 192 | OBJCOPY spl/u-boot-spl.bin 193 | CFGS arch/arm/imx-common/spl_sd.cfg.cfgtmp 194 | MKIMAGE SPL 195 | 31+0 records in 196 | 31+0 records out 197 | 31744 bytes (32 kB, 31 KiB) copied, 0.000231922 s, 137 MB/s 198 | 256+1 records in 199 | 256+1 records out 200 | 262896 bytes (263 kB, 257 KiB) copied, 0.00121776 s, 216 MB/s 201 | make: *** wait: No child processes. Stop. 202 | Build step 'Execute shell' marked build as failure 203 | Stopping Docker container after build completion 204 | Notifying upstream projects of job completion 205 | Finished: FAILURE 206 | ``` 207 | 208 | **TODO**: Install tool `mkimage` in Docker image `gmacario/build-aosp` - See https://github.com/gmacario/easy-build/pull/229 209 | -------------------------------------------------------------------------------- /docs/building-capic-native.md: -------------------------------------------------------------------------------- 1 | # Building GENIVI Common API C in Jenkins 2 | 3 | **Updated for CAPIC PoC Release 0.2.1** 4 | 5 | ## Prerequisites 6 | 7 | * A recent version of [Jenkins](https://jenkins.io/) CI/CD installed together with the necessary plugins 8 | - Tested with https://github.com/gmacario/easy-jenkins 9 | * An Internet browser able to access the Jenkins dashboard at `${JENKINS_URL}` 10 | - Example: http://192.168.99.100:9080/ 11 | 12 | ## Step-by-step instructions 13 | 14 | ### Create folder `GENIVI` 15 | 16 | Browse `${JENKINS_URL}`, then click **New Item** 17 | 18 | * Name: `GENIVI` 19 | * Type: **Folder** 20 | 21 | then click **OK**. Inside the project configuration page, review configuration, then click **OK**. 22 | 23 | ### Create project `common-api-c` 24 | 25 | Browse `${JENKINS_URL}/job/GENIVI`, then click **New Item** 26 | 27 | * Name: `common-api-c` 28 | * Type: **Freestyle project** 29 | 30 | then click **OK**. Inside the project configuration page, add the following information: 31 | 32 | * Discard Old Builds: Yes 33 | - Strategy: Log Rotation 34 | - Days to keep build: (none) 35 | - Max # of builds to keep: 5 36 | * Source Code Management: Git 37 | - Repositories 38 | - Repository URL: `git://git.projects.genivi.org/common-api/c-poc.git` 39 | - Credentials: - none - 40 | - Branches to build 41 | - Branch Specifier (blank for 'any'): `*/master` 42 | - Repository browser: (Auto) 43 | * Build Environment 44 | - Build inside a Docker container: Yes 45 | - Docker image to use: Pull docker image from repository 46 | - Image id/tag: `gmacario/build-capi-native` 47 | - Advanced... 48 | - force Pull: Yes 49 | * Build 50 | - Execute shell 51 | - Command 52 | ``` 53 | #!/bin/bash -xe 54 | 55 | # DEBUG 56 | id 57 | ls -la 58 | 59 | # Actual build steps 60 | autoreconf -i 61 | ./configure 62 | make 63 | sudo make install 64 | 65 | # EOF 66 | ``` 67 | 68 | then click **Save**. 69 | 70 | ### Build project `common-api-c` 71 | 72 | Browse `${JENKINS_URL}/job/GENIVI/job/common-api-c`, then click **Build Now** 73 | 74 | Result: SUCCESS 75 | 76 | Excerpt from build console: 77 | 78 | 79 | 80 | ``` 81 | Started by user anonymous 82 | [EnvInject] - Loading node environment variables. 83 | Building in workspace /var/jenkins_home/jobs/GENIVI/jobs/common-api-c/workspace 84 | Cloning the remote Git repository 85 | Cloning repository git://git.projects.genivi.org/common-api/c-poc.git 86 | > git init /var/jenkins_home/jobs/GENIVI/jobs/common-api-c/workspace # timeout=10 87 | Fetching upstream changes from git://git.projects.genivi.org/common-api/c-poc.git 88 | > git --version # timeout=10 89 | > git -c core.askpass=true fetch --tags --progress git://git.projects.genivi.org/common-api/c-poc.git +refs/heads/*:refs/remotes/origin/* 90 | > git config remote.origin.url git://git.projects.genivi.org/common-api/c-poc.git # timeout=10 91 | > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10 92 | > git config remote.origin.url git://git.projects.genivi.org/common-api/c-poc.git # timeout=10 93 | Fetching upstream changes from git://git.projects.genivi.org/common-api/c-poc.git 94 | > git -c core.askpass=true fetch --tags --progress git://git.projects.genivi.org/common-api/c-poc.git +refs/heads/*:refs/remotes/origin/* 95 | > git rev-parse refs/remotes/origin/master^{commit} # timeout=10 96 | > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10 97 | Checking out Revision 4b7d45153a49086f06e3f71f06adc4743d075b98 (refs/remotes/origin/master) 98 | > git config core.sparsecheckout # timeout=10 99 | > git checkout -f 4b7d45153a49086f06e3f71f06adc4743d075b98 100 | First time build. Skipping changelog. 101 | Pull Docker image gmacario/build-capi-native from repository ... 102 | $ docker pull gmacario/build-capi-native 103 | Docker container c352a609d861cc459097406e297cdf5970364d04c87555611de7f3657983572e started to host the build 104 | $ docker exec --tty c352a609d861cc459097406e297cdf5970364d04c87555611de7f3657983572e env 105 | [workspace] $ docker exec --tty --user 1000:1000 c352a609d861cc459097406e297cdf5970364d04c87555611de7f3657983572e env 'BASH_FUNC_copy_reference_file%%=() { f=${1%/}; 106 | echo "$f" >> $COPY_REFERENCE_FILE_LOG; 107 | rel=${f:23}; 108 | dir=$(dirname ${f}); 109 | echo " $f -> $rel" >> $COPY_REFERENCE_FILE_LOG; 110 | if [[ ! -e /var/jenkins_home/${rel} ]]; then 111 | echo "copy $rel to JENKINS_HOME" >> $COPY_REFERENCE_FILE_LOG; 112 | mkdir -p /var/jenkins_home/${dir:23}; 113 | cp -r /usr/share/jenkins/ref/${rel} /var/jenkins_home/${rel}; 114 | [[ ${rel} == plugins/*.jpi ]] && touch /var/jenkins_home/${rel}.pinned; 115 | fi 116 | }' BUILD_CAUSE=MANUALTRIGGER BUILD_CAUSE_MANUALTRIGGER=true BUILD_DISPLAY_NAME=#1 BUILD_ID=1 BUILD_NUMBER=1 BUILD_TAG=jenkins-GENIVI-common-api-c-1 CA_CERTIFICATES_JAVA_VERSION=20140324 CLASSPATH= COPY_REFERENCE_FILE_LOG=/var/jenkins_home/copy_reference_file.log EXECUTOR_NUMBER=1 GIT_BRANCH=origin/master GIT_COMMIT=4b7d45153a49086f06e3f71f06adc4743d075b98 GIT_URL=git://git.projects.genivi.org/common-api/c-poc.git HOME=/var/jenkins_home HOSTNAME=0ac267008914 HUDSON_HOME=/var/jenkins_home HUDSON_SERVER_COOKIE=88213e4aa86bf5e1 JAVA_DEBIAN_VERSION=8u45-b14-2~bpo8+2 JAVA_VERSION=8u45 JENKINS_HOME=/var/jenkins_home JENKINS_SERVER_COOKIE=88213e4aa86bf5e1 JENKINS_SHA=da06f963edb627f0ced2fce612f9985d1928f79b JENKINS_SLAVE_AGENT_PORT=50000 JENKINS_UC=https://updates.jenkins-ci.org JENKINS_VERSION=2.0 JOB_NAME=GENIVI/common-api-c LANG=C.UTF-8 NODE_LABELS=master NODE_NAME=master PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PWD=/ ROOT_BUILD_CAUSE=MANUALTRIGGER ROOT_BUILD_CAUSE_MANUALTRIGGER=true SHLVL=2 TERM=xterm TINI_SHA=066ad710107dc7ee05d3aa6e4974f01dc98f3888 WORKSPACE=/var/jenkins_home/jobs/GENIVI/jobs/common-api-c/workspace /bin/bash -xe /tmp/hudson2104869269332432603.sh 117 | + id 118 | uid=1000(build) gid=1000(build) groups=1000(build) 119 | + ls -la 120 | total 96 121 | drwxr-xr-x 8 build build 4096 Apr 27 06:16 . 122 | drwxr-xr-x 4 build build 4096 Apr 27 06:16 .. 123 | drwxr-xr-x 8 build build 4096 Apr 27 06:16 .git 124 | -rw-r--r-- 1 build build 199 Apr 27 06:16 .gitignore 125 | -rw-r--r-- 1 build build 11250 Apr 27 06:16 LICENSE.EPL-1.0 126 | -rw-r--r-- 1 build build 16726 Apr 27 06:16 LICENSE.MPL-2.0 127 | -rw-r--r-- 1 build build 895 Apr 27 06:16 Makefile.am 128 | -rw-r--r-- 1 build build 4208 Apr 27 06:16 NEWS 129 | -rw-r--r-- 1 build build 5758 Apr 27 06:16 README.adoc 130 | -rw-r--r-- 1 build build 235 Apr 27 06:16 capic.pc.in 131 | -rw-r--r-- 1 build build 2009 Apr 27 06:16 configure.ac 132 | drwxr-xr-x 2 build build 4096 Apr 27 06:16 doc 133 | drwxr-xr-x 5 build build 4096 Apr 27 06:16 ref 134 | drwxr-xr-x 3 build build 4096 Apr 27 06:16 src 135 | drwxr-xr-x 4 build build 4096 Apr 27 06:16 test 136 | drwxr-xr-x 13 build build 4096 Apr 27 06:16 tools 137 | + autoreconf -i 138 | libtoolize: putting auxiliary files in '.'. 139 | libtoolize: copying file './ltmain.sh' 140 | libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac, 141 | libtoolize: and rerunning libtoolize and aclocal. 142 | libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am. 143 | configure.ac:18: installing './ar-lib' 144 | configure.ac:17: installing './compile' 145 | configure.ac:22: installing './config.guess' 146 | configure.ac:22: installing './config.sub' 147 | configure.ac:16: installing './install-sh' 148 | configure.ac:16: installing './missing' 149 | Makefile.am: installing './depcomp' 150 | + ./configure 151 | checking for a BSD-compatible install... /usr/bin/install -c 152 | checking whether build environment is sane... yes 153 | checking for a thread-safe mkdir -p... /bin/mkdir -p 154 | checking for gawk... no 155 | checking for mawk... mawk 156 | checking whether make sets $(MAKE)... yes 157 | checking whether make supports nested variables... yes 158 | checking for gcc... gcc 159 | checking whether the C compiler works... yes 160 | checking for C compiler default output file name... a.out 161 | checking for suffix of executables... 162 | checking whether we are cross compiling... no 163 | checking for suffix of object files... o 164 | checking whether we are using the GNU C compiler... yes 165 | checking whether gcc accepts -g... yes 166 | checking for gcc option to accept ISO C89... none needed 167 | checking whether gcc understands -c and -o together... yes 168 | checking for style of include used by make... GNU 169 | checking dependency style of gcc... gcc3 170 | checking for ar... ar 171 | checking the archiver (ar) interface... ar 172 | checking for gawk... (cached) mawk 173 | checking build system type... x86_64-pc-linux-gnu 174 | checking host system type... x86_64-pc-linux-gnu 175 | checking how to print strings... printf 176 | checking for a sed that does not truncate output... /bin/sed 177 | checking for grep that handles long lines and -e... /bin/grep 178 | checking for egrep... /bin/grep -E 179 | checking for fgrep... /bin/grep -F 180 | checking for ld used by gcc... /usr/bin/ld 181 | checking if the linker (/usr/bin/ld) is GNU ld... yes 182 | checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B 183 | checking the name lister (/usr/bin/nm -B) interface... BSD nm 184 | checking whether ln -s works... yes 185 | checking the maximum length of command line arguments... 1572864 186 | checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop 187 | checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop 188 | checking for /usr/bin/ld option to reload object files... -r 189 | checking for objdump... objdump 190 | checking how to recognize dependent libraries... pass_all 191 | checking for dlltool... no 192 | checking how to associate runtime and link libraries... printf %s\n 193 | checking for archiver @FILE support... @ 194 | checking for strip... strip 195 | checking for ranlib... ranlib 196 | checking command to parse /usr/bin/nm -B output from gcc object... ok 197 | checking for sysroot... no 198 | checking for a working dd... /bin/dd 199 | checking how to truncate binary pipes... /bin/dd bs=4096 count=1 200 | checking for mt... no 201 | checking if : is a manifest tool... no 202 | checking how to run the C preprocessor... gcc -E 203 | checking for ANSI C header files... yes 204 | checking for sys/types.h... yes 205 | checking for sys/stat.h... yes 206 | checking for stdlib.h... yes 207 | checking for string.h... yes 208 | checking for memory.h... yes 209 | checking for strings.h... yes 210 | checking for inttypes.h... yes 211 | checking for stdint.h... yes 212 | checking for unistd.h... yes 213 | checking for dlfcn.h... yes 214 | checking for objdir... .libs 215 | checking if gcc supports -fno-rtti -fno-exceptions... no 216 | checking for gcc option to produce PIC... -fPIC -DPIC 217 | checking if gcc PIC flag -fPIC -DPIC works... yes 218 | checking if gcc static flag -static works... yes 219 | checking if gcc supports -c -o file.o... yes 220 | checking if gcc supports -c -o file.o... (cached) yes 221 | checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes 222 | checking whether -lc should be explicitly linked in... no 223 | checking dynamic linker characteristics... GNU/Linux ld.so 224 | checking how to hardcode library paths into programs... immediate 225 | checking whether stripping libraries is possible... yes 226 | checking if libtool supports shared libraries... yes 227 | checking whether to build shared libraries... yes 228 | checking whether to build static libraries... no 229 | checking for pkg-config... /usr/bin/pkg-config 230 | checking pkg-config is at least version 0.9.0... yes 231 | checking for LIBSYSTEMD... yes 232 | checking for sd_bus_open in -lsystemd... yes 233 | checking for sd_bus_get_scope in -lsystemd... yes 234 | checking whether SD_EVENT_INITIAL is declared... yes 235 | checking that generated files are newer than configure... done 236 | configure: creating ./config.status 237 | config.status: creating Makefile 238 | config.status: creating capic.pc 239 | config.status: creating config.h 240 | config.status: executing depfiles commands 241 | config.status: executing libtool commands 242 | 243 | capic 0.2.1 244 | 245 | compiler: gcc 246 | CPPFLAGS: 247 | CFLAGS: -Wall -Wextra -Werror -g -O2 248 | LDFLAGS: 249 | 250 | logging: yes 251 | 252 | + make 253 | make all-am 254 | make[1]: Entering directory '/var/jenkins_home/jobs/GENIVI/jobs/common-api-c/workspace' 255 | depbase=`echo src/backend.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\ 256 | /bin/bash ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I./src -I. -Wall -Wextra -Werror -fvisibility=hidden -g -O2 -MT src/backend.lo -MD -MP -MF $depbase.Tpo -c -o src/backend.lo src/backend.c &&\ 257 | mv -f $depbase.Tpo $depbase.Plo 258 | libtool: compile: gcc -DHAVE_CONFIG_H -I. -I./src -I. -Wall -Wextra -Werror -fvisibility=hidden -g -O2 -MT src/backend.lo -MD -MP -MF src/.deps/backend.Tpo -c src/backend.c -fPIC -DPIC -o src/.libs/backend.o 259 | /bin/bash ./libtool --tag=CC --mode=link gcc -Wall -Wextra -Werror -fvisibility=hidden -g -O2 -no-undefined -version-info 0:0:0 -o libcapic.la -rpath /usr/local/lib src/backend.lo 260 | libtool: link: gcc -shared -fPIC -DPIC src/.libs/backend.o -g -O2 -Wl,-soname -Wl,libcapic.so.0 -o .libs/libcapic.so.0.0.0 261 | libtool: link: (cd ".libs" && rm -f "libcapic.so.0" && ln -s "libcapic.so.0.0.0" "libcapic.so.0") 262 | libtool: link: (cd ".libs" && rm -f "libcapic.so" && ln -s "libcapic.so.0.0.0" "libcapic.so") 263 | libtool: link: ( cd ".libs" && rm -f "libcapic.la" && ln -s "../libcapic.la" "libcapic.la" ) 264 | make[1]: Leaving directory '/var/jenkins_home/jobs/GENIVI/jobs/common-api-c/workspace' 265 | + sudo make install 266 | make[1]: Entering directory '/var/jenkins_home/jobs/GENIVI/jobs/common-api-c/workspace' 267 | /bin/mkdir -p '/usr/local/lib' 268 | /bin/bash ./libtool --mode=install /usr/bin/install -c libcapic.la '/usr/local/lib' 269 | libtool: install: /usr/bin/install -c .libs/libcapic.so.0.0.0 /usr/local/lib/libcapic.so.0.0.0 270 | libtool: install: (cd /usr/local/lib && { ln -s -f libcapic.so.0.0.0 libcapic.so.0 || { rm -f libcapic.so.0 && ln -s libcapic.so.0.0.0 libcapic.so.0; }; }) 271 | libtool: install: (cd /usr/local/lib && { ln -s -f libcapic.so.0.0.0 libcapic.so || { rm -f libcapic.so && ln -s libcapic.so.0.0.0 libcapic.so; }; }) 272 | libtool: install: /usr/bin/install -c .libs/libcapic.lai /usr/local/lib/libcapic.la 273 | libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin" ldconfig -n /usr/local/lib 274 | ---------------------------------------------------------------------- 275 | Libraries have been installed in: 276 | /usr/local/lib 277 | 278 | If you ever happen to want to link against installed libraries 279 | in a given directory, LIBDIR, you must either use libtool, and 280 | specify the full pathname of the library, or use the '-LLIBDIR' 281 | flag during linking and do at least one of the following: 282 | - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable 283 | during execution 284 | - add LIBDIR to the 'LD_RUN_PATH' environment variable 285 | during linking 286 | - use the '-Wl,-rpath -Wl,LIBDIR' linker flag 287 | - have your system administrator add LIBDIR to '/etc/ld.so.conf' 288 | 289 | See any operating system documentation about shared libraries for 290 | more information, such as the ld(1) and ld.so(8) manual pages. 291 | ---------------------------------------------------------------------- 292 | /bin/mkdir -p '/usr/local/lib/pkgconfig' 293 | /usr/bin/install -c -m 644 capic.pc '/usr/local/lib/pkgconfig' 294 | /bin/mkdir -p '/usr/local/include/capic' 295 | /usr/bin/install -c -m 644 src/capic/backend.h src/capic/log.h src/capic/dbus-private.h '/usr/local/include/capic' 296 | make[1]: Leaving directory '/var/jenkins_home/jobs/GENIVI/jobs/common-api-c/workspace' 297 | Stopping Docker container after build completion 298 | Notifying upstream projects of job completion 299 | Finished: SUCCESS 300 | ``` 301 | 302 | 303 | -------------------------------------------------------------------------------- /docs/building-meta-ivi-qemux86-64.md: -------------------------------------------------------------------------------- 1 | # Building the GENIVI Yocto Baseline using easy-jenkins 2 | 3 | ## Introduction 4 | 5 | 6 | 7 | This document explains how to build from sources the [GENIVI Yocto Baseline](https://at.projects.genivi.org/wiki/display/PROJ/meta-ivi) using [Jenkins](https://jenkins-ci.org/). 8 | 9 | The build is performed inside a Docker container spun by the [Docker Pipeline Plugin](https://wiki.jenkins-ci.org/display/JENKINS/CloudBees+Docker+Pipeline+Plugin). 10 | 11 | The instructions inside this document have been tested on 12 | 13 | * Docker client: itm-gmacario-w7 (MS Windows 7 64-bit, Docker Toolbox 1.10.2) 14 | * Docker engine: alm-gm-ubu15 (Ubuntu 14.04.4 LTS 64-bit, Docker 1.10.3, Docker Compose 1.6.2) 15 | 16 | ## Preparation 17 | 18 | * Install and configure [easy-jenkins](https://github.com/gmacario/easy-jenkins) - please refer to [preparation.md](https://github.com/gmacario/easy-jenkins/blob/master/docs/preparation.md) for details. 19 | * Verify that the Jenkins Dashboard is accessible at `${DOCKER_URL}` (example: http://192.168.99.100:9080/) 20 | 21 | ## Step-by-step instructions 22 | 23 | ### Create folder `GENIVI` 24 | 25 | Browse `${DOCKER_URL}`, then click **New Item** 26 | 27 | * Name: `GENIVI` 28 | * Type: **Folder** 29 | 30 | then click **OK**. Inside the project configuration page, review configuration, then click **OK**. 31 | 32 | ### Create project `yocto-baseline-next` 33 | 34 | 35 | 36 | 37 | 38 | Please refer to official build instructions on wiki page [meta-ivi/10.0.0](https://at.projects.genivi.org/wiki/x/UYKw) for details. 39 | 40 | Browse `${DOCKER_URL}/job/GENIVI`, then click **New Item** 41 | 42 | * Name: `yocto-baseline-next` 43 | * Type: **Pipeline** 44 | 45 | then click **OK**. Inside the project configuration page, add the following information: 46 | 47 | * Discard Old Builds: Yes 48 | - Strategy: Log Rotation 49 | - Days to keep build: (none) 50 | - Max # of builds to keep: 2 51 | * Execute concurrent builds if necessary: Yes 52 | 53 | * Pipeline 54 | - Definition: Pipeline script 55 | - Script 56 | 57 | ``` 58 | docker.image('gmacario/build-yocto-genivi').inside { 59 | stage 'Checkout meta-ivi' 60 | dir ('meta-ivi') { 61 | git branch: '10.0', url: 'http://git.yoctoproject.org/git/meta-ivi' 62 | } 63 | 64 | stage 'Checkout poky' 65 | dir ('poky') { 66 | git branch: 'jethro', url: 'http://git.yoctoproject.org/git/poky.git' 67 | } 68 | 69 | stage 'Checkout meta-openembedded' 70 | dir ('meta-openembedded') { 71 | git branch: 'jethro', url: 'git://git.openembedded.org/meta-openembedded' 72 | } 73 | 74 | stage 'Checkout baseline_ci_helper' 75 | dir ('baseline_ci_helper') { 76 | git branch: 'master', url: 'https://github.com/gunnarx/baseline_ci_helper.git' 77 | } 78 | 79 | stage 'Checkout correct SHAs' 80 | sh 'cd meta-ivi && git config user.name "Jenkins Agent"' 81 | sh 'cd meta-ivi && git config user.email "no_email@example.com"' 82 | sh 'cd baseline_ci_helper && sh -c "./checkout_layer_hash.sh poky"' 83 | sh 'cd baseline_ci_helper && sh -c "./checkout_layer_hash.sh meta-openembedded"' 84 | 85 | stage 'Inspect sources' 86 | echo 'Inspecting sources' 87 | sh 'pwd' 88 | sh 'ls -la' 89 | 90 | stage 'Build the image' 91 | sh 'bash -c "export MACHINE=qemux86-64 && export TEMPLATECONF=$PWD/meta-ivi/meta-ivi/conf && source poky/oe-init-build-env && bitbake leviathan-image"' 92 | 93 | stage 'Inspect results' 94 | echo 'Inspecting results' 95 | sh 'pwd' 96 | // sh 'ls -la .' 97 | sh 'ls -laR build/tmp/deploy/images' 98 | } 99 | ``` 100 | 101 | then click **Save**. 102 | 103 | ### Build project `yocto-baseline-next` 104 | 105 | Browse `${JENKINS_URL}/job/GENIVI/job/yocto-baseline-next/`, then click **Build Now**. 106 | 107 | You may watch the build logs at `${JENKINS_URL}/job/GENIVI/job/yocto-baseline-next/lastBuild/console` 108 | 109 | 110 | 111 | ``` 112 | Started by user anonymous 113 | [Pipeline] Allocate node : Start 114 | Running on master in /var/jenkins_home/workspace/GENIVI/yocto-baseline-next 115 | [Pipeline] node { 116 | [Pipeline] sh 117 | [yocto-baseline-next] Running shell script 118 | + docker inspect -f . gmacario/build-yocto-genivi 119 | . 120 | [Pipeline] Run build steps inside a Docker container : Start 121 | $ docker run -t -d -u 1000:1000 -w /var/jenkins_home/workspace/GENIVI/yocto-baseline-next -v /var/jenkins_home/workspace/GENIVI/yocto-baseline-next:/var/jenkins_home/workspace/GENIVI/yocto-baseline-next:rw -v /var/jenkins_home/workspace/GENIVI/yocto-baseline-next@tmp:/var/jenkins_home/workspace/GENIVI/yocto-baseline-next@tmp:rw -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** gmacario/build-yocto-genivi cat 122 | [Pipeline] withDockerContainer { 123 | [Pipeline] stage (Checkout meta-ivi) 124 | Entering stage Checkout meta-ivi 125 | Proceeding 126 | [Pipeline] Change current directory : Start 127 | Running in /var/jenkins_home/workspace/GENIVI/yocto-baseline-next/meta-ivi 128 | [Pipeline] dir { 129 | [Pipeline] git 130 | > git rev-parse --is-inside-work-tree # timeout=10 131 | Fetching changes from the remote Git repository 132 | > git config remote.origin.url http://git.yoctoproject.org/git/meta-ivi # timeout=10 133 | Fetching upstream changes from http://git.yoctoproject.org/git/meta-ivi 134 | > git --version # timeout=10 135 | > git -c core.askpass=true fetch --tags --progress http://git.yoctoproject.org/git/meta-ivi +refs/heads/*:refs/remotes/origin/* 136 | > git rev-parse refs/remotes/origin/10.0^{commit} # timeout=10 137 | > git rev-parse refs/remotes/origin/origin/10.0^{commit} # timeout=10 138 | Checking out Revision 1c3889b3f828fedd0260754163ca65e5644e8e69 (refs/remotes/origin/10.0) 139 | > git config core.sparsecheckout # timeout=10 140 | > git checkout -f 1c3889b3f828fedd0260754163ca65e5644e8e69 # timeout=10 141 | > git branch -a -v --no-abbrev # timeout=10 142 | > git branch -D 10.0 # timeout=10 143 | > git checkout -b 10.0 1c3889b3f828fedd0260754163ca65e5644e8e69 144 | > git rev-list 1c3889b3f828fedd0260754163ca65e5644e8e69 # timeout=10 145 | [Pipeline] } //dir 146 | [Pipeline] Change current directory : End 147 | [Pipeline] stage (Checkout poky) 148 | Entering stage Checkout poky 149 | Proceeding 150 | [Pipeline] Change current directory : Start 151 | Running in /var/jenkins_home/workspace/GENIVI/yocto-baseline-next/poky 152 | [Pipeline] dir { 153 | [Pipeline] git 154 | > git rev-parse --is-inside-work-tree # timeout=10 155 | Fetching changes from the remote Git repository 156 | > git config remote.origin.url http://git.yoctoproject.org/git/poky.git # timeout=10 157 | Fetching upstream changes from http://git.yoctoproject.org/git/poky.git 158 | > git --version # timeout=10 159 | > git -c core.askpass=true fetch --tags --progress http://git.yoctoproject.org/git/poky.git +refs/heads/*:refs/remotes/origin/* 160 | > git rev-parse refs/remotes/origin/jethro^{commit} # timeout=10 161 | > git rev-parse refs/remotes/origin/origin/jethro^{commit} # timeout=10 162 | Checking out Revision 3b223f75eec1738fbc913858e8e11c8305e3edcb (refs/remotes/origin/jethro) 163 | > git config core.sparsecheckout # timeout=10 164 | > git checkout -f 3b223f75eec1738fbc913858e8e11c8305e3edcb # timeout=10 165 | > git branch -a -v --no-abbrev # timeout=10 166 | > git branch -D jethro # timeout=10 167 | > git checkout -b jethro 3b223f75eec1738fbc913858e8e11c8305e3edcb 168 | > git rev-list 3b223f75eec1738fbc913858e8e11c8305e3edcb # timeout=10 169 | [Pipeline] } //dir 170 | [Pipeline] Change current directory : End 171 | [Pipeline] stage (Checkout meta-openembedded) 172 | Entering stage Checkout meta-openembedded 173 | Proceeding 174 | [Pipeline] Change current directory : Start 175 | Running in /var/jenkins_home/workspace/GENIVI/yocto-baseline-next/meta-openembedded 176 | [Pipeline] dir { 177 | [Pipeline] git 178 | > git rev-parse --is-inside-work-tree # timeout=10 179 | Fetching changes from the remote Git repository 180 | > git config remote.origin.url git://git.openembedded.org/meta-openembedded # timeout=10 181 | Fetching upstream changes from git://git.openembedded.org/meta-openembedded 182 | > git --version # timeout=10 183 | > git -c core.askpass=true fetch --tags --progress git://git.openembedded.org/meta-openembedded +refs/heads/*:refs/remotes/origin/* 184 | > git rev-parse refs/remotes/origin/jethro^{commit} # timeout=10 185 | > git rev-parse refs/remotes/origin/origin/jethro^{commit} # timeout=10 186 | Checking out Revision c305ac5d2f5285d5eec8952a4ca7f3b4f89aed96 (refs/remotes/origin/jethro) 187 | > git config core.sparsecheckout # timeout=10 188 | > git checkout -f c305ac5d2f5285d5eec8952a4ca7f3b4f89aed96 # timeout=10 189 | > git branch -a -v --no-abbrev # timeout=10 190 | > git branch -D jethro # timeout=10 191 | > git checkout -b jethro c305ac5d2f5285d5eec8952a4ca7f3b4f89aed96 192 | > git rev-list c305ac5d2f5285d5eec8952a4ca7f3b4f89aed96 # timeout=10 193 | [Pipeline] } //dir 194 | [Pipeline] Change current directory : End 195 | [Pipeline] stage (Checkout baseline_ci_helper) 196 | Entering stage Checkout baseline_ci_helper 197 | Proceeding 198 | [Pipeline] Change current directory : Start 199 | Running in /var/jenkins_home/workspace/GENIVI/yocto-baseline-next/baseline_ci_helper 200 | [Pipeline] dir { 201 | [Pipeline] git 202 | > git rev-parse --is-inside-work-tree # timeout=10 203 | Fetching changes from the remote Git repository 204 | > git config remote.origin.url https://github.com/gunnarx/baseline_ci_helper.git # timeout=10 205 | Fetching upstream changes from https://github.com/gunnarx/baseline_ci_helper.git 206 | > git --version # timeout=10 207 | > git -c core.askpass=true fetch --tags --progress https://github.com/gunnarx/baseline_ci_helper.git +refs/heads/*:refs/remotes/origin/* 208 | > git rev-parse refs/remotes/origin/master^{commit} # timeout=10 209 | > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10 210 | Checking out Revision ece83c165bdb6b97d3f91064aa9d94c584990b64 (refs/remotes/origin/master) 211 | > git config core.sparsecheckout # timeout=10 212 | > git checkout -f ece83c165bdb6b97d3f91064aa9d94c584990b64 # timeout=10 213 | > git branch -a -v --no-abbrev # timeout=10 214 | > git branch -D master # timeout=10 215 | > git checkout -b master ece83c165bdb6b97d3f91064aa9d94c584990b64 216 | > git rev-list ece83c165bdb6b97d3f91064aa9d94c584990b64 # timeout=10 217 | [Pipeline] } //dir 218 | [Pipeline] Change current directory : End 219 | [Pipeline] stage (Checkout correct SHAs) 220 | Entering stage Checkout correct SHAs 221 | Proceeding 222 | [Pipeline] sh 223 | [yocto-baseline-next] Running shell script 224 | + cd meta-ivi 225 | + git config user.name Jenkins Agent 226 | [Pipeline] sh 227 | [yocto-baseline-next] Running shell script 228 | + cd meta-ivi 229 | + git config user.email no_email@example.com 230 | [Pipeline] sh 231 | [yocto-baseline-next] Running shell script 232 | + cd baseline_ci_helper 233 | + sh -c ./checkout_layer_hash.sh poky 234 | Note: checking out 'fc45deac89ef63ca1c44e763c38ced7dfd72cbe1'. 235 | 236 | You are in 'detached HEAD' state. You can look around, make experimental 237 | changes and commit them, and you can discard any commits you make in this 238 | state without impacting any branches by performing another checkout. 239 | 240 | If you want to create a new branch to retain commits you create, you may 241 | do so (now or later) by using -b with the checkout command again. Example: 242 | 243 | git checkout -b new_branch_name 244 | 245 | HEAD is now at fc45dea... build-appliance-image: Update to jethro head revision 246 | [Pipeline] sh 247 | [yocto-baseline-next] Running shell script 248 | + cd baseline_ci_helper 249 | + sh -c ./checkout_layer_hash.sh meta-openembedded 250 | Note: checking out 'ad6133a2e95f4b83b6b3ea413598e2cd5fb3fd90'. 251 | 252 | You are in 'detached HEAD' state. You can look around, make experimental 253 | changes and commit them, and you can discard any commits you make in this 254 | state without impacting any branches by performing another checkout. 255 | 256 | If you want to create a new branch to retain commits you create, you may 257 | do so (now or later) by using -b with the checkout command again. Example: 258 | 259 | git checkout -b new_branch_name 260 | 261 | HEAD is now at ad6133a... mce-inject: add recipe 262 | [Pipeline] stage (Inspect sources) 263 | Entering stage Inspect sources 264 | Proceeding 265 | [Pipeline] echo 266 | Inspecting sources 267 | [Pipeline] sh 268 | [yocto-baseline-next] Running shell script 269 | + pwd 270 | /var/jenkins_home/workspace/GENIVI/yocto-baseline-next 271 | [Pipeline] sh 272 | [yocto-baseline-next] Running shell script 273 | + ls -la 274 | total 28 275 | drwxr-xr-x 7 build build 4096 Mar 31 11:20 . 276 | drwxr-xr-x 4 root root 4096 Mar 31 17:16 .. 277 | drwxr-xr-x 3 build build 4096 Mar 31 11:20 baseline_ci_helper 278 | drwxr-xr-x 8 build build 4096 Mar 31 17:12 build 279 | drwxr-xr-x 7 build build 4096 Mar 31 11:19 meta-ivi 280 | drwxr-xr-x 18 build build 4096 Mar 31 11:20 meta-openembedded 281 | drwxr-xr-x 11 build build 4096 Mar 31 17:16 poky 282 | [Pipeline] stage (Build the image) 283 | Entering stage Build the image 284 | Proceeding 285 | [Pipeline] sh 286 | [yocto-baseline-next] Running shell script 287 | + bash -c export MACHINE=qemux86-64 && export TEMPLATECONF=/var/jenkins_home/workspace/GENIVI/yocto-baseline-next/meta-ivi/meta-ivi/conf && source poky/oe-init-build-env && bitbake leviathan-image 288 | 289 | ### Shell environment set up for builds. ### 290 | 291 | You can now run 'bitbake ' 292 | 293 | Common targets are: 294 | leviathan-image 295 | ivi-image 296 | 297 | Loading cache...done. 298 | Loaded 2116 entries from dependency cache. 299 | Parsing recipes...NOTE: INCLUDING less as buildable despite INCOMPATIBLE_LICENSE because it has been whitelisted 300 | NOTE: INCLUDING libidn as buildable despite INCOMPATIBLE_LICENSE because it has been whitelisted 301 | NOTE: INCLUDING libidn as buildable despite INCOMPATIBLE_LICENSE because it has been whitelisted 302 | NOTE: INCLUDING libassuan as buildable despite INCOMPATIBLE_LICENSE because it has been whitelisted 303 | NOTE: INCLUDING libtasn1 as buildable despite INCOMPATIBLE_LICENSE because it has been whitelisted 304 | NOTE: INCLUDING gnutls as buildable despite INCOMPATIBLE_LICENSE because it has been whitelisted 305 | done. 306 | Parsing of 1593 .bb files complete (362 cached, 1231 parsed). 2115 targets, 431 skipped, 0 masked, 0 errors. 307 | NOTE: Resolving any missing task queue dependencies 308 | 309 | Build Configuration: 310 | BB_VERSION = "1.28.0" 311 | BUILD_SYS = "x86_64-linux" 312 | NATIVELSBSTRING = "Ubuntu-14.04" 313 | TARGET_SYS = "x86_64-poky-linux" 314 | MACHINE = "qemux86-64" 315 | DISTRO = "poky-ivi-systemd" 316 | DISTRO_VERSION = "10.0+snapshot-20160331" 317 | TUNE_FEATURES = "m64 core2" 318 | TARGET_FPU = "" 319 | meta 320 | meta-yocto 321 | meta-yocto-bsp = "HEAD:fc45deac89ef63ca1c44e763c38ced7dfd72cbe1" 322 | meta-oe 323 | meta-filesystems = "HEAD:ad6133a2e95f4b83b6b3ea413598e2cd5fb3fd90" 324 | meta-ivi 325 | meta-ivi-bsp = "10.0:1c3889b3f828fedd0260754163ca65e5644e8e69" 326 | 327 | NOTE: Preparing RunQueue 328 | NOTE: Executing SetScene Tasks 329 | NOTE: Executing RunQueue Tasks 330 | NOTE: Tasks Summary: Attempted 3270 tasks of which 3270 didn't need to be rerun and all succeeded. 331 | [Pipeline] stage (Inspect results) 332 | Entering stage Inspect results 333 | Proceeding 334 | [Pipeline] echo 335 | Inspecting results 336 | [Pipeline] sh 337 | [yocto-baseline-next] Running shell script 338 | + pwd 339 | /var/jenkins_home/workspace/GENIVI/yocto-baseline-next 340 | [Pipeline] sh 341 | [yocto-baseline-next] Running shell script 342 | + ls -laR build/tmp/deploy/images 343 | build/tmp/deploy/images: 344 | total 12 345 | drwxr-xr-x 3 build build 4096 Mar 31 16:14 . 346 | drwxr-xr-x 5 build build 4096 Mar 31 16:59 .. 347 | drwxr-xr-x 2 build build 4096 Mar 31 17:14 qemux86-64 348 | 349 | build/tmp/deploy/images/qemux86-64: 350 | total 280140 351 | drwxr-xr-x 2 build build 4096 Mar 31 17:14 . 352 | drwxr-xr-x 3 build build 4096 Mar 31 16:14 .. 353 | -rw-r--r-- 2 build build 294 Mar 31 17:10 README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt 354 | lrwxrwxrwx 1 build build 76 Mar 31 16:14 bzImage -> bzImage--3.14.36+git0+060fa80b79_578602a722-r0-qemux86-64-20160331112227.bin 355 | -rw-r--r-- 2 build build 6630560 Mar 31 16:13 bzImage--3.14.36+git0+060fa80b79_578602a722-r0-qemux86-64-20160331112227.bin 356 | lrwxrwxrwx 1 build build 76 Mar 31 16:14 bzImage-qemux86-64.bin -> bzImage--3.14.36+git0+060fa80b79_578602a722-r0-qemux86-64-20160331112227.bin 357 | -rw-r--r-- 1 build build 264473600 Mar 31 17:14 leviathan-image-qemux86-64-20160331112227.rootfs.ext4 358 | -rw-r--r-- 1 build build 35606 Mar 31 17:12 leviathan-image-qemux86-64-20160331112227.rootfs.manifest 359 | -rw-r--r-- 1 build build 50292037 Mar 31 17:14 leviathan-image-qemux86-64-20160331112227.rootfs.tar.bz2 360 | lrwxrwxrwx 1 build build 53 Mar 31 17:14 leviathan-image-qemux86-64.ext4 -> leviathan-image-qemux86-64-20160331112227.rootfs.ext4 361 | lrwxrwxrwx 1 build build 57 Mar 31 17:14 leviathan-image-qemux86-64.manifest -> leviathan-image-qemux86-64-20160331112227.rootfs.manifest 362 | lrwxrwxrwx 1 build build 56 Mar 31 17:14 leviathan-image-qemux86-64.tar.bz2 -> leviathan-image-qemux86-64-20160331112227.rootfs.tar.bz2 363 | -rw-r--r-- 2 build build 70578482 Mar 31 16:14 modules--3.14.36+git0+060fa80b79_578602a722-r0-qemux86-64-20160331112227.tgz 364 | lrwxrwxrwx 1 build build 76 Mar 31 16:14 modules-qemux86-64.tgz -> modules--3.14.36+git0+060fa80b79_578602a722-r0-qemux86-64-20160331112227.tgz 365 | [Pipeline] } //withDockerContainer 366 | $ docker stop 3d4650282d76021f94e201cbe12d4e3d6a5c71747184df0597ef286e2b29a062 367 | $ docker rm -f 3d4650282d76021f94e201cbe12d4e3d6a5c71747184df0597ef286e2b29a062 368 | [Pipeline] Run build steps inside a Docker container : End 369 | [Pipeline] } //node 370 | [Pipeline] Allocate node : End 371 | [Pipeline] End of Pipeline 372 | Finished: SUCCESS 373 | ``` 374 | 375 | **NOTE**: A full build starting from an empty workspace takes about TODO hours to complete (Docker Engine running on a dual-core AMD Opteron(TM) Processor 6276 CPU X5450 @2300 MHz, 4 GB RAM). 376 | 377 | 378 | --------------------------------------------------------------------------------