practice that requires developers to integrate code into a shared repository several times a day. Each check-in is then verified by an automated build, allowing teams to detect problems early.
single source repository • Automate the build • Make your build self-testing • Every commit should build on an integration machine • Keep the build fast • Test in a clone of the production environment • Make it easy for anyone to get the latest executable • Everyone can see what’s happening • Automate deployment
out code into their private workspaces. • When done, commit the changes to the repository. • The CI server monitors the repository and checks out changes as they occur. • The CI server builds the system and runs unit and integration tests. • The CI server releases deployable artefacts for testing. • The CI server assigns a build label to the version of the code it just built. • The CI server informs the team of the successful build. • If the build or tests fail, the CI server alerts the team. • The team fix the issue at the earliest opportunity. • Continue to continually integrate and test throughout the project.
• Don’t check in broken code • Don’t check in untested code • Don’t check in when the build is broken • Don’t go home after checking in until the system builds
server written in Java. It has an enormous community that contributes plugins. Initially, Jenkins was called Hudson, and was developed in side Sun Microsystems' offices. In early 2011, tensions between Oracle and the community lead to a project form, and Jenkins was born. Homepage: http://jenkins-ci.org GitHub: https://github.com/jenkinsci/jenkins
the homepage. 2. Run the WAR file standalone version java -jar jenkins.war Jenkins will store its files in the directory configured in the environment variable JENKINS_HOME, default is $HOME/.jenkins Detailed options available using the help flag java -jar jenkins.war --help
command line interface. To access it, point your browser to http://ip:port/cli More information about using the CLI is on the Jenkins Wiki http://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI Getting help java -jar jenkins-cli.jar -s http://ip:port help
-f jenkins_key.pem 2. Configure Jenkins user with public key http://ip:port/me/configure 3. Enable TCP port for JNLP in Jenkins global security 4. Use private key when executing CLI commands java -jar jenkins-cli.jar -s http://ip:port \ -i jenkins_key.pem list-plugins Jenkins CLI: Authenticating
do id 'f2361e6b-b8e0-4b2b-890b-82e85bc1a59f' description 'Wile E Coyote' password 'beepbeep' end # Create private key credentials jenkins_private_key_credentials 'wcoyote' do id 'fa3aab48-4edc-446d-b1e2-1d89d86f4458' description 'Wile E Coyote' private_key "-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQ..." end jenkins_credentials
download using `cookbook_file` template xml_filename do source 'jobdsl-config.xml.erb' end # Create a jenkins job jenkins_job 'bacon' do config File.join(Chef::Config[:file_cache_path], 'jobdsl-config.xml') action :create end
greenballs plugin jenkins_plugin 'greenballs' do version '1.15' end # Less typing, a whole bunch of plugins at once %w{ greenballs=1.15 credentials=1.28 }.each do |addon| name, ver = plugin.split('=') jenkins_plugin name do version ver end end jenkins_plugin
SSH jenkins_ssh_slave 'executor' do description 'Run test suites' remote_fs '/share/executor' labels ['executor', 'freebsd', 'jail'] # SSH specific attributes user 'jenkins' credentials 'wcoyote' host '172.11.12.53' # or 'slave.example.org' # or node['env][ node['env'] ]['slave_host'] end jenkins_slave
with specific attributes jenkins_user 'grumpy' do full_name 'Grumpy Dwarf' email '[email protected]' public_keys ['ssh-rsa AAAAB3NzaC1y...'] end data_bag('admins').each do |login| user = data_bag_item('admins', login) jenkins_user user.name end
common { // // Use the GitLab API to quest all projects that have a tag in their tag_list // static List<Object> projectsTagged( String tagName, String token, String gitlabURL = 'http://my-gitlab.example.com/api/v3' ) { def projectSearch = new URL("${gitlabApiURL}/projects/all?private_token=${token}") def projectResults = new groovy.json.JsonSlurper().parse(projectSearch.newReader()) return projectResults.findAll { project -> tagName in project.tag_list } } } // class common