Continuous Integration & Package Management 101

710 views

Published on

Introduction to Continuous Integration and package management with Nuget. enjoy!

Published in: Software, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
710
On SlideShare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
10
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Waterfall, Spiral, Incremental, Prototype
  • Paradigm change: integration as non event
  • Rebuild DatabaseBuild prod distributionPackage library and publish
  • Maintain a code repositoryThis practice advocates the use of a revision control system for the project's source code. All artifacts required to build the project should be placed in the repository. In this practice and in the revision control community, the convention is that the system should be buildable from a fresh checkout and not require additional dependencies. Extreme Programming advocate Martin Fowler also mentions that where branching is supported by tools, its use should be minimized.[4] Instead, it is preferred for changes to be integrated rather than for multiple versions of the software to be maintained simultaneously. The mainline (or trunk) should be the place for the working version of the software.Automate the buildA single command should have the capability of building the system. Many build-tools, such as make, have existed for many years. Other more recent tools are frequently used in continuous integration environments. Automation of the build should include automating the integration, which often includes deployment into a production-like environment. In many cases, the build script not only compiles binaries, but also generates documentation, website pages, statistics and distribution media (such as Debian DEB, Red Hat RPM or Windows MSI files).Make the build self-testingOnce the code is built, all tests should run to confirm that it behaves as the developers expect it to behave.Everyone commits to the baseline every dayBy committing regularly, every committer can reduce the number of conflicting changes. Checking in a week's worth of work runs the risk of conflicting with other features and can be very difficult to resolve. Early, small conflicts in an area of the system cause team members to communicate about the change they are making. Committing all changes at least once a day (once per feature built) is generally considered part of the definition of Continuous Integration. In addition performing a nightly build is generally recommended. These are lower bounds, the typical frequency is expected to be much higher.Every commit (to baseline) should be builtThe system should build commits to the current working version in order to verify that they integrate correctly. A common practice is to use Automated Continuous Integration, although this may be done manually. For many[who?], continuous integration is synonymous with using Automated Continuous Integration where a continuous integration server or daemon monitors the revision control system for changes, then automatically runs the build process.Keep the build fastThe build needs to complete rapidly, so that if there is a problem with integration, it is quickly identified.Test in a clone of the production environmentHaving a test environment can lead to failures in tested systems when they deploy in the production environment, because the production environment may differ from the test environment in a significant way. However, building a replica of a production environment is cost prohibitive. Instead, the pre-production environment should be built to be a scalable version of the actual production environment to both alleviate costs while maintaining technology stack composition and nuances.Everyone can see the results of the latest buildIt should be easy to find out whether the build breaks and, if so, who made the relevant change.Automate deploymentMost CI systems allow the running of scripts after a build finishes. In most situations, it is possible to write a script to deploy the application to a live test server that everyone can look at. A further advance in this way of thinking is Continuous deployment, which calls for the software to be deployed directly into production, often with additional automation to prevent defects or regressions.
  • Infrequent check-ins – leads to delayed integrationBroken builds – blocks teams from moving to other tasksMinimal feedback – prevents action from occurringSpam feedback – causes people to ignore messagesSlow Build Machine – creates build bottleneck and delays feedbackRelying on a bloated build - reduces rapid feedbackhttp://www.ibm.com/developerworks/library/j-ap11297/
  • Bamboo – byAtlassian, integrates with JiraCruisecontrol – xml configuration based CruiseControl.rb - lightweight, Ruby-based continuous integration server that can build any codebaseHudson – Java based, formerly open-sourced until Sun made it commercial Jenkins – Fork of Hudson, Java based.TeamCity – commercial product by JetBrainsXcode 5 also contains a proprietary continuous integration system, works closely with OS X Server for OS X Mavericks
  • Continuous Integration & Package Management 101

    1. 1. Continuous Integration 101 Maor Hayun 19/3/2014
    2. 2. Agenda Continuous Integration1 2 Dealing with Dependencies 3 Package Managing – using Nuget
    3. 3. 1 Continuous Integration
    4. 4. What did we have before?
    5. 5. Software development life cycle methodologies • Long development iterations • Integration as a phase • Each developer worked on his own environment • At most, Nightly build • “Don’t Break the Build” Culture
    6. 6. What is Continuous Integration? “Continuous integration (CI) is the practice, in software engineering, of merging all developer working copies with a shared mainline several times a day” Martin Fowler, May 2006
    7. 7. Main Goal • Detect integration errors as quickly as possible • Ability to deploy software to production at any time Treat Integration as Non-Event
    8. 8. What’s Integration All About
    9. 9. How often is continuously? As frequently as possible or… at least daily
    10. 10. CI Core Practices • Maintain a code repository • Single point of truth, no developer branch, shared ownership • Automate the Build • Make your build self-testing • Unit & Integration tests, failed test breaks the build • Every commit should build on an integration machine • Keep the build fast • Test in a clone of the production environment • Everyone can see what’s happening • Automate deployment
    11. 11. Well…
    12. 12. The Agile Maturity Model Level -1 Regressive unrepeatable, poorly controlled and reactive • Manual processes for building software • No management of artifacts and reports Level 0 Repeatable process documented and partly automated • Regular automated build and testing • Any build can be recreated from source control using automated process Level 1 Consistent automated processes applied across whole application lifecycle • Automated build and test cycle every time a change is committed • Dependencies managed • Reuse of scripts and tools Level 2 Quantitatively Managed process measured and controlled • Build metrics gathered, made visible and acted on • Builds are not left broken Level 3 Optimizing focus on process improvement • Teams regularly meet to discuss integration problems and resolve them with automation • Faster feedback and better visibility By Jez Humble and Rolf Russell | September 2009 http://info.thoughtworks.com/rs/thoughtworks2/images/agile_maturity_model.pdf
    13. 13. • Immediate feedback on code quality & functionality • Developers detect and fix integration problems continuously • Constant availability of a "current" build • Immediate unit testing • Frequent code commits leads modular, less complex code • Metrics • Initial setup time required • Requires Team’s responsibility and maintenance
    14. 14. CI Anti-Patterns • Infrequent commits • Broken builds • Minimal feedback • Spam feedback • Slow Build Machine • Relying on a bloated build
    15. 15. CI Tools
    16. 16. Demo – TeamCity
    17. 17. 2 Dealing with Dependencies
    18. 18. Dependency Hell 1. Too many dependencies Lengthy downloads, not portable easily “A term for the frustration of software users who have installed software packages which have dependencies on specific versions of other packages.”
    19. 19. Dependency Hell 1. Too many dependencies Lengthy downloads, not portable easily 2. Long dependency chain app depends on LibA -> LibB -> … > LibZ “A term for the frustration of software users who have installed software packages which have dependencies on specific versions of other packages.”
    20. 20. Dependency Hell 1. Too many dependencies Lengthy downloads, not portable easily 2. Long dependency chain app depends on LibA -> LibB -> … > LibZ 3. Conflicting dependencies app1 depends on libFoo 1.2, app2 depends on libFoo 1.3 “A term for the frustration of software users who have installed software packages which have dependencies on specific versions of other packages.”
    21. 21. Dependency Hell 1. Too many dependencies Lengthy downloads, not portable easily 2. Long dependency chain app depends on LibA -> LibB -> … > LibZ 3. Conflicting dependencies app1 depends on libFoo 1.2, app2 depends on libFoo 1.3 4. Circular dependencies “A term for the frustration of software users who have installed software packages which have dependencies on specific versions of other packages.”
    22. 22. 3 Package Management USING NUGET
    23. 23. Nuget • Package Manager for Microsoft ecosystem • In Nuget Gallery: ~20600 unique packages, ~175K in total • Provides a centeral location to store common knowledge • code, assemblies, configuration and automation scripts • Provides concrete solutions rather than guidance, samples or abstract standarts
    24. 24. Nuget Package Basically, just a simple zip file containg: • content and source files – to be injected into target project • PowerShell scripts and executables • Configuration files and source code transformations • Using David Ebbo’s WebActivator – light-up-your-nupacks-with-startup-code-and-webactivator.aspx
    25. 25. Nuget Package Structure Folder structure • Tools (init.ps1, install.ps1, uninstall.ps1) • Content • Manifest (.nuspec file) • Lib
    26. 26. Nuget Package Manifest Nuspec manifest file • Xml file (with XSD available) • Package metadata • Can be generated from csproj file
    27. 27. Demo - Nuget
    28. 28. Resources • Continuous Integration: Improving Software Quality and Reduce Risks • By Paul M. Duval, Steve Matyas, Andrew Glover • Continuous Integration Manifest • http://martinfowler.com/articles/continuousIntegration.html • TeamCity • http://www.jetbrains.com/teamcity/ • Nuget • http://www.nuget.org/ • MyGet • http://www.myget.org/

    ×