diff --git a/.all-contributorsrc b/.all-contributorsrc deleted file mode 100644 index 270f462..0000000 --- a/.all-contributorsrc +++ /dev/null @@ -1,889 +0,0 @@ -{ - "files": [ - "README.md" - ], - "imageSize": 100, - "commit": false, - "contributors": [ - { - "login": "piksel", - "name": "nils måsén", - "avatar_url": "https://avatars2.githubusercontent.com/u/807383?v=4", - "profile": "https://piksel.se", - "contributions": [ - "code", - "doc", - "maintenance", - "review" - ] - }, - { - "login": "simskij", - "name": "Simon Aronsson", - "avatar_url": "https://avatars0.githubusercontent.com/u/1596025?v=4", - "profile": "http://simme.dev", - "contributions": [ - "code", - "doc", - "maintenance", - "review" - ] - }, - { - "login": "Codelica", - "name": "James", - "avatar_url": "https://avatars3.githubusercontent.com/u/386101?v=4", - "profile": "http://codelica.com", - "contributions": [ - "test", - "ideas" - ] - }, - { - "login": "KopfKrieg", - "name": "Florian", - "avatar_url": "https://avatars2.githubusercontent.com/u/5047813?v=4", - "profile": "https://kopfkrieg.org", - "contributions": [ - "review", - "doc" - ] - }, - { - "login": "bdehamer", - "name": "Brian DeHamer", - "avatar_url": "https://avatars1.githubusercontent.com/u/398027?v=4", - "profile": "https://github.com/bdehamer", - "contributions": [ - "code", - "maintenance" - ] - }, - { - "login": "rosscado", - "name": "Ross Cadogan", - "avatar_url": "https://avatars1.githubusercontent.com/u/16578183?v=4", - "profile": "https://github.com/rosscado", - "contributions": [ - "code" - ] - }, - { - "login": "stffabi", - "name": "stffabi", - "avatar_url": "https://avatars0.githubusercontent.com/u/9464631?v=4", - "profile": "https://github.com/stffabi", - "contributions": [ - "code", - "maintenance" - ] - }, - { - "login": "ATCUSA", - "name": "Austin", - "avatar_url": "https://avatars3.githubusercontent.com/u/3581228?v=4", - "profile": "https://github.com/ATCUSA", - "contributions": [ - "doc" - ] - }, - { - "login": "davidgardner11", - "name": "David Gardner", - "avatar_url": "https://avatars2.githubusercontent.com/u/6181487?v=4", - "profile": "https://labs.ctl.io", - "contributions": [ - "review", - "doc" - ] - }, - { - "login": "dolanor", - "name": "Tanguy ⧓ Herrmann", - "avatar_url": "https://avatars3.githubusercontent.com/u/928722?v=4", - "profile": "https://github.com/dolanor", - "contributions": [ - "code" - ] - }, - { - "login": "rdamazio", - "name": "Rodrigo Damazio Bovendorp", - "avatar_url": "https://avatars3.githubusercontent.com/u/997641?v=4", - "profile": "https://github.com/rdamazio", - "contributions": [ - "code", - "doc" - ] - }, - { - "login": "thelamer", - "name": "Ryan Kuba", - "avatar_url": "https://avatars3.githubusercontent.com/u/1852688?v=4", - "profile": "https://www.taisun.io/", - "contributions": [ - "infra" - ] - }, - { - "login": "cnrmck", - "name": "cnrmck", - "avatar_url": "https://avatars2.githubusercontent.com/u/22061955?v=4", - "profile": "https://github.com/cnrmck", - "contributions": [ - "doc" - ] - }, - { - "login": "haswalt", - "name": "Harry Walter", - "avatar_url": "https://avatars3.githubusercontent.com/u/338588?v=4", - "profile": "http://harrywalter.co.uk", - "contributions": [ - "code" - ] - }, - { - "login": "Robotex", - "name": "Robotex", - "avatar_url": "https://avatars3.githubusercontent.com/u/74515?v=4", - "profile": "http://projectsperanza.com", - "contributions": [ - "doc" - ] - }, - { - "login": "ubergesundheit", - "name": "Gerald Pape", - "avatar_url": "https://avatars0.githubusercontent.com/u/1494211?v=4", - "profile": "http://geraldpape.io", - "contributions": [ - "doc" - ] - }, - { - "login": "fomk", - "name": "fomk", - "avatar_url": "https://avatars0.githubusercontent.com/u/17636183?v=4", - "profile": "https://github.com/fomk", - "contributions": [ - "code" - ] - }, - { - "login": "svengo", - "name": "Sven Gottwald", - "avatar_url": "https://avatars3.githubusercontent.com/u/2502366?v=4", - "profile": "https://github.com/svengo", - "contributions": [ - "infra" - ] - }, - { - "login": "techknowlogick", - "name": "techknowlogick", - "avatar_url": "https://avatars1.githubusercontent.com/u/164197?v=4", - "profile": "https://liberapay.com/techknowlogick/", - "contributions": [ - "code" - ] - }, - { - "login": "waja", - "name": "waja", - "avatar_url": "https://avatars1.githubusercontent.com/u/1449568?v=4", - "profile": "http://log.c5t.org/about/", - "contributions": [ - "doc" - ] - }, - { - "login": "salbertson", - "name": "Scott Albertson", - "avatar_url": "https://avatars2.githubusercontent.com/u/154463?v=4", - "profile": "http://scottalbertson.com", - "contributions": [ - "doc" - ] - }, - { - "login": "huddlesj", - "name": "Jason Huddleston", - "avatar_url": "https://avatars1.githubusercontent.com/u/11966535?v=4", - "profile": "https://github.com/huddlesj", - "contributions": [ - "doc" - ] - }, - { - "login": "napstr", - "name": "Napster", - "avatar_url": "https://avatars3.githubusercontent.com/u/6048348?v=4", - "profile": "https://npstr.space/", - "contributions": [ - "code" - ] - }, - { - "login": "darknode", - "name": "Maxim", - "avatar_url": "https://avatars1.githubusercontent.com/u/809429?v=4", - "profile": "https://github.com/darknode", - "contributions": [ - "code", - "doc" - ] - }, - { - "login": "mxschmitt", - "name": "Max Schmitt", - "avatar_url": "https://avatars0.githubusercontent.com/u/17984549?v=4", - "profile": "https://schmitt.cat", - "contributions": [ - "doc" - ] - }, - { - "login": "cron410", - "name": "cron410", - "avatar_url": "https://avatars1.githubusercontent.com/u/3082899?v=4", - "profile": "https://github.com/cron410", - "contributions": [ - "doc" - ] - }, - { - "login": "Cardoso222", - "name": "Paulo Henrique", - "avatar_url": "https://avatars3.githubusercontent.com/u/7026517?v=4", - "profile": "https://github.com/Cardoso222", - "contributions": [ - "doc" - ] - }, - { - "login": "belak", - "name": "Kaleb Elwert", - "avatar_url": "https://avatars0.githubusercontent.com/u/107097?v=4", - "profile": "https://coded.io", - "contributions": [ - "doc" - ] - }, - { - "login": "wmbutler", - "name": "Bill Butler", - "avatar_url": "https://avatars1.githubusercontent.com/u/1254810?v=4", - "profile": "https://github.com/wmbutler", - "contributions": [ - "doc" - ] - }, - { - "login": "mariotacke", - "name": "Mario Tacke", - "avatar_url": "https://avatars2.githubusercontent.com/u/4942019?v=4", - "profile": "https://www.mariotacke.io", - "contributions": [ - "code" - ] - }, - { - "login": "mrw34", - "name": "Mark Woodbridge", - "avatar_url": "https://avatars2.githubusercontent.com/u/1101318?v=4", - "profile": "https://markwoodbridge.com", - "contributions": [ - "code" - ] - }, - { - "login": "Ansem93", - "name": "Ansem93", - "avatar_url": "https://avatars3.githubusercontent.com/u/6626218?v=4", - "profile": "https://github.com/Ansem93", - "contributions": [ - "doc" - ] - }, - { - "login": "lukapeschke", - "name": "Luka Peschke", - "avatar_url": "https://avatars1.githubusercontent.com/u/17085536?v=4", - "profile": "https://github.com/lukapeschke", - "contributions": [ - "code", - "doc" - ] - }, - { - "login": "zoispag", - "name": "Zois Pagoulatos", - "avatar_url": "https://avatars0.githubusercontent.com/u/21138205?v=4", - "profile": "https://github.com/zoispag", - "contributions": [ - "code", - "review", - "maintenance" - ] - }, - { - "login": "alexandremenif", - "name": "Alexandre Menif", - "avatar_url": "https://avatars0.githubusercontent.com/u/16152103?v=4", - "profile": "https://alexandre.menif.name", - "contributions": [ - "code" - ] - }, - { - "login": "chugunov", - "name": "Andrey", - "avatar_url": "https://avatars1.githubusercontent.com/u/4140479?v=4", - "profile": "https://github.com/chugunov", - "contributions": [ - "doc" - ] - }, - { - "login": "noplanman", - "name": "Armando Lüscher", - "avatar_url": "https://avatars3.githubusercontent.com/u/9423417?v=4", - "profile": "https://noplanman.ch", - "contributions": [ - "doc" - ] - }, - { - "login": "rjbudke", - "name": "Ryan Budke", - "avatar_url": "https://avatars2.githubusercontent.com/u/273485?v=4", - "profile": "https://github.com/rjbudke", - "contributions": [ - "doc" - ] - }, - { - "login": "kaloyan-raev", - "name": "Kaloyan Raev", - "avatar_url": "https://avatars2.githubusercontent.com/u/468091?v=4", - "profile": "http://kaloyan.raev.name", - "contributions": [ - "code", - "test" - ] - }, - { - "login": "sixth", - "name": "sixth", - "avatar_url": "https://avatars3.githubusercontent.com/u/11591445?v=4", - "profile": "https://github.com/sixth", - "contributions": [ - "doc" - ] - }, - { - "login": "foosel", - "name": "Gina Häußge", - "avatar_url": "https://avatars0.githubusercontent.com/u/83657?v=4", - "profile": "https://foosel.net", - "contributions": [ - "code" - ] - }, - { - "login": "8ear", - "name": "Max H.", - "avatar_url": "https://avatars0.githubusercontent.com/u/10329648?v=4", - "profile": "https://github.com/8ear", - "contributions": [ - "code" - ] - }, - { - "login": "pjknkda", - "name": "Jungkook Park", - "avatar_url": "https://avatars0.githubusercontent.com/u/4986524?v=4", - "profile": "https://pjknkda.github.io", - "contributions": [ - "doc" - ] - }, - { - "login": "jnidzwetzki", - "name": "Jan Kristof Nidzwetzki", - "avatar_url": "https://avatars1.githubusercontent.com/u/5753622?v=4", - "profile": "https://achfrag.net", - "contributions": [ - "doc" - ] - }, - { - "login": "mindrunner", - "name": "lukas", - "avatar_url": "https://avatars0.githubusercontent.com/u/1413542?v=4", - "profile": "https://www.lukaselsner.de", - "contributions": [ - "code" - ] - }, - { - "login": "codingCoffee", - "name": "Ameya Shenoy", - "avatar_url": "https://avatars3.githubusercontent.com/u/13611153?v=4", - "profile": "https://codingcoffee.dev", - "contributions": [ - "code" - ] - }, - { - "login": "raymondelooff", - "name": "Raymon de Looff", - "avatar_url": "https://avatars0.githubusercontent.com/u/9716806?v=4", - "profile": "https://github.com/raymondelooff", - "contributions": [ - "code" - ] - }, - { - "login": "jsclayton", - "name": "John Clayton", - "avatar_url": "https://avatars2.githubusercontent.com/u/704034?v=4", - "profile": "http://codemonkeylabs.com", - "contributions": [ - "code" - ] - }, - { - "login": "Germs2004", - "name": "Germs2004", - "avatar_url": "https://avatars2.githubusercontent.com/u/5519340?v=4", - "profile": "https://github.com/Germs2004", - "contributions": [ - "doc" - ] - }, - { - "login": "lukwil", - "name": "Lukas Willburger", - "avatar_url": "https://avatars1.githubusercontent.com/u/30203234?v=4", - "profile": "https://github.com/lukwil", - "contributions": [ - "code" - ] - }, - { - "login": "auanasgheps", - "name": "Oliver Cervera", - "avatar_url": "https://avatars2.githubusercontent.com/u/20586878?v=4", - "profile": "https://github.com/auanasgheps", - "contributions": [ - "doc" - ] - }, - { - "login": "victorcmoura", - "name": "Victor Moura", - "avatar_url": "https://avatars1.githubusercontent.com/u/26290053?v=4", - "profile": "https://github.com/victorcmoura", - "contributions": [ - "test", - "code", - "doc" - ] - }, - { - "login": "mbrandau", - "name": "Maximilian Brandau", - "avatar_url": "https://avatars3.githubusercontent.com/u/12972798?v=4", - "profile": "https://github.com/mbrandau", - "contributions": [ - "code", - "test" - ] - }, - { - "login": "aneisch", - "name": "Andrew", - "avatar_url": "https://avatars1.githubusercontent.com/u/6991461?v=4", - "profile": "https://github.com/aneisch", - "contributions": [ - "doc" - ] - }, - { - "login": "sixcorners", - "name": "sixcorners", - "avatar_url": "https://avatars0.githubusercontent.com/u/585501?v=4", - "profile": "https://github.com/sixcorners", - "contributions": [ - "doc" - ] - }, - { - "login": "arnested", - "name": "Arne Jørgensen", - "avatar_url": "https://avatars2.githubusercontent.com/u/190005?v=4", - "profile": "https://arnested.dk", - "contributions": [ - "test", - "review" - ] - }, - { - "login": "patski123", - "name": "PatSki123", - "avatar_url": "https://avatars1.githubusercontent.com/u/19295295?v=4", - "profile": "https://github.com/patski123", - "contributions": [ - "doc" - ] - }, - { - "login": "Saicheg", - "name": "Valentine Zavadsky", - "avatar_url": "https://avatars2.githubusercontent.com/u/624999?v=4", - "profile": "https://rubyroidlabs.com/", - "contributions": [ - "code", - "doc", - "test" - ] - }, - { - "login": "bopoh24", - "name": "Alexander Voronin", - "avatar_url": "https://avatars2.githubusercontent.com/u/4086631?v=4", - "profile": "https://github.com/bopoh24", - "contributions": [ - "code", - "bug" - ] - }, - { - "login": "ogmueller", - "name": "Oliver Mueller", - "avatar_url": "https://avatars0.githubusercontent.com/u/788989?v=4", - "profile": "http://www.teqneers.de", - "contributions": [ - "doc" - ] - }, - { - "login": "tammert", - "name": "Sebastiaan Tammer", - "avatar_url": "https://avatars0.githubusercontent.com/u/8885250?v=4", - "profile": "https://github.com/tammert", - "contributions": [ - "code" - ] - }, - { - "login": "miosame", - "name": "miosame", - "avatar_url": "https://avatars1.githubusercontent.com/u/8201077?v=4", - "profile": "https://github.com/Miosame", - "contributions": [ - "doc" - ] - }, - { - "login": "andrewjmetzger", - "name": "Andrew Metzger", - "avatar_url": "https://avatars3.githubusercontent.com/u/590246?v=4", - "profile": "https://mtz.gr", - "contributions": [ - "bug", - "example" - ] - }, - { - "login": "pgrimaud", - "name": "Pierre Grimaud", - "avatar_url": "https://avatars1.githubusercontent.com/u/1866496?v=4", - "profile": "https://github.com/pgrimaud", - "contributions": [ - "doc" - ] - }, - { - "login": "mattdoran", - "name": "Matt Doran", - "avatar_url": "https://avatars0.githubusercontent.com/u/577779?v=4", - "profile": "https://github.com/mattdoran", - "contributions": [ - "doc" - ] - }, - { - "login": "MihailITPlace", - "name": "MihailITPlace", - "avatar_url": "https://avatars2.githubusercontent.com/u/28401551?v=4", - "profile": "https://github.com/MihailITPlace", - "contributions": [ - "code" - ] - }, - { - "login": "bugficks", - "name": "bugficks", - "avatar_url": "https://avatars1.githubusercontent.com/u/2992895?v=4", - "profile": "https://github.com/bugficks", - "contributions": [ - "code", - "doc" - ] - }, - { - "login": "MichaelSp", - "name": "Michael", - "avatar_url": "https://avatars0.githubusercontent.com/u/448282?v=4", - "profile": "https://github.com/MichaelSp", - "contributions": [ - "code" - ] - }, - { - "login": "jokay", - "name": "D. Domig", - "avatar_url": "https://avatars0.githubusercontent.com/u/18613935?v=4", - "profile": "https://github.com/jokay", - "contributions": [ - "doc" - ] - }, - { - "login": "osheroff", - "name": "Ben Osheroff", - "avatar_url": "https://avatars1.githubusercontent.com/u/260084?v=4", - "profile": "https://maxwells-daemon.io", - "contributions": [ - "code" - ] - }, - { - "login": "dhet", - "name": "David H.", - "avatar_url": "https://avatars3.githubusercontent.com/u/2668621?v=4", - "profile": "https://github.com/dhet", - "contributions": [ - "code" - ] - }, - { - "login": "chander", - "name": "Chander Ganesan", - "avatar_url": "https://avatars1.githubusercontent.com/u/671887?v=4", - "profile": "http://www.gridgeo.com", - "contributions": [ - "doc" - ] - }, - { - "login": "yrien30", - "name": "yrien30", - "avatar_url": "https://avatars1.githubusercontent.com/u/26816162?v=4", - "profile": "https://github.com/yrien30", - "contributions": [ - "code" - ] - }, - { - "login": "ksurl", - "name": "ksurl", - "avatar_url": "https://avatars1.githubusercontent.com/u/1371562?v=4", - "profile": "https://github.com/ksurl", - "contributions": [ - "doc", - "code", - "infra" - ] - }, - { - "login": "rg9400", - "name": "rg9400", - "avatar_url": "https://avatars2.githubusercontent.com/u/39887349?v=4", - "profile": "https://github.com/rg9400", - "contributions": [ - "code" - ] - }, - { - "login": "tkalus", - "name": "Turtle Kalus", - "avatar_url": "https://avatars2.githubusercontent.com/u/287181?v=4", - "profile": "https://github.com/tkalus", - "contributions": [ - "code" - ] - }, - { - "login": "SrihariThalla", - "name": "Srihari Thalla", - "avatar_url": "https://avatars1.githubusercontent.com/u/7479937?v=4", - "profile": "https://github.com/SrihariThalla", - "contributions": [ - "doc" - ] - }, - { - "login": "nymous", - "name": "Thomas Gaudin", - "avatar_url": "https://avatars1.githubusercontent.com/u/4216559?v=4", - "profile": "https://nymous.io", - "contributions": [ - "doc" - ] - }, - { - "login": "hydrargyrum", - "name": "hydrargyrum", - "avatar_url": "https://avatars.githubusercontent.com/u/2804645?v=4", - "profile": "https://indigo.re/", - "contributions": [ - "doc" - ] - }, - { - "login": "reinout", - "name": "Reinout van Rees", - "avatar_url": "https://avatars.githubusercontent.com/u/121433?v=4", - "profile": "https://reinout.vanrees.org", - "contributions": [ - "doc" - ] - }, - { - "login": "DasSkelett", - "name": "DasSkelett", - "avatar_url": "https://avatars.githubusercontent.com/u/28812678?v=4", - "profile": "https://github.com/DasSkelett", - "contributions": [ - "code" - ] - }, - { - "login": "zenjabba", - "name": "zenjabba", - "avatar_url": "https://avatars.githubusercontent.com/u/679864?v=4", - "profile": "https://github.com/zenjabba", - "contributions": [ - "doc" - ] - }, - { - "login": "djquan", - "name": "Dan Quan", - "avatar_url": "https://avatars.githubusercontent.com/u/3526705?v=4", - "profile": "https://quan.io", - "contributions": [ - "doc" - ] - }, - { - "login": "modem7", - "name": "modem7", - "avatar_url": "https://avatars.githubusercontent.com/u/4349962?v=4", - "profile": "https://github.com/modem7", - "contributions": [ - "doc" - ] - }, - { - "login": "hypnoglow", - "name": "Igor Zibarev", - "avatar_url": "https://avatars.githubusercontent.com/u/4853075?v=4", - "profile": "https://github.com/hypnoglow", - "contributions": [ - "code" - ] - }, - { - "login": "patricegautier", - "name": "Patrice", - "avatar_url": "https://avatars.githubusercontent.com/u/38435239?v=4", - "profile": "https://github.com/patricegautier", - "contributions": [ - "code" - ] - }, - { - "login": "jamesmacwhite", - "name": "James White", - "avatar_url": "https://avatars.githubusercontent.com/u/8067792?v=4", - "profile": "http://jamesw.link/me", - "contributions": [ - "doc" - ] - }, - { - "login": "Foxite", - "name": "Dirk Kok", - "avatar_url": "https://avatars.githubusercontent.com/u/20421657?v=4", - "profile": "https://ko-fi.com/foxite", - "contributions": [ - "code" - ] - }, - { - "login": "EDIflyer", - "name": "EDIflyer", - "avatar_url": "https://avatars.githubusercontent.com/u/13610277?v=4", - "profile": "https://github.com/EDIflyer", - "contributions": [ - "doc" - ] - }, - { - "login": "jauderho", - "name": "Jauder Ho", - "avatar_url": "https://avatars.githubusercontent.com/u/13562?v=4", - "profile": "https://github.com/jauderho", - "contributions": [ - "code" - ] - }, - { - "login": "andriibratanin", - "name": "Andrii Bratanin", - "avatar_url": "https://avatars.githubusercontent.com/u/20169213?v=4", - "profile": "https://github.com/andriibratanin" - }, - { - "login": "IAmTamal", - "name": "Tamal Das ", - "avatar_url": "https://avatars.githubusercontent.com/u/72851613?v=4", - "profile": "https://tamal.vercel.app/", - "contributions": [ - "doc" - ] - }, - { - "login": "testwill", - "name": "guangwu", - "avatar_url": "https://avatars.githubusercontent.com/u/8717479?v=4", - "profile": "https://github.com/testwill", - "contributions": [ - "doc" - ] - }, - { - "login": "nothub", - "name": "Florian Hübner", - "avatar_url": "https://avatars.githubusercontent.com/u/48992448?v=4", - "profile": "http://hub.lol", - "contributions": [ - "doc", - "code" - ] - } - ], - "contributorsPerLine": 7, - "projectName": "watchtower", - "projectOwner": "containrrr", - "repoType": "github", - "repoHost": "https://github.com", - "commitConvention": "none", - "skipCi": true, - "commitType": "docs" -} diff --git a/internal/actions/mocks/container.go b/internal/actions/mocks/container.go index afa30a4..3d464c5 100644 --- a/internal/actions/mocks/container.go +++ b/internal/actions/mocks/container.go @@ -8,15 +8,15 @@ import ( "github.com/beatkind/watchtower/pkg/container" wt "github.com/beatkind/watchtower/pkg/types" - "github.com/docker/docker/api/types" dockerContainer "github.com/docker/docker/api/types/container" + dockerImage "github.com/docker/docker/api/types/image" "github.com/docker/go-connections/nat" ) // CreateMockContainer creates a container substitute valid for testing func CreateMockContainer(id string, name string, image string, created time.Time) wt.Container { - content := types.ContainerJSON{ - ContainerJSONBase: &types.ContainerJSONBase{ + content := dockerContainer.InspectResponse{ + ContainerJSONBase: &dockerContainer.ContainerJSONBase{ ID: id, Image: image, Name: name, @@ -38,24 +38,24 @@ func CreateMockContainer(id string, name string, image string, created time.Time } // CreateMockImageInfo returns a mock image info struct based on the passed image -func CreateMockImageInfo(image string) *types.ImageInspect { - return &types.ImageInspect{ - ID: image, - RepoDigests: []string{ - image, - }, - } +func CreateMockImageInfo(image string) *dockerImage.InspectResponse { + return &dockerImage.InspectResponse{ + ID: image, + RepoTags: []string{ + image, + }, + } } // CreateMockContainerWithImageInfo should only be used for testing -func CreateMockContainerWithImageInfo(id string, name string, image string, created time.Time, imageInfo types.ImageInspect) wt.Container { +func CreateMockContainerWithImageInfo(id string, name string, image string, created time.Time, imageInfo dockerImage.InspectResponse) wt.Container { return CreateMockContainerWithImageInfoP(id, name, image, created, &imageInfo) } // CreateMockContainerWithImageInfoP should only be used for testing -func CreateMockContainerWithImageInfoP(id string, name string, image string, created time.Time, imageInfo *types.ImageInspect) wt.Container { - content := types.ContainerJSON{ - ContainerJSONBase: &types.ContainerJSONBase{ +func CreateMockContainerWithImageInfoP(id string, name string, image string, created time.Time, imageInfo *dockerImage.InspectResponse) wt.Container { + content := dockerContainer.InspectResponse{ + ContainerJSONBase: &dockerContainer.ContainerJSONBase{ ID: id, Image: image, Name: name, @@ -81,12 +81,12 @@ func CreateMockContainerWithDigest(id string, name string, image string, created // CreateMockContainerWithConfig creates a container substitute valid for testing func CreateMockContainerWithConfig(id string, name string, image string, running bool, restarting bool, created time.Time, config *dockerContainer.Config) wt.Container { - content := types.ContainerJSON{ - ContainerJSONBase: &types.ContainerJSONBase{ + content := dockerContainer.InspectResponse{ + ContainerJSONBase: &dockerContainer.ContainerJSONBase{ ID: id, Image: image, Name: name, - State: &types.ContainerState{ + State: &dockerContainer.State{ Running: running, Restarting: restarting, }, @@ -120,9 +120,9 @@ func CreateContainerForProgress(index int, idPrefix int, nameFormat string) (wt. } // CreateMockContainerWithLinks should only be used for testing -func CreateMockContainerWithLinks(id string, name string, image string, created time.Time, links []string, imageInfo *types.ImageInspect) wt.Container { - content := types.ContainerJSON{ - ContainerJSONBase: &types.ContainerJSONBase{ +func CreateMockContainerWithLinks(id string, name string, image string, created time.Time, links []string, imageInfo *dockerImage.InspectResponse) wt.Container { + content := dockerContainer.InspectResponse{ + ContainerJSONBase: &dockerContainer.ContainerJSONBase{ ID: id, Image: image, Name: name, diff --git a/internal/actions/update_test.go b/internal/actions/update_test.go index 3123c94..a9bcae2 100644 --- a/internal/actions/update_test.go +++ b/internal/actions/update_test.go @@ -5,8 +5,8 @@ import ( "github.com/beatkind/watchtower/internal/actions" "github.com/beatkind/watchtower/pkg/types" - dockerTypes "github.com/docker/docker/api/types" dockerContainer "github.com/docker/docker/api/types/container" + dockerImage "github.com/docker/docker/api/types/image" "github.com/docker/go-connections/nat" . "github.com/beatkind/watchtower/internal/actions/mocks" @@ -44,7 +44,7 @@ func getLinkedTestData(withImageInfo bool) *TestData { "fake-image1:latest", time.Now().AddDate(0, 0, -1)) - var imageInfo *dockerTypes.ImageInspect + var imageInfo *dockerImage.InspectResponse if withImageInfo { imageInfo = CreateMockImageInfo("test-container-02") } diff --git a/pkg/container/client.go b/pkg/container/client.go index 0ca46ac..26e1595 100644 --- a/pkg/container/client.go +++ b/pkg/container/client.go @@ -77,7 +77,7 @@ const ( ) type dockerClient struct { - api sdkClient.CommonAPIClient + api sdkClient.APIClient ClientOptions } @@ -172,7 +172,7 @@ func (client dockerClient) GetContainer(containerID t.ContainerID) (t.Container, } } - imageInfo, _, err := client.api.ImageInspectWithRaw(bg, containerInfo.Image) + imageInfo, err := client.api.ImageInspect(bg, containerInfo.Image) if err != nil { log.Warnf("Failed to retrieve container image info: %v", err) return &Container{containerInfo: &containerInfo, imageInfo: nil}, nil @@ -332,7 +332,7 @@ func (client dockerClient) HasNewImage(ctx context.Context, container t.Containe currentImageID := t.ImageID(container.ContainerInfo().ContainerJSONBase.Image) imageName := container.ImageName() - newImageInfo, _, err := client.api.ImageInspectWithRaw(ctx, imageName) + newImageInfo, err := client.api.ImageInspect(ctx, imageName) if err != nil { return false, currentImageID, err } diff --git a/pkg/container/client_test.go b/pkg/container/client_test.go index d4bcb40..ba3f0dd 100644 --- a/pkg/container/client_test.go +++ b/pkg/container/client_test.go @@ -9,9 +9,8 @@ import ( "github.com/beatkind/watchtower/pkg/filters" t "github.com/beatkind/watchtower/pkg/types" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/backend" - "github.com/docker/docker/api/types/container" + dockerContainer "github.com/docker/docker/api/types/container" cli "github.com/docker/docker/client" "github.com/docker/docker/errdefs" "github.com/onsi/gomega/gbytes" @@ -79,8 +78,8 @@ var _ = Describe("the client", func() { When("removing a running container", func() { When("the container still exist after stopping", func() { It("should attempt to remove the container", func() { - container := MockContainer(WithContainerState(types.ContainerState{Running: true})) - containerStopped := MockContainer(WithContainerState(types.ContainerState{Running: false})) + container := MockContainer(WithContainerState(dockerContainer.State{Running: true})) + containerStopped := MockContainer(WithContainerState(dockerContainer.State{Running: false})) cid := container.ContainerInfo().ID mockServer.AppendHandlers( @@ -95,7 +94,7 @@ var _ = Describe("the client", func() { }) When("the container does not exist after stopping", func() { It("should not cause an error", func() { - container := MockContainer(WithContainerState(types.ContainerState{Running: true})) + container := MockContainer(WithContainerState(dockerContainer.State{Running: true})) cid := container.ContainerInfo().ID mockServer.AppendHandlers( @@ -271,7 +270,7 @@ var _ = Describe("the client", func() { // API.ContainerExecCreate ghttp.CombineHandlers( ghttp.VerifyRequest("POST", HaveSuffix("containers/%v/exec", containerID)), - ghttp.VerifyJSONRepresenting(container.ExecOptions{ + ghttp.VerifyJSONRepresenting(dockerContainer.ExecOptions{ User: user, Detach: false, Tty: true, @@ -281,12 +280,12 @@ var _ = Describe("the client", func() { cmd, }, }), - ghttp.RespondWithJSONEncoded(http.StatusOK, types.IDResponse{ID: execID}), + ghttp.RespondWithJSONEncoded(http.StatusOK, dockerContainer.CommitResponse{ID: execID}), ), // API.ContainerExecStart ghttp.CombineHandlers( ghttp.VerifyRequest("POST", HaveSuffix("exec/%v/start", execID)), - ghttp.VerifyJSONRepresenting(container.ExecStartOptions{ + ghttp.VerifyJSONRepresenting(dockerContainer.ExecStartOptions{ Detach: false, Tty: true, }), @@ -330,7 +329,7 @@ var _ = Describe("the client", func() { endpoints := map[string]*network.EndpointSettings{ `test`: {Aliases: aliases}, } - container.containerInfo.NetworkSettings = &types.NetworkSettings{Networks: endpoints} + container.containerInfo.NetworkSettings = &dockerContainer.NetworkSettings{Networks: endpoints} Expect(container.ContainerInfo().NetworkSettings.Networks[`test`].Aliases).To(Equal(aliases)) Expect(client.GetNetworkConfig(container).EndpointsConfig[`test`].Aliases).To(Equal([]string{"One", "Two", "Four"})) }) diff --git a/pkg/container/container.go b/pkg/container/container.go index 142ef67..3776905 100644 --- a/pkg/container/container.go +++ b/pkg/container/container.go @@ -11,14 +11,14 @@ import ( wt "github.com/beatkind/watchtower/pkg/types" "github.com/sirupsen/logrus" - "github.com/docker/docker/api/types" dockercontainer "github.com/docker/docker/api/types/container" + "github.com/docker/docker/api/types/image" "github.com/docker/go-connections/nat" ) // NewContainer returns a new Container instance instantiated with the // specified ContainerInfo and ImageInfo structs. -func NewContainer(containerInfo *types.ContainerJSON, imageInfo *types.ImageInspect) *Container { +func NewContainer(containerInfo *dockercontainer.InspectResponse, imageInfo *image.InspectResponse) *Container { return &Container{ containerInfo: containerInfo, imageInfo: imageInfo, @@ -30,8 +30,8 @@ type Container struct { LinkedToRestarting bool Stale bool - containerInfo *types.ContainerJSON - imageInfo *types.ImageInspect + containerInfo *dockercontainer.InspectResponse + imageInfo *image.InspectResponse } // IsLinkedToRestarting returns the current value of the LinkedToRestarting field for the container @@ -55,7 +55,7 @@ func (c *Container) SetStale(value bool) { } // ContainerInfo fetches JSON info for the container -func (c Container) ContainerInfo() *types.ContainerJSON { +func (c Container) ContainerInfo() *dockercontainer.InspectResponse { return c.containerInfo } @@ -368,7 +368,7 @@ func (c Container) HasImageInfo() bool { } // ImageInfo fetches the ImageInspect data of the current container -func (c Container) ImageInfo() *types.ImageInspect { +func (c Container) ImageInfo() *image.InspectResponse { return c.imageInfo } diff --git a/pkg/container/container_mock_test.go b/pkg/container/container_mock_test.go index 8aa1470..04641fd 100644 --- a/pkg/container/container_mock_test.go +++ b/pkg/container/container_mock_test.go @@ -1,16 +1,16 @@ package container import ( - "github.com/docker/docker/api/types" dockerContainer "github.com/docker/docker/api/types/container" + "github.com/docker/docker/api/types/image" "github.com/docker/go-connections/nat" ) -type MockContainerUpdate func(*types.ContainerJSON, *types.ImageInspect) +type MockContainerUpdate func(*dockerContainer.InspectResponse, *image.InspectResponse) func MockContainer(updates ...MockContainerUpdate) *Container { - containerInfo := types.ContainerJSON{ - ContainerJSONBase: &types.ContainerJSONBase{ + containerInfo := dockerContainer.InspectResponse{ + ContainerJSONBase: &dockerContainer.ContainerJSONBase{ ID: "container_id", Image: "image", Name: "test-containrrr", @@ -20,7 +20,7 @@ func MockContainer(updates ...MockContainerUpdate) *Container { Labels: map[string]string{}, }, } - image := types.ImageInspect{ + image := image.InspectResponse{ ID: "image_id", Config: &dockerContainer.Config{}, } @@ -32,7 +32,7 @@ func MockContainer(updates ...MockContainerUpdate) *Container { } func WithPortBindings(portBindingSources ...string) MockContainerUpdate { - return func(c *types.ContainerJSON, i *types.ImageInspect) { + return func(c *dockerContainer.InspectResponse, i *image.InspectResponse) { portBindings := nat.PortMap{} for _, pbs := range portBindingSources { portBindings[nat.Port(pbs)] = []nat.PortBinding{} @@ -42,38 +42,38 @@ func WithPortBindings(portBindingSources ...string) MockContainerUpdate { } func WithImageName(name string) MockContainerUpdate { - return func(c *types.ContainerJSON, i *types.ImageInspect) { + return func(c *dockerContainer.InspectResponse, i *image.InspectResponse) { c.Config.Image = name i.RepoTags = append(i.RepoTags, name) } } func WithLinks(links []string) MockContainerUpdate { - return func(c *types.ContainerJSON, i *types.ImageInspect) { + return func(c *dockerContainer.InspectResponse, i *image.InspectResponse) { c.HostConfig.Links = links } } func WithLabels(labels map[string]string) MockContainerUpdate { - return func(c *types.ContainerJSON, i *types.ImageInspect) { + return func(c *dockerContainer.InspectResponse, i *image.InspectResponse) { c.Config.Labels = labels } } -func WithContainerState(state types.ContainerState) MockContainerUpdate { - return func(cnt *types.ContainerJSON, img *types.ImageInspect) { +func WithContainerState(state dockerContainer.State) MockContainerUpdate { + return func(cnt *dockerContainer.InspectResponse, img *image.InspectResponse) { cnt.State = &state } } func WithHealthcheck(healthConfig dockerContainer.HealthConfig) MockContainerUpdate { - return func(cnt *types.ContainerJSON, img *types.ImageInspect) { + return func(cnt *dockerContainer.InspectResponse, img *image.InspectResponse) { cnt.Config.Healthcheck = &healthConfig } } func WithImageHealthcheck(healthConfig dockerContainer.HealthConfig) MockContainerUpdate { - return func(cnt *types.ContainerJSON, img *types.ImageInspect) { + return func(cnt *dockerContainer.InspectResponse, img *image.InspectResponse) { img.Config.Healthcheck = &healthConfig } } diff --git a/pkg/container/container_test.go b/pkg/container/container_test.go index a80bf39..d7721b3 100644 --- a/pkg/container/container_test.go +++ b/pkg/container/container_test.go @@ -2,7 +2,7 @@ package container import ( "github.com/beatkind/watchtower/pkg/types" - dc "github.com/docker/docker/api/types/container" + dockerContainer "github.com/docker/docker/api/types/container" "github.com/docker/go-connections/nat" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -71,51 +71,51 @@ var _ = Describe("the container", func() { Describe("GetCreateConfig", func() { When("container healthcheck config is equal to image config", func() { It("should return empty healthcheck values", func() { - c := MockContainer(WithHealthcheck(dc.HealthConfig{ + c := MockContainer(WithHealthcheck(dockerContainer.HealthConfig{ Test: []string{"/usr/bin/sleep", "1s"}, - }), WithImageHealthcheck(dc.HealthConfig{ + }), WithImageHealthcheck(dockerContainer.HealthConfig{ Test: []string{"/usr/bin/sleep", "1s"}, })) - Expect(c.GetCreateConfig().Healthcheck).To(Equal(&dc.HealthConfig{})) + Expect(c.GetCreateConfig().Healthcheck).To(Equal(&dockerContainer.HealthConfig{})) - c = MockContainer(WithHealthcheck(dc.HealthConfig{ + c = MockContainer(WithHealthcheck(dockerContainer.HealthConfig{ Timeout: 30, - }), WithImageHealthcheck(dc.HealthConfig{ + }), WithImageHealthcheck(dockerContainer.HealthConfig{ Timeout: 30, })) - Expect(c.GetCreateConfig().Healthcheck).To(Equal(&dc.HealthConfig{})) + Expect(c.GetCreateConfig().Healthcheck).To(Equal(&dockerContainer.HealthConfig{})) - c = MockContainer(WithHealthcheck(dc.HealthConfig{ + c = MockContainer(WithHealthcheck(dockerContainer.HealthConfig{ StartPeriod: 30, - }), WithImageHealthcheck(dc.HealthConfig{ + }), WithImageHealthcheck(dockerContainer.HealthConfig{ StartPeriod: 30, })) - Expect(c.GetCreateConfig().Healthcheck).To(Equal(&dc.HealthConfig{})) + Expect(c.GetCreateConfig().Healthcheck).To(Equal(&dockerContainer.HealthConfig{})) - c = MockContainer(WithHealthcheck(dc.HealthConfig{ + c = MockContainer(WithHealthcheck(dockerContainer.HealthConfig{ Retries: 30, - }), WithImageHealthcheck(dc.HealthConfig{ + }), WithImageHealthcheck(dockerContainer.HealthConfig{ Retries: 30, })) - Expect(c.GetCreateConfig().Healthcheck).To(Equal(&dc.HealthConfig{})) + Expect(c.GetCreateConfig().Healthcheck).To(Equal(&dockerContainer.HealthConfig{})) }) }) When("container healthcheck config is different to image config", func() { It("should return the container healthcheck values", func() { - c := MockContainer(WithHealthcheck(dc.HealthConfig{ + c := MockContainer(WithHealthcheck(dockerContainer.HealthConfig{ Test: []string{"/usr/bin/sleep", "1s"}, Interval: 30, Timeout: 30, StartPeriod: 10, Retries: 2, - }), WithImageHealthcheck(dc.HealthConfig{ + }), WithImageHealthcheck(dockerContainer.HealthConfig{ Test: []string{"/usr/bin/sleep", "10s"}, Interval: 10, Timeout: 60, StartPeriod: 30, Retries: 10, })) - Expect(c.GetCreateConfig().Healthcheck).To(Equal(&dc.HealthConfig{ + Expect(c.GetCreateConfig().Healthcheck).To(Equal(&dockerContainer.HealthConfig{ Test: []string{"/usr/bin/sleep", "1s"}, Interval: 30, Timeout: 30, @@ -126,7 +126,7 @@ var _ = Describe("the container", func() { }) When("container healthcheck config is empty", func() { It("should not panic", func() { - c := MockContainer(WithImageHealthcheck(dc.HealthConfig{ + c := MockContainer(WithImageHealthcheck(dockerContainer.HealthConfig{ Test: []string{"/usr/bin/sleep", "10s"}, Interval: 10, Timeout: 60, @@ -138,14 +138,14 @@ var _ = Describe("the container", func() { }) When("container image healthcheck config is empty", func() { It("should not panic", func() { - c := MockContainer(WithHealthcheck(dc.HealthConfig{ + c := MockContainer(WithHealthcheck(dockerContainer.HealthConfig{ Test: []string{"/usr/bin/sleep", "1s"}, Interval: 30, Timeout: 30, StartPeriod: 10, Retries: 2, })) - Expect(c.GetCreateConfig().Healthcheck).To(Equal(&dc.HealthConfig{ + Expect(c.GetCreateConfig().Healthcheck).To(Equal(&dockerContainer.HealthConfig{ Test: []string{"/usr/bin/sleep", "1s"}, Interval: 30, Timeout: 30, diff --git a/pkg/container/mocks/ApiServer.go b/pkg/container/mocks/ApiServer.go index 25a02ad..d9d321e 100644 --- a/pkg/container/mocks/ApiServer.go +++ b/pkg/container/mocks/ApiServer.go @@ -3,18 +3,19 @@ package mocks import ( "encoding/json" "fmt" - "github.com/onsi/ginkgo" "net/http" "net/url" "os" "path/filepath" "strings" + "github.com/onsi/ginkgo" + t "github.com/beatkind/watchtower/pkg/types" - "github.com/docker/docker/api/types" - I "github.com/docker/docker/api/types/image" + dockerContainer "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/filters" + dockerImage "github.com/docker/docker/api/types/image" O "github.com/onsi/gomega" "github.com/onsi/gomega/ghttp" ) @@ -166,7 +167,7 @@ func getContainerHandler(containerId string, responseHandler http.HandlerFunc) h } // GetContainerHandler mocks the GET containers/{id}/json endpoint -func GetContainerHandler(containerID string, containerInfo *types.ContainerJSON) http.HandlerFunc { +func GetContainerHandler(containerID string, containerInfo *dockerContainer.InspectResponse) http.HandlerFunc { responseHandler := containerNotFoundResponse(containerID) if containerInfo != nil { responseHandler = ghttp.RespondWithJSONEncoded(http.StatusOK, containerInfo) @@ -175,7 +176,7 @@ func GetContainerHandler(containerID string, containerInfo *types.ContainerJSON) } // GetImageHandler mocks the GET images/{id}/json endpoint -func GetImageHandler(imageInfo *types.ImageInspect) http.HandlerFunc { +func GetImageHandler(imageInfo *dockerImage.InspectResponse) http.HandlerFunc { return getImageHandler(t.ImageID(imageInfo.ID), ghttp.RespondWithJSONEncoded(http.StatusOK, imageInfo)) } @@ -196,8 +197,8 @@ func ListContainersHandler(statuses ...string) http.HandlerFunc { func respondWithFilteredContainers(filters filters.Args) http.HandlerFunc { containersJSON, err := getMockJSONFile("./mocks/data/containers.json") O.ExpectWithOffset(2, err).ShouldNot(O.HaveOccurred()) - var filteredContainers []types.Container - var containers []types.Container + var filteredContainers []dockerContainer.Summary + var containers []dockerContainer.Summary O.ExpectWithOffset(2, json.Unmarshal(containersJSON, &containers)).To(O.Succeed()) for _, v := range containers { for _, key := range filters.Get("status") { @@ -263,12 +264,12 @@ func RemoveImageHandler(imagesWithParents map[string][]string) http.HandlerFunc image := parts[len(parts)-1] if parents, found := imagesWithParents[image]; found { - items := []I.DeleteResponse{ + items := []dockerImage.DeleteResponse{ {Untagged: image}, {Deleted: image}, } for _, parent := range parents { - items = append(items, I.DeleteResponse{Deleted: parent}) + items = append(items, dockerImage.DeleteResponse{Deleted: parent}) } ghttp.RespondWithJSONEncoded(http.StatusOK, items)(w, r) } else { diff --git a/pkg/registry/manifest/manifest_test.go b/pkg/registry/manifest/manifest_test.go index 92eef97..fa918b8 100644 --- a/pkg/registry/manifest/manifest_test.go +++ b/pkg/registry/manifest/manifest_test.go @@ -6,7 +6,7 @@ import ( "github.com/beatkind/watchtower/internal/actions/mocks" "github.com/beatkind/watchtower/pkg/registry/manifest" - apiTypes "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/image" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) @@ -60,7 +60,7 @@ var _ = Describe("the manifest module", func() { }) func buildMockContainerManifestURL(imageRef string) (string, error) { - imageInfo := apiTypes.ImageInspect{ + imageInfo := image.InspectResponse{ RepoTags: []string{ imageRef, }, diff --git a/pkg/types/container.go b/pkg/types/container.go index 8a22f44..3dbc71b 100644 --- a/pkg/types/container.go +++ b/pkg/types/container.go @@ -3,8 +3,8 @@ package types import ( "strings" - "github.com/docker/docker/api/types" - dc "github.com/docker/docker/api/types/container" + dockerContainer "github.com/docker/docker/api/types/container" + "github.com/docker/docker/api/types/image" ) // ImageID is a hash string representing a container image @@ -44,7 +44,7 @@ func shortID(longID string) string { // Container is a docker container running an image type Container interface { - ContainerInfo() *types.ContainerJSON + ContainerInfo() *dockerContainer.InspectResponse ID() ContainerID IsRunning() bool Name() string @@ -59,7 +59,7 @@ type Container interface { IsWatchtower() bool StopSignal() string HasImageInfo() bool - ImageInfo() *types.ImageInspect + ImageInfo() *image.InspectResponse GetLifecyclePreCheckCommand() string GetLifecyclePostCheckCommand() string GetLifecyclePreUpdateCommand() string @@ -73,6 +73,6 @@ type Container interface { PreUpdateTimeout() int PostUpdateTimeout() int IsRestarting() bool - GetCreateConfig() *dc.Config - GetCreateHostConfig() *dc.HostConfig + GetCreateConfig() *dockerContainer.Config + GetCreateHostConfig() *dockerContainer.HostConfig }