Skip to content

Commit ec35e9f

Browse files
committed
Support for validation of manifests
1 parent 0c91d7c commit ec35e9f

29 files changed

+453
-187
lines changed

go.mod

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ require (
3535
github.com/bombsimon/logrusr/v4 v4.1.0
3636
github.com/go-chi/transport v0.5.0
3737
github.com/gofri/go-github-ratelimit v1.1.1
38-
github.com/google/go-cmp v0.7.0
3938
github.com/google/go-containerregistry v0.20.3
39+
github.com/google/go-containerregistry/pkg/authn/k8schain v0.0.0-20250225234217-098045d5e61f
4040
github.com/google/go-github/v70 v70.0.0
4141
github.com/hashicorp/go-cleanhttp v0.5.2
4242
github.com/jarcoal/httpmock v1.3.1
@@ -46,8 +46,12 @@ require (
4646
)
4747

4848
require (
49+
cloud.google.com/go/compute/metadata v0.6.0 // indirect
50+
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible // indirect
4951
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect
5052
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
53+
github.com/Azure/go-autorest/autorest/azure/auth v0.5.13 // indirect
54+
github.com/Azure/go-autorest/autorest/azure/cli v0.4.6 // indirect
5155
github.com/Azure/go-autorest/autorest/date v0.3.1 // indirect
5256
github.com/Azure/go-autorest/logger v0.2.2 // indirect
5357
github.com/Azure/go-autorest/tracing v0.6.1 // indirect
@@ -56,17 +60,21 @@ require (
5660
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.34 // indirect
5761
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.34 // indirect
5862
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 // indirect
63+
github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.29.2 // indirect
5964
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.3 // indirect
6065
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.15 // indirect
6166
github.com/aws/aws-sdk-go-v2/service/sso v1.25.2 // indirect
6267
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.30.0 // indirect
6368
github.com/aws/aws-sdk-go-v2/service/sts v1.33.17 // indirect
6469
github.com/aws/smithy-go v1.22.3 // indirect
70+
github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20250115170608-608f37feb051 // indirect
6571
github.com/beorn7/perks v1.0.1 // indirect
6672
github.com/blang/semver/v4 v4.0.0 // indirect
6773
github.com/cespare/xxhash/v2 v2.3.0 // indirect
74+
github.com/chrismellard/docker-credential-acr-env v0.0.0-20230304212654-82a0ddb27589 // indirect
6875
github.com/containerd/stargz-snapshotter/estargz v0.16.3 // indirect
6976
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
77+
github.com/dimchansky/utfbom v1.1.1 // indirect
7078
github.com/docker/cli v28.0.4+incompatible // indirect
7179
github.com/docker/distribution v2.8.3+incompatible // indirect
7280
github.com/docker/docker-credential-helpers v0.9.3 // indirect
@@ -84,6 +92,8 @@ require (
8492
github.com/golang/protobuf v1.5.4 // indirect
8593
github.com/google/btree v1.1.3 // indirect
8694
github.com/google/gnostic-models v0.6.9 // indirect
95+
github.com/google/go-cmp v0.7.0 // indirect
96+
github.com/google/go-containerregistry/pkg/authn/kubernetes v0.0.0-20241111191718-6bce25ecf029 // indirect
8797
github.com/google/go-querystring v1.1.0 // indirect
8898
github.com/google/gofuzz v1.2.0 // indirect
8999
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
@@ -126,7 +136,6 @@ require (
126136
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
127137
gopkg.in/inf.v0 v0.9.1 // indirect
128138
gopkg.in/yaml.v3 v3.0.1 // indirect
129-
gotest.tools/v3 v3.1.0 // indirect
130139
k8s.io/apiextensions-apiserver v0.32.3 // indirect
131140
k8s.io/klog/v2 v2.130.1 // indirect
132141
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect

go.sum

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
1+
cloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I=
2+
cloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg=
3+
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible h1:fcYLmCpyNYRnvJbPerq7U0hS+6+I79yEDJBqVNcqUzU=
4+
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
15
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c h1:udKWzYgxTojEKWjV8V+WSxDXJ4NFATAsZjh8iIbsQIg=
26
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
37
github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs=
48
github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
9+
github.com/Azure/go-autorest/autorest v0.11.28/go.mod h1:MrkzG3Y3AH668QyF9KRk5neJnGgmhQ6krbhR8Q5eMvA=
510
github.com/Azure/go-autorest/autorest v0.11.30 h1:iaZ1RGz/ALZtN5eq4Nr1SOFSlf2E4pDI3Tcsl+dZPVE=
611
github.com/Azure/go-autorest/autorest v0.11.30/go.mod h1:t1kpPIOpIVX7annvothKvb0stsrXa37i7b+xpmBW8Fs=
12+
github.com/Azure/go-autorest/autorest/adal v0.9.18/go.mod h1:XVVeme+LZwABT8K5Lc3hA4nAe8LDBVle26gTrguhhPQ=
713
github.com/Azure/go-autorest/autorest/adal v0.9.22/go.mod h1:XuAbAEUv2Tta//+voMI038TrJBqjKam0me7qR+L8Cmk=
814
github.com/Azure/go-autorest/autorest/adal v0.9.24 h1:BHZfgGsGwdkHDyZdtQRQk1WeUdW0m2WPAwuHZwUi5i4=
915
github.com/Azure/go-autorest/autorest/adal v0.9.24/go.mod h1:7T1+g0PYFmACYW5LlG2fcoPiPlFHjClyRGL7dRlP5c8=
16+
github.com/Azure/go-autorest/autorest/azure/auth v0.5.13 h1:Ov8avRZi2vmrE2JcXw+tu5K/yB41r7xK9GZDiBF7NdM=
17+
github.com/Azure/go-autorest/autorest/azure/auth v0.5.13/go.mod h1:5BAVfWLWXihP47vYrPuBKKf4cS0bXI+KM9Qx6ETDJYo=
18+
github.com/Azure/go-autorest/autorest/azure/cli v0.4.6 h1:w77/uPk80ZET2F+AfQExZyEWtn+0Rk/uw17m9fv5Ajc=
19+
github.com/Azure/go-autorest/autorest/azure/cli v0.4.6/go.mod h1:piCfgPho7BiIDdEQ1+g4VmKyD5y+p/XtSNqE6Hc4QD0=
1020
github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74=
1121
github.com/Azure/go-autorest/autorest/date v0.3.1 h1:o9Z8Jyt+VJJTCZ/UORishuHOusBwolhjokt9s5k8I4w=
1222
github.com/Azure/go-autorest/autorest/date v0.3.1/go.mod h1:Dz/RDmXlfiFFS/eW+b/xMUSFs1tboPVy6UjgADToWDM=
@@ -39,6 +49,8 @@ github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 h1:bIqFDwgGXXN1Kpp99pDOdKMTTb5d
3949
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3/go.mod h1:H5O/EsxDWyU+LP/V8i5sm8cxoZgc2fdNR9bxlOFrQTo=
4050
github.com/aws/aws-sdk-go-v2/service/ecr v1.43.0 h1:Ak4Ggvvbg8WYxPLoyLOtes1cIMQePvCAi/dUGqm8hOY=
4151
github.com/aws/aws-sdk-go-v2/service/ecr v1.43.0/go.mod h1:iQ1skgw1XRK+6Lgkb0I9ODatAP72WoTILh0zXQ5DtbU=
52+
github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.29.2 h1:h4q24ImESGfeamE0I0KJvsblO+03tn8J3+upacKf0vw=
53+
github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.29.2/go.mod h1:3jWiVYuMsv18/qYLY6xVNe84CG/wKaa7vnLaH2/XtxI=
4254
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.3 h1:eAh2A4b5IzM/lum78bZ590jy36+d/aFLgKF/4Vd1xPE=
4355
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.3/go.mod h1:0yKJC/kb8sAnmlYa6Zs3QVYqaC8ug2AbnNChv5Ox3uA=
4456
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.15 h1:dM9/92u2F1JbDaGooxTq18wmmFzbJRfXfVfy96/1CXM=
@@ -51,6 +63,8 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.33.17 h1:PZV5W8yk4OtH1JAuhV2PXwwO9v5
5163
github.com/aws/aws-sdk-go-v2/service/sts v1.33.17/go.mod h1:cQnB8CUnxbMU82JvlqjKR2HBOm3fe9pWorWBza6MBJ4=
5264
github.com/aws/smithy-go v1.22.3 h1:Z//5NuZCSW6R4PhQ93hShNbyBbn8BWCmCVCt+Q8Io5k=
5365
github.com/aws/smithy-go v1.22.3/go.mod h1:t1ufH5HMublsJYulve2RKmHDC15xu1f26kHCp/HgceI=
66+
github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20250115170608-608f37feb051 h1:brogdiBXQBvbc+5SQoHOdfxbi77GyaUx6CpuepoEoC4=
67+
github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20250115170608-608f37feb051/go.mod h1:B0Hkcs9+qs/7jvQ+YIIIJ2XKeSbJlkLMEKrz0+Ssgl0=
5468
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
5569
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
5670
github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=
@@ -59,6 +73,8 @@ github.com/bombsimon/logrusr/v4 v4.1.0 h1:uZNPbwusB0eUXlO8hIUwStE6Lr5bLN6IgYgG+7
5973
github.com/bombsimon/logrusr/v4 v4.1.0/go.mod h1:pjfHC5e59CvjTBIU3V3sGhFWFAnsnhOR03TRc6im0l8=
6074
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
6175
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
76+
github.com/chrismellard/docker-credential-acr-env v0.0.0-20230304212654-82a0ddb27589 h1:krfRl01rzPzxSxyLyrChD+U+MzsBXbm0OwYYB67uF+4=
77+
github.com/chrismellard/docker-credential-acr-env v0.0.0-20230304212654-82a0ddb27589/go.mod h1:OuDyvmLnMCwa2ep4Jkm6nyA0ocJuZlGyk2gGseVzERM=
6278
github.com/containerd/stargz-snapshotter/estargz v0.16.3 h1:7evrXtoh1mSbGj/pfRccTampEyKpjpOnS3CyiV1Ebr8=
6379
github.com/containerd/stargz-snapshotter/estargz v0.16.3/go.mod h1:uyr4BfYfOj3G9WBVE8cOlQmXAbPN9VEQpBBeJIuOipU=
6480
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
@@ -68,6 +84,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
6884
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
6985
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
7086
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
87+
github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U=
88+
github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE=
7189
github.com/docker/cli v28.0.4+incompatible h1:pBJSJeNd9QeIWPjRcV91RVJihd/TXB77q1ef64XEu4A=
7290
github.com/docker/cli v28.0.4+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
7391
github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk=
@@ -76,8 +94,8 @@ github.com/docker/docker-credential-helpers v0.9.3 h1:gAm/VtF9wgqJMoxzT3Gj5p4AqI
7694
github.com/docker/docker-credential-helpers v0.9.3/go.mod h1:x+4Gbw9aGmChi3qTLZj8Dfn0TD20M/fuWy0E5+WDeCo=
7795
github.com/emicklei/go-restful/v3 v3.12.2 h1:DhwDP0vY3k8ZzE0RunuJy8GhNpPL6zqLkDf9B/a0/xU=
7896
github.com/emicklei/go-restful/v3 v3.12.2/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
79-
github.com/evanphx/json-patch v0.5.2 h1:xVCHIVMUu1wtM/VkR9jVZ45N3FhZfYMMYGorLCR8P3k=
80-
github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMikGIFbs31qQ=
97+
github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84=
98+
github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
8199
github.com/evanphx/json-patch/v5 v5.9.11 h1:/8HVnzMq13/3x9TPvjG08wUGqBTmZBsCWzjTM0wiaDU=
82100
github.com/evanphx/json-patch/v5 v5.9.11/go.mod h1:3j+LviiESTElxA4p3EMKAB9HXj3/XEtnUf6OZxqIQTM=
83101
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
@@ -107,6 +125,7 @@ github.com/gofri/go-github-ratelimit v1.1.1/go.mod h1:wGZlBbzHmIVjwDR3pZgKY7RBTV
107125
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
108126
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
109127
github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
128+
github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
110129
github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
111130
github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI=
112131
github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
@@ -119,12 +138,15 @@ github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl76
119138
github.com/google/gnostic-models v0.6.9 h1:MU/8wDLif2qCXZmzncUQ/BOfxWfthHi63KqpoNbWqVw=
120139
github.com/google/gnostic-models v0.6.9/go.mod h1:CiWsm0s6BSQd1hRn8/QmxqB6BesYcbSZxsz9b0KuDBw=
121140
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
122-
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
123141
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
124142
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
125143
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
126144
github.com/google/go-containerregistry v0.20.3 h1:oNx7IdTI936V8CQRveCjaxOiegWwvM7kqkbXTpyiovI=
127145
github.com/google/go-containerregistry v0.20.3/go.mod h1:w00pIgBRDVUDFM6bq+Qx8lwNWK+cxgCuX1vd3PIBDNI=
146+
github.com/google/go-containerregistry/pkg/authn/k8schain v0.0.0-20250225234217-098045d5e61f h1:LA+8uYrQl2biusGs1VEnIUQHLu8RjaCUNqHsieRkaTI=
147+
github.com/google/go-containerregistry/pkg/authn/k8schain v0.0.0-20250225234217-098045d5e61f/go.mod h1:8mk2eu7HGqCp+JSWQVFCnKQwk/K6cIY6ID9aX72iTRo=
148+
github.com/google/go-containerregistry/pkg/authn/kubernetes v0.0.0-20241111191718-6bce25ecf029 h1:tmtax9EjrCFrrw72NeGso7qZUnJXTIP368kcjE4lZwE=
149+
github.com/google/go-containerregistry/pkg/authn/kubernetes v0.0.0-20241111191718-6bce25ecf029/go.mod h1:zD6WJVa49IK5fhrZOUaq7UcSgxZFlnS80EJBrcVFkFI=
128150
github.com/google/go-github/v70 v70.0.0 h1:/tqCp5KPrcvqCc7vIvYyFYTiCGrYvaWoYMGHSQbo55o=
129151
github.com/google/go-github/v70 v70.0.0/go.mod h1:xBUZgo8MI3lUL/hwxl3hlceJW1U8MVnXP3zUyI+rhQY=
130152
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
@@ -221,7 +243,6 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ
221243
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
222244
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
223245
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
224-
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
225246
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
226247
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
227248
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
@@ -290,7 +311,6 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
290311
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
291312
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
292313
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
293-
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
294314
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
295315
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
296316
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -324,7 +344,6 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm
324344
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
325345
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
326346
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
327-
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
328347
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
329348
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
330349
golang.org/x/tools v0.29.0 h1:Xx0h3TtM9rzQpQuR4dKLrdglAmCEN5Oi+P74JdhdzXE=

pkg/api/types.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,30 @@ type ImageTag struct {
1212
Timestamp time.Time `json:"timestamp"`
1313
OS OS `json:"os,omitempty"`
1414
Architecture Architecture `json:"architecture,omitempty"`
15+
16+
// If this is a Manifest list we need to keep them together
17+
Children []*ImageTag `json:"children,omitempty"`
18+
}
19+
20+
func (i *ImageTag) HasChildren() bool {
21+
return len(i.Children) > 0
22+
}
23+
24+
func (i *ImageTag) MatchesSHA(sha string) bool {
25+
if sha == i.SHA {
26+
return true
27+
}
28+
for _, known := range i.Children {
29+
if known.MatchesSHA(sha) {
30+
return true
31+
}
32+
}
33+
return false
34+
}
35+
36+
type Platform struct {
37+
OS OS
38+
Architecture Architecture
1539
}
1640

1741
type OS string

pkg/client/acr/acr.go

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ import (
2020
"github.com/jetstack/version-checker/pkg/client/util"
2121
)
2222

23+
// Ensure that we are an ImageClient
24+
var _ api.ImageClient = (*Client)(nil)
25+
2326
const (
2427
userAgent = "jetstack/version-checker"
2528
requiredScope = "repository:*:metadata_read"
@@ -48,11 +51,16 @@ type AccessTokenResponse struct {
4851
AccessToken string `json:"access_token"`
4952
}
5053

54+
// API Taken from documentation:
55+
// https://learn.microsoft.com/en-us/rest/api/containerregistry/manifests/get-list?view=rest-containerregistry-2019-08-15&tabs=HTTP
56+
5157
type ManifestResponse struct {
5258
Manifests []struct {
53-
Digest string `json:"digest"`
54-
CreatedTime time.Time `json:"createdTime"`
55-
Tags []string `json:"tags"`
59+
Digest string `json:"digest"`
60+
CreatedTime time.Time `json:"createdTime"`
61+
Tags []string `json:"tags"`
62+
Architecture api.Architecture `json:"architecture,omitempty"`
63+
OS api.OS `json:"os,omitempty"`
5664
} `json:"manifests"`
5765
}
5866

@@ -90,27 +98,47 @@ func (c *Client) Tags(ctx context.Context, host, repo, image string) ([]api.Imag
9098
host, err)
9199
}
92100

93-
var tags []api.ImageTag
101+
// Create a map of tags, so that when we come up with additional Tags
102+
// we can add them as Children
103+
tags := map[string]api.ImageTag{}
104+
94105
for _, manifest := range manifestResp.Manifests {
95-
if len(manifest.Tags) == 0 {
96-
tags = append(tags, api.ImageTag{
97-
SHA: manifest.Digest,
98-
Timestamp: manifest.CreatedTime,
99-
})
106+
// Base data shared across tags
107+
base := api.ImageTag{
108+
SHA: manifest.Digest,
109+
Timestamp: manifest.CreatedTime,
110+
OS: manifest.OS,
111+
Architecture: manifest.Architecture,
112+
}
100113

114+
// No tags, use digest as the key
115+
if len(manifest.Tags) == 0 {
116+
tags[base.SHA] = base
101117
continue
102118
}
103119

104120
for _, tag := range manifest.Tags {
105-
tags = append(tags, api.ImageTag{
106-
SHA: manifest.Digest,
107-
Timestamp: manifest.CreatedTime,
108-
Tag: tag,
109-
})
121+
current := base // copy the base
122+
current.Tag = tag // set tag value
123+
124+
// Already exists — add as child
125+
if parent, exists := tags[tag]; exists {
126+
parent.Children = append(parent.Children, &current)
127+
tags[tag] = parent
128+
} else {
129+
// First occurrence — assign as root
130+
tags[tag] = current
131+
}
110132
}
111133
}
112134

113-
return tags, nil
135+
// Convert Map to Slice
136+
taglist := make([]api.ImageTag, 0, len(tags))
137+
for _, tag := range tags {
138+
taglist = append(taglist, tag)
139+
}
140+
141+
return taglist, nil
114142
}
115143

116144
func (c *Client) getManifestsWithClient(ctx context.Context, client *acrClient, host, repo, image string) (*http.Response, error) {

pkg/client/docker/docker.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@ import (
1414

1515
"github.com/hashicorp/go-retryablehttp"
1616
"github.com/jetstack/version-checker/pkg/api"
17+
"github.com/jetstack/version-checker/pkg/client/util"
1718
)
1819

20+
// Ensure that we are an ImageClient
21+
var _ api.ImageClient = (*Client)(nil)
22+
1923
const (
2024
loginURL = "https://hub.docker.com/v2/users/login/"
2125
lookupURL = "https://registry.hub.docker.com/v2/repositories/%s/%s/tags?page_size=100"
@@ -93,20 +97,33 @@ func (c *Client) Tags(ctx context.Context, _, repo, image string) ([]api.ImageTa
9397
}
9498
}
9599

100+
tag := api.ImageTag{
101+
Tag: result.Name,
102+
Timestamp: timestamp,
103+
SHA: result.Digest, // This isn't _always_ returned
104+
OS: "",
105+
Architecture: "",
106+
}
107+
// Attempt to get OS/Arch, from the Tag Name
108+
tag.OS, tag.Architecture = util.OSArchFromTag(result.Name)
109+
96110
for _, image := range result.Images {
97111
// Image without digest contains no real image.
98112
if len(image.Digest) == 0 {
99113
continue
100114
}
101115

102-
tags = append(tags, api.ImageTag{
116+
tag.Children = append(tag.Children, &api.ImageTag{
103117
Tag: result.Name,
104118
SHA: image.Digest,
105119
Timestamp: timestamp,
106120
OS: image.OS,
107121
Architecture: image.Architecture,
108122
})
109123
}
124+
125+
// Append our Tag at the end...
126+
tags = append(tags, tag)
110127
}
111128

112129
url = response.Next

pkg/client/docker/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ type TagResponse struct {
1414
type Result struct {
1515
Name string `json:"name"`
1616
Timestamp string `json:"last_updated"`
17+
Digest string `json:"digest,omitempty"`
1718
Images []Image `json:"images"`
1819
}
1920

0 commit comments

Comments
 (0)