// The main build script for Helix Web Services // // This is actually interpolated as a String for some per-cluster configuration. // See the 'jenkins_workflow' Ruby application for all the params that get sent in. try { node('master') { testAndBuildTarball() } // // Build and test the Ubuntu 12 package // node('build-omnibus-ubuntu12') { createOmnibusPackage() archive 'helix-web-services/packaging/omnibus-helix-web-services/pkg/helix-web-services*precise_amd64.deb' } node('test-omnibus-ubuntu12') { cleanHwsInstallUbuntu() installDefaultHwsUbuntu('helix-web-services*precise_amd64.deb') } node('master') { initializeRemoteP4d('#{test_ubuntu12}') execRemoteClientTests('#{test_ubuntu12}', 'helix_web_services_client_specs-ubuntu12.html') } // // Build and test the Ubuntu 14 package // node('build-omnibus-ubuntu14') { createOmnibusPackage() archive 'helix-web-services/packaging/omnibus-helix-web-services/pkg/helix-web-services*trusty_amd64.deb' } node('test-omnibus-ubuntu14') { cleanGitFusionInstallUbuntu() cleanHwsInstallUbuntu() installDefaultHwsUbuntu('helix-web-services*trusty_amd64.deb') // Ubuntu 14 just doesn't seem to quite start up Nginx consistently sh """#!/bin/bash --login |set -v |set -e |sudo service nginx restart """.stripMargin() } node('master') { initializeRemoteP4d('#{test_ubuntu14}') execRemoteClientTests('#{test_ubuntu14}', 'helix_web_services_client_specs-ubuntu14.html') } // // Build and test the CentOS 6 package // node('build-omnibus-centos6') { createOmnibusPackage() archive 'helix-web-services/packaging/omnibus-helix-web-services/pkg/helix-web-services*rpm' } node('test-omnibus-centos6') { cleanHwsInstallCentOS() installDefaultHwsCentOS('helix-web-services*.rpm') } node('master') { initializeRemoteP4d('#{test_centos6}') execRemoteClientTests('#{test_centos6}', 'helix_web_services_client_specs-centos6.html') } // // Exec tests with Git Fusion installed on Ubuntu 14 // node('test-omnibus-ubuntu14') { cleanHwsInstallUbuntu() installDefaultHwsUbuntu('helix-web-services*trusty_amd64.deb') installGitFusionUbuntu() configureGitFusionHws() // Ubuntu 14 just doesn't seem to quite start up Nginx consistently sh """#!/bin/bash --login |set -v |set -e |sudo service nginx restart """.stripMargin() } node('master') { initializeRemoteP4d('#{test_ubuntu14}') } node('test-omnibus-ubuntu14') { initializeGitFusion() } node('master') { execRemoteClientTestsGitFusion('#{test_ubuntu14}', 'helix_web_services_client_specs-git_fusion-ubuntu14.html') } // // We're OK by now // mail subject: "HWS Build ${env.BUILD_NUMBER} OK", to: '#{mailto}', body: "Jenkins job URL: ${env.BUILD_URL}" } catch (e) { def w = new StringWriter() e.printStackTrace(new PrintWriter(w)) mail subject: "HWS Build ${env.BUILD_NUMBER} Failed: ${e.message}", to: '#{mailto}', body: "Jenkins job URL: ${env.BUILD_URL}\\n\\n${w}" throw e } void testAndBuildTarball() { p4sync depotPath: '#{depot_path}', credential: '#{credential}' sh """#!/bin/bash --login |rvm use "2.2.3@#{job_name}" |set -e |gem install bundler |echo 'installing bundle dependencies' |bundle install |cd helix_web_services && bundle install && cd .. |cd helix_web_services/mock_raymond && bundle install && cd ../.. |cd helix_web_services_client && bundle install && cd .. |rake clean |rake test |rm -rf pkg |cd helix_web_services && BRANCH=main rake build_version && cd .. |rake build |rake all:doc """.stripMargin() archive 'pkg/helix-web-services.tgz, **/doc-output/, **/spec-output/' } void cleanHwsInstallUbuntu() { sh """#!/bin/bash --login |set -x |sudo service nginx stop |sudo service helix_web_services stop |sudo userdel helixwebservices |sudo rm -rf /opt/perforce/helix-web-services/home |sudo dpkg -r helix-web-services perforce-server perforce-cli perforce-cli-base perforce-p4dctl perforce-server-base nginx nginx-full nginx-naxsi nginx-light nginx-extras nginx-core nginx-common |sudo dpkg -P helix-web-services perforce-server perforce-cli perforce-cli-base perforce-p4dctl perforce-server-base nginx nginx-full nginx-naxsi nginx-light nginx-extras nginx-core nginx-common |sudo rm -rf /var/lib/perforce |sudo rm -rf /var/log/perforce |sudo rm -rf /opt/perforce |sudo rm -rf /etc/perforce/p4dctl.conf.d |sudo rm -rf /var/tmp/helix-web-services* |sudo rm -rf /var/tmp/apt* |sudo rm -rf /tmp/helix-web-services* |sudo rm -rf /etc/nginx |rm -rf helix-web-services |echo "done!" """.stripMargin() } void cleanHwsInstallCentOS() { sh """#!/bin/bash --login |set -x |sudo p4dctl stop helix-web-services |sudo killall p4d |sudo initctl stop nginx |sudo initctl stop helix_web_services |sudo userdel helixwebservices |sudo rm -rf /opt/perforce/helix-web-services/home |sudo rpm -e helix-web-services perforce-server perforce-cli perforce-cli-base perforce-p4dctl perforce-server-base nginx |sudo rm -rf /var/lib/perforce |sudo rm -rf /var/log/perforce |sudo rm -rf /opt/perforce |sudo rm -rf /etc/perforce/p4dctl.conf.d |sudo rm -rf /var/tmp/helix-web-services* |sudo rm -rf /var/tmp/yum |sudo rm -rf /tmp/helix-web-services* |sudo rm -rf /etc/nginx |rm -rf helix-web-services """.stripMargin() } void cleanGitFusionInstallUbuntu() { sh """#!/bin/bash --login |set -x |sudo dpkg -r helix-git-fusion-3rdparty-python3-pytz helix-git-fusion-p4python helix-git-fusion-3rdparty-python3 helix-git-fusion-3rdparty-pygit2 helix-git-fusion-3rdparty-libgit2 helix-git-fusion-3rdparty-git helix-git-fusion-trigger helix-git-fusion-base helix-git-fusion |sudo dpkg -P helix-git-fusion-3rdparty-python3-pytz helix-git-fusion-p4python helix-git-fusion-3rdparty-python3 helix-git-fusion-3rdparty-pygit2 helix-git-fusion-3rdparty-libgit2 helix-git-fusion-3rdparty-git helix-git-fusion-trigger helix-git-fusion-base helix-git-fusion |sudo userdel git |echo 'done!' """.stripMargin() } void installDefaultHwsUbuntu(nameGlob) { def glob = "helix-web-services/packaging/omnibus-helix-web-services/pkg/${nameGlob}" echo "unarchiving all .debs" unarchive mapping: ['**/*.deb': '.'] echo "installing ${glob}" sh """#!/bin/bash --login |set -v |set -e |sudo dpkg -i ${glob} |sudo /opt/perforce/helix-web-services/bin/hws_configure |sudo service nginx start |sudo service helix_web_services start """.stripMargin() } void installGitFusionUbuntu() { sh """#!/bin/bash --login |set -v |set -e |sudo apt-get install helix-git-fusion -y """.stripMargin() } void configureGitFusionHws() { sh """#!/bin/bash --login |set -ev |sudo bash -c "echo 'ENABLE_GIT_FUSION: true' >> /etc/perforce/helix_web_services.conf" |sudo service helix_web_services restart |sudo service nginx restart """.stripMargin() } void installDefaultHwsCentOS(nameGlob) { def glob = "**/${nameGlob}" unarchive mapping: ['**/*.rpm': '.'] sh """#!/bin/bash --login |set -v |set -e |sudo rpm -i helix-web-services/packaging/omnibus-helix-web-services/pkg/${nameGlob} |sudo /opt/perforce/helix-web-services/bin/hws_configure |sudo service nginx start |sudo initctl reload-configuration |sudo initctl start helix_web_services """.stripMargin() } void createOmnibusPackage() { unarchive mapping: ["**/helix-web-services.tgz": '.'] sh """#!/bin/bash --login |rvm use "2.2.3@#{job_name}" |gem install bundler |rm -rf helix-web-services* |set -e |tar xzf pkg/helix-web-services.tgz |rm -rf pkg |cd helix-web-services |rake set_writable |cd packaging/omnibus-helix-web-services |bundle install --without development |export BUILD_ID=`date +'%Y-%m-%d_%H-%M-%S'` |omnibus build helix-web-services """.stripMargin() } void execRemoteClientTests(testNode, testFileName) { unarchive mapping: ['**/helix-web-services.tgz': '.'] sh """#!/bin/bash --login |rvm use "2.2.3@#{job_name}" |gem install bundler |rm -rf helix-web-services* |set -e |tar xzf pkg/helix-web-services.tgz |cd helix-web-services |echo 'installing bundle dependencies' |bundle install |rake set_writable |cd helix_web_services && bundle install && cd .. |cd helix_web_services_client && bundle install && cd .. |set -x |rake clean |rake 'remotetest[${testNode}]' |mv helix_web_services_client/spec-output/helix_web_services_client_specs.html helix_web_services_client/spec-output/${testFileName} """.stripMargin() archive '**/spec-output/' } void execRemoteClientTestsGitFusion(testNode, testFileName) { unarchive mapping: ['**/helix-web-services.tgz': '.'] sh """#!/bin/bash --login |rvm use "2.2.3@#{job_name}" |gem install bundler |echo 'installing bundle dependencies' |bundle install |rake set_writable |cd helix_web_services && bundle install && cd .. |cd helix_web_services_client && bundle install && cd .. |set -x |rake clean |ENABLE_GIT_FUSION=true rake 'remotetest[${testNode}]' |mv helix_web_services_client/spec-output/helix_web_services_client_specs.html helix_web_services_client/spec-output/${testFileName} """.stripMargin() archive '**/spec-output/' } void initializeRemoteP4d(remoteHost) { unarchive mapping: ['**/helix-web-services.tgz': '.'] sh """#!/bin/bash --login |rvm use "2.2.3@#{job_name}" |set -ex |p4util init -p ${remoteHost}:1666 -a data/p4init.pkg """.stripMargin() } void initializeGitFusion() { unarchive mapping: ['**/helix-web-services.tgz': '.'] sh """#!/bin/bash --login |set -ex |env |sudo /opt/perforce/git-fusion/libexec/configure-git-fusion.sh -n --super super --superpassword 'superuser1A!' --server local --p4port localhost:1666 --unknownuser unknown --timezone America/Los_Angeles --gfp4password 'rein4ce!' |echo "Yay git fusion configured" """.stripMargin() }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#3 | 16275 | Doug Scheirer | Merge from main | ||
#2 | 16079 | Doug Scheirer | Merge from main | ||
#1 | 16014 | Doug Scheirer | Merge down from main | ||
//guest/perforce_software/helix-web-services/main/infrastructure/jenkins_workflow/lib/jenkins_workflow/build.groovy | |||||
#4 | 15993 | tjuricek |
Restarting nginx on Ubuntu 14, and changing the unarchive glob. The revision seems to have triggered some funky behavior. Nginx doesn't seem to start up with SSL unless you restart it explicitly. The glob to get the rpm is different, somehow, from the last version (that worked, I haven't really changed where the files were stored at all). So, there may be other bugs lurking, but they are bugs in systems outside of this product. Ergo, I patch until it works. |
||
#3 | 15991 | tjuricek | Add contrib directory to source tarball. | ||
#2 | 15990 | tjuricek |
Add Git Fusion tests to workflow. Revise workflow script to make it easier to follow in Groovy. |
||
#1 | 15973 | tjuricek | Remove dotfiles from .gemspec |