organize your chickens - nuget for the enterprise (ugialtnet)

37

Click here to load reader

Upload: xavier-decoster

Post on 16-Apr-2017

2.626 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

www.ugialt.net

Page 2: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

NuGet for the EnterpriseOrganize Your Chickens

Page 3: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

Who am I?› Xavier Decoster› Antwerp, Belgium› Focus on

What matters

› www.xavierdecoster.com› @xavierdecoster

Page 4: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

Agenda› NuGet› Scenarios

Host your own NuGet repository Continuous {Package} Integration {Ab}using NuGet NuGet Inception

› Conclusion

Chickens?!

Page 5: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

Welcome to Dependency Hell

“A term for the frustration of software users who have installed software packages which have dependencies on specific versions of other software packages.” (Wikipedia)

Page 6: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

Cause and Effect› Reinventing the wheel

We don’t need that dependency “If they can do it, we can do it, but better” What happened to reuse of components?

› Marketing-Driven Versioning People are waiting for v2 to buy Let’s call it v4 Platform Update SP3

November Edition KB2348063 RTW Refresh We lost ownership of AssemblyVersion ?

Page 7: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

Package Management› NuGet to the Rescue!

› Simple concept Find Packages {Re}Use Packages Produce Packages

“NuGet is a Visual Studio extension that makes it easy to install and update open source libraries and tools in Visual Studio.”

Page 8: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

Semantic Versioning› Think about your versioning!

{semver.org}

Always specify lowerbound Use a version range {lowerbound +

upperbound} when versioning of package you depend on is messed up

Major Breaking changesMinor Backwards compatible API

additions/changesPatch Bugfixes not affecting the API

Page 9: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

Advanced usage scenarios› Host your own NuGet repository› Continuous {Package} Integration› {Ab}using NuGet

Page 10: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

Hosting your own repository

Page 11: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

Hosting your own repository› NuGet = public feed

Privacy Intellectual property

› NuGet maintained by package authors Author removes v1.0.45 and you depend

on it

Page 12: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

Solutions› Folder / File share› NuGet.Server package› NuGet Gallery {or Orchard Gallery}› MyGet

Page 13: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

NuGet.Server Demo// Install-Package NuGet.Server

Page 14: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

NuGet.Server limitations› Only 1 feed per installation› No UI

up to you to build it› No granular security

only 1 API-key for entire feed› Conclusion: requires you to develop if

you want something more useful

Page 15: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

Meet MyGet› www.myget.org› NaaS

Register and off you go!› Supports Enterprise scenarios

Granular security Package mirroring

Page 16: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

MyGet Demo// Sign in to myget.org and get started

Page 17: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

Continuous {Package} Integration

// To chicken, or not to check-in

Page 18: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

Typical source control...› Contains /References {if you are

lucky} ...and also Project/_bin_deployable_assemblies

...and also /References/old ...and also /..././../.././References

› Usually references GAC-ed assemblies

Page 19: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

Dependencies› Software has dependencies. Deal with it.

› But are those YOUR intellectual property? YOUR reason to build software? YOUR product?

› No. They are dependencies. And they don’t belong in source control.

Page 20: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

Continuous {Package} Integration› Can I get rid of all these referenced

assemblies duplicated all-over my source control system?Yes!

› Do I need to install and maintain NuGet on all my build agents?No!

Page 21: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

Enable-PackageRestore Demo

// Organize your build chickens!

Page 22: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

3rd parties don’t belong in your VCS› Replace them with NuGet packages› Do commit packages\repositories.config file

› Use Enable-PackageRestore› Set package-source location(s)

(NuGet.settings.targets in $(SolutionDir)\.nuget folder)

Page 23: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

Problem!› NuGet feed is subject to change...

PackageSource msbuild property to the rescue

› Now what... Host your own feed and mirror packages Or use MyGet for that

Page 24: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

Organize your chickens› Feed structuring

Scoped by quality: Build, QA, Production, …

Scoped by audience: public, restricted access

Other: Scoped by product version, milestone…Scoped by target platform

Page 25: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

{Ab}using NuGet// Not chickens…

Page 26: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

Guidance› Publishing a package brings great

responsibility Breaking changes in your packages

should be versioned accordingly! Consumers might choose to no longer

consume any packages you published

Page 27: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

Guidance› Package Integration ≠ Integration

Testing CI builds reflect output of source control

input Same input always produces same

output

Do not auto-update packages during automated builds

Page 28: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

The Male Optical IllusionStare at this picture. After about 30 seconds you should begin to see a Boat appear in the background. Amazing!*** Some men report it takes them several minutes to see the boat, so be patient and really focus!!! ***

Page 29: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

{Ab}using NuGet?› Change of perspective

NuGet is a package managerNuGet is a protocol for distributing packages

Page 30: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

NuGet as a Protocol// Automate anything: more time for a NaaP!

Page 31: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

Automate deployments› Build results in .nupkg› Octopus deploys to its tentacles

Test tentacles Staging tentacles Production tentacles

› www.octopusdeploy.com

Page 32: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)
Page 33: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

Chocolatey› NuGet

developer library packages› Chocolatey

applications and tools packager “yum” or “apt-get” for Windows

› www.chocolatey.org

Page 34: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

Chocolatey Demo// Nom-nom NuGet dessert

Page 35: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

NuGet Inception

Build

Test

Package

Push

Release / Publish

Deploy

DEMO› Continuous

Delivery of the MyGet website using: TeamCity NuGet MyGet Octopus

Page 36: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

Dependencies & people are chickensDeal with them! NuGet can help

Set up your own NuGet repository

Continuous package integration

NuGet is a package managerNuGet is a protocol

Conclusion

Page 37: Organize your Chickens - NuGet for the Enterprise (UGIALTNET)

Thank you!// No chickens were hurt // in the making of this presentation

http://www.xavierdecoster.com@xavierdecoster

Stay for the price draw for a chance to win a copy