updates.sh 

Fuego wiki

Login or create account

updates.sh

updates.sh is a shell script written by Cogent, that does customization of the Jenkins interface for Fuego.

This program is called during the Docker container build, to customize the Jenkins installation for Fuego. It copies lots of static files into jenkins jar files, then installs them. Overall, it's extremely fragile and version dependent.

steps [edit section]

Here are the steps it does:
  • scan jenkins var file for JENKINS_CORE_NAME
    • set to WEB-INF/lib/jenkins-core-1.509.2.jar
  • make all files under /var/lib/jenkins owned by user 'jenkins'
  • make all files under /var/lib/jenkins/war owned by user 'jenkins'
  • get jenkins-cli.jar from running local server.
    • restart server if there are problems
  • cd en_US
  • customize main page html:
    • cp *.xml to /var/lib/jenkins (and fix permissions)
      • hudson.plugins.page_markup.PageMarkupPageDecorator.xml
      • locale.xml
  • customize plugins
    • jar -uf ./* each plugin in en_US/plugins/* (and fix permissions)
      • jar -uf $p.jpi or $p.hpi ./*
  • copy en_US/css to /var/cache/jenkins/war
  • copy en_US/images to /var/cache/jenkins/war
  • customize core classes:
    • extract jenkins core: jar xf /usr/share/jenkins/jenkins.var WEB-INF/lib/jenkins-core-1.509.2.jar
    • update core jar with junk: for d in hudson, jenkins, lib:
      • jar uf WEB-INF/lib/jenkins-core-1.509.2.jar $d/*
    • cp core jar to /var/cache/jenkins/var
    • fix permissions
  • install plugins (CSS & locale)
    • restart jenkins
    • get jenkins-cli.jar (again?)
    • use jenkins-cli.jar to install-plugin

data files [edit section]

In the directory: en_US, there are a bunch of files used to customize the Jenkins interface. Here is the rough directory structure:
  • core
    • hudson
      • widgets
      • init
      • model
      • cli
      • matrix
      • views
      • lifecycle
    • jenkins
      • model
      • management
    • lib
  • css
  • images
  • plugins
    • compact-columns
    • dashboard-view
    • PrioritySorter
    • jobConfigHistory

customizations [edit section]

sample output [edit section]

    root@tlinux:/fuego-install/jenkins-updates# ./updates.sh
    ++ whoami
    + '[' root '!=' root ']'
    + source ./constants.sh
    ++ LANG=en_US
    ++ JENKINS_USER_PASS=j3nkins
    ++ JEN_URL=http://localhost:8080/fuego
    ++ JENKINS_INST=/var/lib/jenkins
    ++ JENKINS_WAR_FILE=/usr/share/jenkins/jenkins.war
    +++ jar tf /usr/share/jenkins/jenkins.war
    +++ grep jenkins-core
    ++ JENKINS_CORE_NAME=WEB-INF/lib/jenkins-core-1.509.2.jar
    ++ JENKINS_CACHE=/var/cache/jenkins/war
    ++ RSYNC_ARGS='-ahq --stats'
    + echo 'Jenkins cache is /var/cache/jenkins/war'
    Jenkins cache is /var/cache/jenkins/war
    + fix_permissions /var/lib/jenkins
    + chown -fRH jenkins /var/lib/jenkins
    + fix_permissions /var/cache/jenkins/war
    + chown -fRH jenkins /var/cache/jenkins/war
    + sync_fetch_jenkins_cli
    + wget -v --no-proxy http://localhost:8080/fuego/jnlpJars/jenkins-cli.jar -O jenkins-cli.jar
    converted 'http://localhost:8080/fuego/jnlpJars/jenkins-cli.jar' (ANSI_X3.4-1968) -> 'http://localhost:8080/fuego/jnlpJars/jenkins-cli.jar' (UTF-8)
    --2017-02-28 22:22:13--  http://localhost:8080/fuego/jnlpJars/jenkins-cli.jar
    Resolving localhost (localhost)... 127.0.0.1
    Connecting to localhost (localhost)|127.0.0.1|:8080... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 605730 (592K) [application/java-archive]
    Saving to: 'jenkins-cli.jar'
    
    jenkins-cli.jar                                  100%[============================================================================================================>] 591.53K  --.-KB/s   in 0.05s
    
    2017-02-28 22:22:13 (12.6 MB/s) - 'jenkins-cli.jar' saved [605730/605730]
    
    + cd en_US
    + cp hudson.plugins.page_markup.PageMarkupPageDecorator.xml locale.xml /var/lib/jenkins
    + fix_permissions /var/lib/jenkins/buildstep-config-files.xml /var/lib/jenkins/config.xml /var/lib/jenkins/custom-config-files.xml /var/lib/jenkins/hudson.maven.MavenModuleSet.xml /var/lib/jenkins/hudson.model.UpdateCenter.xml /var/lib/jenkins/hudson.plugins.git.GitTool.xml /var/lib/jenkins/hudson.plugins.groovy.Groovy.xml /var/lib/jenkins/hudson.plugins.page_markup.PageMarkupPageDecorator.xml /var/lib/jenkins/hudson.plugins.throttleconcurrents.ThrottleJobProperty.xml /var/lib/jenkins/hudson.scm.CVSSCM.xml /var/lib/jenkins/hudson.scm.SubversionSCM.xml /var/lib/jenkins/hudson.tasks.Ant.xml /var/lib/jenkins/hudson.tasks.Mailer.xml /var/lib/jenkins/hudson.tasks.Maven.xml /var/lib/jenkins/hudson.tasks.Shell.xml /var/lib/jenkins/hudson.triggers.SCMTrigger.xml /var/lib/jenkins/jenkins.model.JenkinsLocationConfiguration.xml /var/lib/jenkins/jp.ikedam.jenkins.plugins.extensible_choice_parameter.GlobalTextareaChoiceListProvider.xml /var/lib/jenkins/locale.xml /var/lib/jenkins/nodeMonitors.xml /var/lib/jenkins/org.codefirst.SimpleThemeDecorator.xml /var/lib/jenkins/sidebar-link.xml
    + chown -fRH jenkins /var/lib/jenkins/buildstep-config-files.xml
    + for p in 'plugins/*'
    + cd plugins/PrioritySorter
    + '[' -f /var/lib/jenkins/plugins/PrioritySorter.jpi ']'
    + jar uf /var/lib/jenkins/plugins/PrioritySorter.jpi ./WEB-INF
    + '[' -f /var/lib/jenkins/plugins/PrioritySorter.hpi ']'
    + cd ../..
    + for p in 'plugins/*'
    + cd plugins/compact-columns
    + '[' -f /var/lib/jenkins/plugins/compact-columns.jpi ']'
    + jar uf /var/lib/jenkins/plugins/compact-columns.jpi ./WEB-INF
    + '[' -f /var/lib/jenkins/plugins/compact-columns.hpi ']'
    + cd ../..
    + for p in 'plugins/*'
    + cd plugins/dashboard-view
    + '[' -f /var/lib/jenkins/plugins/dashboard-view.jpi ']'
    + jar uf /var/lib/jenkins/plugins/dashboard-view.jpi ./WEB-INF ./help
    + '[' -f /var/lib/jenkins/plugins/dashboard-view.hpi ']'
    + cd ../..
    + for p in 'plugins/*'
    + cd plugins/jobConfigHistory
    + '[' -f /var/lib/jenkins/plugins/jobConfigHistory.jpi ']'
    + '[' -f /var/lib/jenkins/plugins/jobConfigHistory.hpi ']'
    + cd ../..
    + fix_permissions /var/lib/jenkins/plugins
    + chown -fRH jenkins /var/lib/jenkins/plugins
    + cp -vr ./css /var/cache/jenkins/war
    './css/style1.css' -> '/var/cache/jenkins/war/css/style1.css'
    './css/style2.css' -> '/var/cache/jenkins/war/css/style2.css'
    './css/style.css' -> '/var/cache/jenkins/war/css/style.css'
    + cp -vr ./images /var/cache/jenkins/war
    './images/LinuxFoundation.png' -> '/var/cache/jenkins/war/images/LinuxFoundation.png'
    './images/48x48/computer.png' -> '/var/cache/jenkins/war/images/48x48/computer.png'
    './images/48x48/computer.gif' -> '/var/cache/jenkins/war/images/48x48/computer.gif'
    './images/cogent-embedded.png' -> '/var/cache/jenkins/war/images/cogent-embedded.png'
    './images/Renesas.png' -> '/var/cache/jenkins/war/images/Renesas.png'
    './images/32x32/computer.png' -> '/var/cache/jenkins/war/images/32x32/computer.png'
    './images/32x32/computer.gif' -> '/var/cache/jenkins/war/images/32x32/computer.gif'
    './images/LTSI.jpg' -> '/var/cache/jenkins/war/images/LTSI.jpg'
    './images/originals/linuxfoundation.png' -> '/var/cache/jenkins/war/images/originals/linuxfoundation.png'
    './images/originals/cogent-embedded.png' -> '/var/cache/jenkins/war/images/originals/cogent-embedded.png'
    './images/originals/Renesas_Electronics_logo.png' -> '/var/cache/jenkins/war/images/originals/Renesas_Electronics_logo.png'
    './images/originals/ltsi.jpg' -> '/var/cache/jenkins/war/images/originals/ltsi.jpg'
    './images/24x24/plot.png' -> '/var/cache/jenkins/war/images/24x24/plot.png'
    './images/LTSI.png' -> '/var/cache/jenkins/war/images/LTSI.png'
    + fix_permissions /var/cache/jenkins/war/css
    + chown -fRH jenkins /var/cache/jenkins/war/css
    + fix_permissions /var/cache/jenkins/war/images
    + chown -fRH jenkins /var/cache/jenkins/war/images
    + pwd
    /fuego-install/jenkins-updates/en_US
    + cd ./core
    + jar xf /usr/share/jenkins/jenkins.war WEB-INF/lib/jenkins-core-1.509.2.jar
    + jar uf WEB-INF/lib/jenkins-core-1.509.2.jar hudson/AboutJenkins hudson/TcpSlaveAgentListener hudson/cli hudson/fsp hudson/init hudson/lifecycle hudson/matrix hudson/model hudson/views hudson/widgets
    + jar uf WEB-INF/lib/jenkins-core-1.509.2.jar jenkins/management jenkins/model
    + jar uf WEB-INF/lib/jenkins-core-1.509.2.jar lib/form lib/hudson lib/layout
    + echo 'copying WEB-INF/lib/jenkins-core-1.509.2.jar -> /var/cache/jenkins/war/WEB-INF/lib/jenkins-core-1.509.2.jar'
    copying WEB-INF/lib/jenkins-core-1.509.2.jar -> /var/cache/jenkins/war/WEB-INF/lib/jenkins-core-1.509.2.jar
    + cp WEB-INF/lib/jenkins-core-1.509.2.jar /var/cache/jenkins/war/WEB-INF/lib/jenkins-core-1.509.2.jar
    + fix_permissions /var/cache/jenkins/war/WEB-INF/lib/jenkins-core-1.509.2.jar
    + chown -fRH jenkins /var/cache/jenkins/war/WEB-INF/lib/jenkins-core-1.509.2.jar
    + fix_permissions /var/cache/jenkins/war
    + chown -fRH jenkins /var/cache/jenkins/war
    + rm WEB-INF/lib/jenkins-core-1.509.2.jar
    + cd ../..
    + service jenkins restart
    [....] Restarting Jenkins Continuous Integration Server: jenkins/var/lib/jenkins/ MOVED_FROM atomic6826409291480539227.tmp
    /var/lib/jenkins/config.xml is a symlink - everything is OK.
    Setting up watches.
    Watches established.
    . ok
    + sync_fetch_jenkins_cli
    + wget -v --no-proxy http://localhost:8080/fuego/jnlpJars/jenkins-cli.jar -O jenkins-cli.jar
    converted 'http://localhost:8080/fuego/jnlpJars/jenkins-cli.jar' (ANSI_X3.4-1968) -> 'http://localhost:8080/fuego/jnlpJars/jenkins-cli.jar' (UTF-8)
    --2017-02-28 22:22:19--  http://localhost:8080/fuego/jnlpJars/jenkins-cli.jar
    Resolving localhost (localhost)... 127.0.0.1
    Connecting to localhost (localhost)|127.0.0.1|:8080... failed: Connection refused.
    + echo 'Retrying wget -v --no-proxy http://localhost:8080/fuego/jnlpJars/jenkins-cli.jar -O jenkins-cli.jar'
    Retrying wget -v --no-proxy http://localhost:8080/fuego/jnlpJars/jenkins-cli.jar -O jenkins-cli.jar
    + service jenkins restart
    [ ok ] Restarting Jenkins Continuous Integration Server: jenkins.
    + sleep 10
    /var/lib/jenkins/ MOVED_FROM atomic9188040339173781680.tmp
    /var/lib/jenkins/config.xml is a symlink - everything is OK.
    Setting up watches.
    Watches established.
    /var/lib/jenkins/ MOVED_FROM queue.xml
    /var/lib/jenkins/config.xml is a symlink - everything is OK.
    Setting up watches.
    Watches established.
    /var/lib/jenkins/ MOVED_FROM atomic3837260763171307617.tmp
    /var/lib/jenkins/config.xml is a symlink - everything is OK.
    Setting up watches.
    Watches established.
    + wget -v --no-proxy http://localhost:8080/fuego/jnlpJars/jenkins-cli.jar -O jenkins-cli.jar
    converted 'http://localhost:8080/fuego/jnlpJars/jenkins-cli.jar' (ANSI_X3.4-1968) -> 'http://localhost:8080/fuego/jnlpJars/jenkins-cli.jar' (UTF-8)
    --2017-02-28 22:22:30--  http://localhost:8080/fuego/jnlpJars/jenkins-cli.jar
    Resolving localhost (localhost)... 127.0.0.1
    Connecting to localhost (localhost)|127.0.0.1|:8080... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 605730 (592K) [application/java-archive]
    Saving to: 'jenkins-cli.jar'
    
    jenkins-cli.jar                                  100%[============================================================================================================>] 591.53K  --.-KB/s   in 0.04s
    
    2017-02-28 22:22:31 (14.1 MB/s) - 'jenkins-cli.jar' saved [605730/605730]
    
    + xargs -n1 -t java -jar jenkins-cli.jar -s http://localhost:8080/fuego install-plugin
    + ls -1 plugins/locale.hpi plugins/page-markup.hpi plugins/sidebar-link.hpi
    java -jar jenkins-cli.jar -s http://localhost:8080/fuego install-plugin plugins/locale.hpi
    Installing a plugin from local file: plugins/locale.hpi
    java -jar jenkins-cli.jar -s http://localhost:8080/fuego install-plugin plugins/page-markup.hpi
    Installing a plugin from local file: plugins/page-markup.hpi
    java -jar jenkins-cli.jar -s http://localhost:8080/fuego install-plugin plugins/sidebar-link.hpi
    Installing a plugin from local file: plugins/sidebar-link.hpi
    + rm jenkins-cli.jar

TBWiki engine 1.8.3 by Tim Bird