mirror of https://github.com/knative/caching.git
use the new hack repo for scripts (#373)
This commit is contained in:
parent
20558e860c
commit
cc1d9d2e09
4
go.mod
4
go.mod
|
@ -15,8 +15,8 @@ require (
|
|||
k8s.io/client-go v11.0.1-0.20190805182717-6502b5e7b1b5+incompatible
|
||||
k8s.io/code-generator v0.18.8
|
||||
k8s.io/kube-openapi v0.0.0-20200410145947-bcb3869e6f29
|
||||
knative.dev/pkg v0.0.0-20201027121533-273ba59a1132
|
||||
knative.dev/test-infra v0.0.0-20201026182042-46291de4ab66
|
||||
knative.dev/hack v0.0.0-20201027221733-0d7f2f064b7b
|
||||
knative.dev/pkg v0.0.0-20201027223833-826303ca0653
|
||||
)
|
||||
|
||||
replace (
|
||||
|
|
38
go.sum
38
go.sum
|
@ -23,8 +23,6 @@ cloud.google.com/go v0.55.0/go.mod h1:ZHmoY+/lIMNkN2+fBmuTiqZ4inFhvQad8ft7MT8IV5
|
|||
cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk=
|
||||
cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs=
|
||||
cloud.google.com/go v0.60.0/go.mod h1:yw2G51M9IfRboUH61Us8GqCeF1PzPblB823Mn2q2eAU=
|
||||
cloud.google.com/go v0.61.0 h1:NLQf5e1OMspfNT1RAHOB3ublr1TW3YTXO8OiWwVjK2U=
|
||||
cloud.google.com/go v0.61.0/go.mod h1:XukKJg4Y7QsUu0Hxg3qQKUWR4VuWivmyMK2+rUyxAqw=
|
||||
cloud.google.com/go v0.62.0 h1:RmDygqvj27Zf3fCQjQRtLyC7KwFcHkeJitcO0OoGOcA=
|
||||
cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc=
|
||||
cloud.google.com/go v0.65.0 h1:Dg9iHVQfrhq82rUNu9ZxUDrJLaxFUe/HlCVaLyRruq8=
|
||||
|
@ -44,7 +42,6 @@ cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+
|
|||
cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
|
||||
cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU=
|
||||
cloud.google.com/go/pubsub v1.4.0/go.mod h1:LFrqilwgdw4X2cJS9ALgzYmMu+ULyrUN6IHV3CPK4TM=
|
||||
cloud.google.com/go/pubsub v1.6.1/go.mod h1:kvW9rcn9OLEx6eTIzMBbWbpB8YsK3vu9jxgPolVz+p4=
|
||||
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
|
||||
cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=
|
||||
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
|
||||
|
@ -97,7 +94,6 @@ github.com/Azure/go-autorest v10.15.5+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxS
|
|||
github.com/Azure/go-autorest v11.1.2+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
|
||||
github.com/Azure/go-autorest v12.0.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
|
||||
github.com/Azure/go-autorest v14.1.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
|
||||
github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
|
||||
github.com/Azure/go-autorest/autorest v0.1.0/go.mod h1:AKyIcETwSUFxIcs/Wnq/C+kwCtlEYGUVd7FPNb2slmg=
|
||||
github.com/Azure/go-autorest/autorest v0.2.0/go.mod h1:AKyIcETwSUFxIcs/Wnq/C+kwCtlEYGUVd7FPNb2slmg=
|
||||
github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI=
|
||||
|
@ -110,16 +106,13 @@ github.com/Azure/go-autorest/autorest/adal v0.8.0/go.mod h1:Z6vX6WXXuyieHAXwMj0S
|
|||
github.com/Azure/go-autorest/autorest/adal v0.8.1/go.mod h1:ZjhuQClTqx435SRJ2iMlOxPYt3d2C/T/7TiQCVZSn3Q=
|
||||
github.com/Azure/go-autorest/autorest/adal v0.8.2/go.mod h1:ZjhuQClTqx435SRJ2iMlOxPYt3d2C/T/7TiQCVZSn3Q=
|
||||
github.com/Azure/go-autorest/autorest/adal v0.8.3/go.mod h1:ZjhuQClTqx435SRJ2iMlOxPYt3d2C/T/7TiQCVZSn3Q=
|
||||
github.com/Azure/go-autorest/autorest/adal v0.9.5/go.mod h1:B7KF7jKIeC9Mct5spmyCB/A8CG/sEz1vwIRGv/bbw7A=
|
||||
github.com/Azure/go-autorest/autorest/azure/auth v0.4.2/go.mod h1:90gmfKdlmKgfjUpnCEpOJzsUEjrWDSLwHIG73tSXddM=
|
||||
github.com/Azure/go-autorest/autorest/azure/cli v0.3.1/go.mod h1:ZG5p860J94/0kI9mNJVoIoLgXcirM2gF5i2kWloofxw=
|
||||
github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA=
|
||||
github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g=
|
||||
github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74=
|
||||
github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
|
||||
github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
|
||||
github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM=
|
||||
github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k=
|
||||
github.com/Azure/go-autorest/autorest/to v0.1.0/go.mod h1:GunWKJp1AEqgMaGLV+iocmRAJWqST1wQYhyyjXJ3SJc=
|
||||
github.com/Azure/go-autorest/autorest/to v0.2.0/go.mod h1:GunWKJp1AEqgMaGLV+iocmRAJWqST1wQYhyyjXJ3SJc=
|
||||
github.com/Azure/go-autorest/autorest/to v0.3.0/go.mod h1:MgwOyqaIuKdG4TL/2ywSsIWKAfJfgHDo8ObuUk3t5sA=
|
||||
|
@ -128,7 +121,6 @@ github.com/Azure/go-autorest/autorest/validation v0.2.0/go.mod h1:3EEqHnBxQGHXRY
|
|||
github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc=
|
||||
github.com/Azure/go-autorest/tracing v0.1.0/go.mod h1:ROEEAFwXycQw7Sn3DXNtEedEvdeRAgDr0izn4z5Ij88=
|
||||
github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk=
|
||||
github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU=
|
||||
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
|
@ -214,7 +206,6 @@ github.com/aws/aws-sdk-go v1.23.20/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpi
|
|||
github.com/aws/aws-sdk-go v1.23.22/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
|
||||
github.com/aws/aws-sdk-go v1.25.11/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
|
||||
github.com/aws/aws-sdk-go v1.27.1/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
|
||||
github.com/aws/aws-sdk-go v1.28.2/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
|
||||
github.com/aws/aws-sdk-go v1.29.32/go.mod h1:1KvfttTE3SPKMpo8g2c6jL3ZKfXtFvKscTgahTma5Xg=
|
||||
github.com/aws/aws-sdk-go v1.29.34/go.mod h1:1KvfttTE3SPKMpo8g2c6jL3ZKfXtFvKscTgahTma5Xg=
|
||||
github.com/aws/aws-sdk-go v1.30.4/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
|
||||
|
@ -239,7 +230,6 @@ github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb/go.mod h1:PkYb9DJNAw
|
|||
github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
|
||||
github.com/blang/semver v3.5.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
|
||||
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
|
||||
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
|
||||
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
|
||||
github.com/bmizerany/perks v0.0.0-20141205001514-d9a9656a3a4b h1:AP/Y7sqYicnjGDfD5VcY4CIfh1hRXBUavxrvELjTiOE=
|
||||
github.com/bmizerany/perks v0.0.0-20141205001514-d9a9656a3a4b/go.mod h1:ac9efd0D1fsDb3EJvhqgXRbFx7bs2wqZ10HQPeU8U/Q=
|
||||
|
@ -377,7 +367,6 @@ github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwo
|
|||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
|
||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
|
||||
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
|
||||
github.com/fortytw2/leaktest v1.2.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
|
||||
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
|
||||
github.com/frankban/quicktest v1.8.1/go.mod h1:ui7WezCLWMWxVWr1GETZY3smRy0G4KWq9vcPtJmFl7Y=
|
||||
|
@ -396,10 +385,6 @@ github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0
|
|||
github.com/go-bindata/go-bindata/v3 v3.1.3/go.mod h1:1/zrpXsLD8YDIbhZRqXzm1Ghc7NhEvIN9+Z6R5/xH4I=
|
||||
github.com/go-critic/go-critic v0.4.1/go.mod h1:7/14rZGnZbY6E38VEGk2kVhoq6itzc1E68facVDK23g=
|
||||
github.com/go-critic/go-critic v0.4.3/go.mod h1:j4O3D4RoIwRqlZw5jJpx0BNfXWWbpcJoKu5cYSe4YmQ=
|
||||
github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E=
|
||||
github.com/go-git/go-billy/v5 v5.0.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0=
|
||||
github.com/go-git/go-git-fixtures/v4 v4.0.1/go.mod h1:m+ICp2rF3jDhFgEZ/8yziagdT1C+ZpZcrJjappBCDSw=
|
||||
github.com/go-git/go-git/v5 v5.1.0/go.mod h1:ZKfuPUoY1ZqIG4QG9BDBh3G4gLM5zvPuSJAozQrZuyM=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
|
@ -603,7 +588,6 @@ github.com/google/go-containerregistry v0.0.0-20200115214256-379933c9c22b/go.mod
|
|||
github.com/google/go-containerregistry v0.0.0-20200123184029-53ce695e4179/go.mod h1:Wtl/v6YdQxv397EREtzwgd9+Ud7Q5D8XMbi3Zazgkrs=
|
||||
github.com/google/go-containerregistry v0.0.0-20200331213917-3d03ed9b1ca2/go.mod h1:pD1UFYs7MCAx+ZLShBdttcaOSbyc8F9Na/9IZLNwJeA=
|
||||
github.com/google/go-containerregistry v0.1.1/go.mod h1:npTSyywOeILcgWqd+rvtzGWflIPPcBQhYoOONaY4ltM=
|
||||
github.com/google/go-containerregistry v0.1.4/go.mod h1:6EGiuQp36pL82lX6rFN0s9AJOVL0Mlgx/DAsYZW5X3s=
|
||||
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
|
||||
github.com/google/go-github/v27 v27.0.6/go.mod h1:/0Gr8pJ55COkmv+S/yPKCczSkUPIM/LnFyubufRNIS0=
|
||||
github.com/google/go-github/v28 v28.1.1/go.mod h1:bsqJWQX05omyWVmc00nEUql9mhQyv38lDZ8kPZcQVoM=
|
||||
|
@ -1212,7 +1196,6 @@ github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV
|
|||
github.com/vdemeester/k8s-pkg-credentialprovider v0.0.0-20200107171650-7c61ffa44238/go.mod h1:JwQJCMWpUDqjZrB5jpw0f5VbN7U95zxFy1ZDpoEarGo=
|
||||
github.com/vdemeester/k8s-pkg-credentialprovider v1.13.12-1/go.mod h1:Fko0rTxEtDW2kju5Ky7yFJNS3IcNvW8IPsp4/e9oev0=
|
||||
github.com/vdemeester/k8s-pkg-credentialprovider v1.17.4/go.mod h1:inCTmtUdr5KJbreVojo06krnTgaeAz/Z7lynpPk/Q2c=
|
||||
github.com/vdemeester/k8s-pkg-credentialprovider v1.18.1-0.20201019120933-f1d16962a4db/go.mod h1:grWy0bkr1XO6hqbaaCKaPXqkBVlMGHYG6PGykktwbJc=
|
||||
github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw=
|
||||
github.com/vmware/govmomi v0.20.3/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59bHWk6aFU=
|
||||
github.com/xanzy/go-gitlab v0.31.0/go.mod h1:sPLojNBn68fMUWSxIJtdVVIP8uSBYqesTfDUseX11Ug=
|
||||
|
@ -1512,8 +1495,6 @@ golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||
golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200610111108-226ff32320da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200802091954-4b90ce9b60b3 h1:qDJKu1y/1SjhWac4BQZjLljqvqiWUhjmDMnonmVGDAU=
|
||||
golang.org/x/sys v0.0.0-20200802091954-4b90ce9b60b3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200828194041-157a740278f4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f h1:Fqb3ao1hUmOR3GkUOg/Y+BadLwykBIzs5q8Ez2SbHyc=
|
||||
|
@ -1628,8 +1609,6 @@ golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roY
|
|||
golang.org/x/tools v0.0.0-20200626171337-aa94e735be7f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200701000337-a32c0cb1d5b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200709181711-e327e1019dfe/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200713011307-fd294ab11aed/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200725200936-102e7d357031/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
|
@ -1741,11 +1720,7 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc
|
|||
google.golang.org/genproto v0.0.0-20200626011028-ee7919e894b5/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200701001935-0939c5918c31/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200709005830-7a2ca40e9dc3/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200711021454-869866162049/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200726014623-da3ae01ef02d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200731012542-8145dea6a485 h1:wTk5DQB3+1darAz4Ldomo0r5bUOCKX7gilxQ4sb2kno=
|
||||
google.golang.org/genproto v0.0.0-20200731012542-8145dea6a485/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200831141814-d751682dd103/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
|
@ -1871,7 +1846,6 @@ k8s.io/client-go v0.18.8 h1:SdbLpIxk5j5YbFr1b7fq8S7mDgDjYmUxSbszyoesoDM=
|
|||
k8s.io/client-go v0.18.8/go.mod h1:HqFqMllQ5NnQJNwjro9k5zMyfhZlOwpuTLVrxjkYSxU=
|
||||
k8s.io/cloud-provider v0.17.0/go.mod h1:Ze4c3w2C0bRsjkBUoHpFi+qWe3ob1wI2/7cUn+YQIDE=
|
||||
k8s.io/cloud-provider v0.17.4/go.mod h1:XEjKDzfD+b9MTLXQFlDGkk6Ho8SGMpaU8Uugx/KNK9U=
|
||||
k8s.io/cloud-provider v0.18.8/go.mod h1:cn9AlzMPVIXA4HHLVbgGUigaQlZyHSZ7WAwDEFNrQSs=
|
||||
k8s.io/code-generator v0.18.8 h1:lgO1P1wjikEtzNvj7ia+x1VC4svJ28a/r0wnOLhhOTU=
|
||||
k8s.io/code-generator v0.18.8/go.mod h1:TgNEVx9hCyPGpdtCWA34olQYLkh3ok9ar7XfSsr8b6c=
|
||||
k8s.io/component-base v0.17.0/go.mod h1:rKuRAokNMY2nn2A6LP/MiwpoaMRHpfRnrPaUJJj1Yoc=
|
||||
|
@ -1880,7 +1854,6 @@ k8s.io/component-base v0.17.4/go.mod h1:5BRqHMbbQPm2kKu35v3G+CpVq4K0RJKC7TRioF0I
|
|||
k8s.io/component-base v0.18.8/go.mod h1:00frPRDas29rx58pPCxNkhUfPbwajlyyvu8ruNgSErU=
|
||||
k8s.io/csi-translation-lib v0.17.0/go.mod h1:HEF7MEz7pOLJCnxabi45IPkhSsE/KmxPQksuCrHKWls=
|
||||
k8s.io/csi-translation-lib v0.17.4/go.mod h1:CsxmjwxEI0tTNMzffIAcgR9lX4wOh6AKHdxQrT7L0oo=
|
||||
k8s.io/csi-translation-lib v0.18.8/go.mod h1:6cA6Btlzxy9s3QrS4BCZzQqclIWnTLr6Jx3H2ctAzY4=
|
||||
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
|
||||
k8s.io/gengo v0.0.0-20190306031000-7a1b7fb0289f/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
|
||||
k8s.io/gengo v0.0.0-20191108084044-e500ee069b5c/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
|
||||
|
@ -1902,7 +1875,6 @@ k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk=
|
|||
k8s.io/kubernetes v1.14.7/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk=
|
||||
k8s.io/legacy-cloud-providers v0.17.0/go.mod h1:DdzaepJ3RtRy+e5YhNtrCYwlgyK87j/5+Yfp0L9Syp8=
|
||||
k8s.io/legacy-cloud-providers v0.17.4/go.mod h1:FikRNoD64ECjkxO36gkDgJeiQWwyZTuBkhu+yxOc1Js=
|
||||
k8s.io/legacy-cloud-providers v0.18.8/go.mod h1:tgp4xYf6lvjrWnjQwTOPvWQE9IVqSBGPF4on0IyICQE=
|
||||
k8s.io/metrics v0.17.2/go.mod h1:3TkNHET4ROd+NfzNxkjoVfQ0Ob4iZnaHmSEA4vYpwLw=
|
||||
k8s.io/test-infra v0.0.0-20181019233642-2e10a0bbe9b3/go.mod h1:2NzXB13Ji0nqpyublHeiPC4FZwU0TknfvyaaNfl/BTA=
|
||||
k8s.io/test-infra v0.0.0-20191212060232-70b0b49fe247/go.mod h1:d8SKryJBXAwfCFVL4wieRez47J2NOOAb9d029sWLseQ=
|
||||
|
@ -1924,6 +1896,10 @@ knative.dev/caching v0.0.0-20190719140829-2032732871ff/go.mod h1:dHXFU6CGlLlbzaW
|
|||
knative.dev/caching v0.0.0-20200116200605-67bca2c83dfa/go.mod h1:dHXFU6CGlLlbzaWc32g80cR92iuBSpsslDNBWI8C7eg=
|
||||
knative.dev/eventing-contrib v0.6.1-0.20190723221543-5ce18048c08b/go.mod h1:SnXZgSGgMSMLNFTwTnpaOH7hXDzTFtw0J8OmHflNx3g=
|
||||
knative.dev/eventing-contrib v0.11.2/go.mod h1:SnXZgSGgMSMLNFTwTnpaOH7hXDzTFtw0J8OmHflNx3g=
|
||||
knative.dev/hack v0.0.0-20201027201633-1763a666eb41 h1:rr7i0FRR6oUgjK4s4kwudJR6i3AT1Ca/81h7NiWJyhU=
|
||||
knative.dev/hack v0.0.0-20201027201633-1763a666eb41/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
|
||||
knative.dev/hack v0.0.0-20201027221733-0d7f2f064b7b h1:tBUkvMhcWZny+7CJTs5Ona8S3OCKJkgAwgZ7mkgWL3Y=
|
||||
knative.dev/hack v0.0.0-20201027221733-0d7f2f064b7b/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
|
||||
knative.dev/pkg v0.0.0-20191101194912-56c2594e4f11/go.mod h1:pgODObA1dTyhNoFxPZTTjNWfx6F0aKsKzn+vaT9XO/Q=
|
||||
knative.dev/pkg v0.0.0-20191111150521-6d806b998379/go.mod h1:pgODObA1dTyhNoFxPZTTjNWfx6F0aKsKzn+vaT9XO/Q=
|
||||
knative.dev/pkg v0.0.0-20200207155214-fef852970f43/go.mod h1:pgODObA1dTyhNoFxPZTTjNWfx6F0aKsKzn+vaT9XO/Q=
|
||||
|
@ -1932,15 +1908,13 @@ knative.dev/pkg v0.0.0-20200505191044-3da93ebb24c2/go.mod h1:Q6sL35DdGs8hIQZKdaC
|
|||
knative.dev/pkg v0.0.0-20200515002500-16d7b963416f/go.mod h1:tMOHGbxtRz8zYFGEGpV/bpoTEM1o89MwYFC4YJXl3GY=
|
||||
knative.dev/pkg v0.0.0-20200528142800-1c6815d7e4c9/go.mod h1:QgNZTxnwpB/oSpNcfnLVlw+WpEwwyKAvJlvR3hgeltA=
|
||||
knative.dev/pkg v0.0.0-20200711004937-22502028e31a/go.mod h1:AqAJV6rYi8IGikDjJ/9ZQd9qKdkXVlesVnVjwx62YB8=
|
||||
knative.dev/pkg v0.0.0-20201027121533-273ba59a1132 h1:P6/b3Bi+CcLQkjuDKNs2uE96MXa+uxJJ0PUGHe1Caoo=
|
||||
knative.dev/pkg v0.0.0-20201027121533-273ba59a1132/go.mod h1:vytY2kpkAbUm8yDIzJrLEgJ7FK/ieWuQDo4cNavAwuc=
|
||||
knative.dev/pkg v0.0.0-20201027223833-826303ca0653 h1:p+cyfEvM3tIVVrgekbEiIZh23DfdVeqwEjxyqY+nROI=
|
||||
knative.dev/pkg v0.0.0-20201027223833-826303ca0653/go.mod h1:QE0oLfNTKMOrbh5kpt8O58nDxbvEvz3t6R8xTdaWZrg=
|
||||
knative.dev/test-infra v0.0.0-20200407185800-1b88cb3b45a5/go.mod h1:xcdUkMJrLlBswIZqL5zCuBFOC22WIPMQoVX1L35i0vQ=
|
||||
knative.dev/test-infra v0.0.0-20200505052144-5ea2f705bb55/go.mod h1:WqF1Azka+FxPZ20keR2zCNtiQA1MP9ZB4BH4HuI+SIU=
|
||||
knative.dev/test-infra v0.0.0-20200513011557-d03429a76034/go.mod h1:aMif0KXL4g19YCYwsy4Ocjjz5xgPlseYV+B95Oo4JGE=
|
||||
knative.dev/test-infra v0.0.0-20200519015156-82551620b0a9/go.mod h1:A5b2OAXTOeHT3hHhVQm3dmtbuWvIDP7qzgtqxA3/2pE=
|
||||
knative.dev/test-infra v0.0.0-20200707183444-aed09e56ddc7/go.mod h1:RjYAhXnZqeHw9+B0zsbqSPlae0lCvjekO/nw5ZMpLCs=
|
||||
knative.dev/test-infra v0.0.0-20201026182042-46291de4ab66 h1:4GjjfWLzfsxN7xm+vkdC4AWqgTlw5mSQmTdSqPVfjlM=
|
||||
knative.dev/test-infra v0.0.0-20201026182042-46291de4ab66/go.mod h1:84HgSlMIp+oCx//g2Js61OxSVgdvrRYQMfMMr9kSSn4=
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
|
||||
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
|
||||
|
|
|
@ -20,8 +20,7 @@ package tools
|
|||
|
||||
import (
|
||||
_ "k8s.io/code-generator"
|
||||
_ "knative.dev/test-infra/scripts"
|
||||
_ "knative.dev/test-infra/tools/dep-collector"
|
||||
_ "knative.dev/hack"
|
||||
|
||||
// codegen: hack/generate-knative.sh
|
||||
_ "knative.dev/pkg/hack"
|
||||
|
|
|
@ -26,7 +26,7 @@ if [ -z "${GOPATH:-}" ]; then
|
|||
export GOPATH=$(go env GOPATH)
|
||||
fi
|
||||
|
||||
source $(dirname $0)/../vendor/knative.dev/test-infra/scripts/library.sh
|
||||
source $(dirname $0)/../vendor/knative.dev/hack/library.sh
|
||||
|
||||
CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${REPO_ROOT_DIR}; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)}
|
||||
|
||||
|
|
|
@ -18,6 +18,6 @@ set -o errexit
|
|||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
source $(dirname "$0")/../vendor/knative.dev/test-infra/scripts/library.sh
|
||||
source $(dirname "$0")/../vendor/knative.dev/hack/library.sh
|
||||
|
||||
go_update_deps "$@"
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
export GO111MODULE=on
|
||||
|
||||
source $(dirname $0)/../vendor/knative.dev/test-infra/scripts/presubmit-tests.sh
|
||||
source $(dirname $0)/../vendor/knative.dev/hack/presubmit-tests.sh
|
||||
|
||||
# TODO(mattmoor): integration tests
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
# Contributor Covenant Code of Conduct
|
||||
|
||||
Please see the Knative Community
|
||||
[Contributor Covenant Code of Conduct](https://www.knative.dev/contributing/code-of-conduct/).
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
|
@ -1,7 +1,7 @@
|
|||
# Helper scripts
|
||||
# knative.dev/hack
|
||||
|
||||
This directory contains helper scripts used by Prow test jobs, as well as local
|
||||
development scripts.
|
||||
`hack` is a collection of scripts used to bootstrap CI processes and other vital
|
||||
entrypoint functionallity.
|
||||
|
||||
## Using the `presubmit-tests.sh` helper script
|
||||
|
||||
|
@ -19,13 +19,13 @@ This is a helper script to run the presubmit tests. To use it:
|
|||
|
||||
The markdown link checker tool doesn't check `localhost` links by default.
|
||||
Its configuration file, `markdown-link-check-config.json`, lives in the
|
||||
`test-infra/scripts` directory. To override it, create a file with the same
|
||||
name, containing the custom config in the `/test` directory.
|
||||
`hack` directory. To override it, create a file with the same name,
|
||||
containing the custom config in the `/test` directory.
|
||||
|
||||
The markdown lint tool ignores long lines by default. Its configuration file,
|
||||
`markdown-lint-config.rc`, lives in the `test-infra/scripts` directory. To
|
||||
override it, create a file with the same name, containing the custom config
|
||||
in the `/test` directory.
|
||||
`markdown-lint-config.rc`, lives in the `hack` repo. To override it, create a
|
||||
file with the same name, containing the custom config in the `/test`
|
||||
directory.
|
||||
|
||||
1. [optional] Customize the default build test runner, if you're using it. Set
|
||||
the following environment variables if the default values don't fit your
|
||||
|
@ -85,7 +85,7 @@ skipped.
|
|||
### Sample presubmit test script
|
||||
|
||||
```bash
|
||||
source vendor/knative.dev/test-infra/scripts/presubmit-tests.sh
|
||||
source vendor/knative.dev/hack/presubmit-tests.sh
|
||||
|
||||
function post_build_tests() {
|
||||
echo "Cleaning up after build tests"
|
||||
|
@ -176,7 +176,7 @@ test cluster is created in a specific region, `us-west2`.
|
|||
|
||||
```bash
|
||||
|
||||
source vendor/knative.dev/test-infra/scripts/e2e-tests.sh
|
||||
source vendor/knative.dev/hack/e2e-tests.sh
|
||||
|
||||
function knative_setup() {
|
||||
start_latest_knative_serving
|
||||
|
@ -247,7 +247,7 @@ benchmarking jobs for each repo. To use it:
|
|||
This script will update `Knative serving` and the given benchmark.
|
||||
|
||||
```bash
|
||||
source vendor/knative.dev/test-infra/scripts/performance-tests.sh
|
||||
source vendor/knative.dev/hack/performance-tests.sh
|
||||
|
||||
function update_knative() {
|
||||
echo ">> Updating serving"
|
||||
|
@ -322,7 +322,7 @@ This is a helper script for Knative release scripts. To use it:
|
|||
### Sample release script
|
||||
|
||||
```bash
|
||||
source vendor/knative.dev/test-infra/scripts/release.sh
|
||||
source vendor/knative.dev/hack/release.sh
|
||||
|
||||
function build_release() {
|
||||
# config/ contains the manifests
|
||||
|
@ -332,3 +332,14 @@ function build_release() {
|
|||
|
||||
main "$@"
|
||||
```
|
||||
|
||||
# Origins of `hack`
|
||||
|
||||
When Kubernetes was first getting started, someone was trying to introduce some
|
||||
quick shell scripts and land them into the `./scripts` folder. But there was one
|
||||
that opposed this: Ville Aikas. The compromise was to put those quick scripts in
|
||||
a folder called `hack` to remind users and developers that there is likely a
|
||||
better way to perform the task you are attempting that is not using a shell
|
||||
script, like a tested python script.
|
||||
|
||||
> "I was like fine, put them in hack not scripts, cause they are hacks." - Ville Aikas
|
|
@ -0,0 +1,3 @@
|
|||
module knative.dev/hack
|
||||
|
||||
go 1.14
|
|
@ -1,5 +1,7 @@
|
|||
// +build hack
|
||||
|
||||
/*
|
||||
Copyright 2018 The Knative Authors
|
||||
Copyright 2020 The Knative Authors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@ -14,6 +16,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package scripts is a placeholder that allows us to pull the shell scripts
|
||||
// via go mod vendor.
|
||||
package scripts
|
||||
// package hack is a collection of scripts used to bootstrap CI processes and
|
||||
// other vital entrypoint functionallity.
|
||||
|
||||
package hack
|
|
@ -557,11 +557,7 @@ function go_update_deps() {
|
|||
echo "--- Removing unwanted vendor files"
|
||||
|
||||
# Remove unwanted vendor files
|
||||
find vendor/ \( -name "OWNERS" \
|
||||
-o -name "OWNERS_ALIASES" \
|
||||
-o -name "BUILD" \
|
||||
-o -name "BUILD.bazel" \
|
||||
-o -name "*_test.go" \) -exec rm -f {} +
|
||||
find vendor/ \( -name "OWNERS" -o -name "OWNERS_ALIASES" -o -name "BUILD" -o -name "BUILD.bazel" -o -name "*_test.go" \) -print0 | xargs -0 rm -f
|
||||
|
||||
export GOFLAGS=-mod=vendor
|
||||
|
||||
|
@ -575,16 +571,10 @@ function go_update_deps() {
|
|||
# Run kntest tool, error out and ask users to install it if it's not currently installed.
|
||||
# Parameters: $1..$n - parameters passed to the tool.
|
||||
function run_kntest() {
|
||||
# If the current repo is test-infra, run kntest from source.
|
||||
if [[ "${REPO_NAME}" == "test-infra" ]]; then
|
||||
go run "${REPO_ROOT_DIR}"/kntest/cmd/kntest "$@"
|
||||
# Otherwise kntest must be installed.
|
||||
else
|
||||
if [[ ! -x "$(command -v kntest)" ]]; then
|
||||
echo "--- FAIL: kntest not installed, please clone test-infra repo and run \`go install ./kntest/cmd/kntest\` to install it"; return 1;
|
||||
fi
|
||||
kntest "$@"
|
||||
if [[ ! -x "$(command -v kntest)" ]]; then
|
||||
echo "--- FAIL: kntest not installed, please clone knative test-infra repo and run \`go install ./kntest/cmd/kntest\` to install it"; return 1;
|
||||
fi
|
||||
kntest "$@"
|
||||
}
|
||||
|
||||
# Run go-licenses to update licenses.
|
|
@ -100,6 +100,8 @@ ARTIFACTS_TO_PUBLISH=""
|
|||
FROM_NIGHTLY_RELEASE=""
|
||||
FROM_NIGHTLY_RELEASE_GCS=""
|
||||
export KO_DOCKER_REPO="gcr.io/knative-nightly"
|
||||
# Build stripped binary to reduce size
|
||||
export GOFLAGS="-ldflags=-s -ldflags=-w"
|
||||
export GITHUB_TOKEN=""
|
||||
|
||||
# Convenience function to run the hub tool.
|
|
@ -27,6 +27,6 @@ import (
|
|||
_ "k8s.io/code-generator/cmd/informer-gen"
|
||||
_ "k8s.io/code-generator/cmd/lister-gen"
|
||||
|
||||
_ "knative.dev/hack"
|
||||
_ "knative.dev/pkg/codegen/cmd/injection-gen"
|
||||
_ "knative.dev/test-infra/scripts"
|
||||
)
|
||||
|
|
|
@ -26,7 +26,7 @@ if [ -z "${GOPATH:-}" ]; then
|
|||
export GOPATH=$(go env GOPATH)
|
||||
fi
|
||||
|
||||
source $(dirname $0)/../vendor/knative.dev/test-infra/scripts/library.sh
|
||||
source $(dirname $0)/../vendor/knative.dev/hack/library.sh
|
||||
|
||||
CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${REPO_ROOT_DIR}; ls -d -1 $(dirname $0)/../vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)}
|
||||
|
||||
|
|
|
@ -18,6 +18,6 @@ set -o errexit
|
|||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
source $(dirname "$0")/../vendor/knative.dev/test-infra/scripts/library.sh
|
||||
source $(dirname "$0")/../vendor/knative.dev/hack/library.sh
|
||||
|
||||
go_update_deps "$@"
|
||||
|
|
|
@ -18,7 +18,7 @@ set -o errexit
|
|||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
source $(dirname $0)/../vendor/knative.dev/test-infra/scripts/library.sh
|
||||
source $(dirname $0)/../vendor/knative.dev/hack/library.sh
|
||||
|
||||
readonly TMP_DIFFROOT="$(mktemp -d ${REPO_ROOT_DIR}/tmpdiffroot.XXXXXX)"
|
||||
|
||||
|
|
|
@ -238,13 +238,6 @@ func ConfigMapName() string {
|
|||
return "config-logging"
|
||||
}
|
||||
|
||||
// JsonToLoggingConfig converts a JSON string of a Config.
|
||||
// Always returns a non-nil Config.
|
||||
// TODO(vagababov): remove after downstream conversion.
|
||||
func JsonToLoggingConfig(jsonCfg string) (*Config, error) { //nolint No rename due to backwards incompatibility.
|
||||
return JSONToConfig(jsonCfg)
|
||||
}
|
||||
|
||||
// JSONToConfig converts a JSON string of a Config.
|
||||
// Always returns a non-nil Config.
|
||||
func JSONToConfig(jsonCfg string) (*Config, error) {
|
||||
|
@ -265,12 +258,6 @@ func JSONToConfig(jsonCfg string) (*Config, error) {
|
|||
return cfg, nil
|
||||
}
|
||||
|
||||
// LoggingConfigToJson converts a Config to a JSON string.
|
||||
// TODO(vagababov): remove after downstream conversion.
|
||||
func LoggingConfigToJson(cfg *Config) (string, error) { //nolint No rename due to backwards incompatibility.
|
||||
return ConfigToJSON(cfg)
|
||||
}
|
||||
|
||||
// ConfigToJSON converts a Config to a JSON string.
|
||||
func ConfigToJSON(cfg *Config) (string, error) {
|
||||
if cfg == nil || cfg.LoggingConfig == "" {
|
||||
|
|
|
@ -1,91 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2020 The Knative Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -e
|
||||
|
||||
# This script updates test-infra scripts in-repo.
|
||||
# Run it to update (usually from hack/update-deps.sh) the current scripts.
|
||||
# Scripts are installed to REPO_ROOT/scripts/test-infra
|
||||
|
||||
# The following arguments are accepted:
|
||||
# --update
|
||||
# Do the update
|
||||
# --ref X
|
||||
# Defines which ref (branch, tag, commit) of test-infra to get scripts from; defaults to master
|
||||
# --first-time
|
||||
# Run this script from your repo root directory to install scripts for the first time
|
||||
# Will also sed -i non-vendor scripts in the current repo to point to new path
|
||||
# TODO: --verify
|
||||
# Verify the contents of scripts/test-infra match the contents from commit sha in scripts/test-infra/COMMIT
|
||||
# One can verify manually by running the script with '--ref $(cat scripts/test-infra/COMMIT)' and ensuring no files are staged
|
||||
|
||||
declare -i FIRST_TIME_SETUP=0
|
||||
declare -i DO_UPDATE=0
|
||||
declare SCRIPTS_REF=master
|
||||
|
||||
while [[ $# -ne 0 ]]; do
|
||||
parameter="$1"
|
||||
case ${parameter} in
|
||||
--ref)
|
||||
shift
|
||||
SCRIPTS_REF="$1"
|
||||
;;
|
||||
--first-time)
|
||||
FIRST_TIME_SETUP=1
|
||||
;;
|
||||
--update)
|
||||
DO_UPDATE=1
|
||||
;;
|
||||
*)
|
||||
echo "unknown option ${parameter}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
function do_read_tree() {
|
||||
mkdir -p scripts/test-infra
|
||||
git read-tree --prefix=scripts/test-infra -u "test-infra/${SCRIPTS_REF}:scripts"
|
||||
git show-ref -s -- "refs/remotes/test-infra/${SCRIPTS_REF}" > scripts/test-infra/COMMIT
|
||||
git add scripts/test-infra/COMMIT
|
||||
echo "test-infra scripts installed to scripts/test-infra from branch ${SCRIPTS_REF}"
|
||||
}
|
||||
|
||||
function run() {
|
||||
if (( FIRST_TIME_SETUP )); then
|
||||
if [[ ! -d .git ]]; then
|
||||
echo "I don't believe you are in a repo root; exiting"
|
||||
exit 5
|
||||
fi
|
||||
git remote add test-infra https://github.com/knative/test-infra.git || echo "test-infra remote already set; not changing"
|
||||
git fetch test-infra "${SCRIPTS_REF}"
|
||||
do_read_tree
|
||||
echo "Attempting to point all scripts to use this new path"
|
||||
grep -RiIl vendor/knative.dev/test-infra | grep -v ^vendor | grep -v ^scripts/test-infra | xargs sed -i 's+vendor/knative.dev/test-infra/scripts+scripts/test-infra+'
|
||||
elif (( DO_UPDATE )); then
|
||||
pushd "$(dirname "${BASH_SOURCE[0]}")/../.."
|
||||
trap popd EXIT
|
||||
|
||||
git remote add test-infra https://github.com/knative/test-infra.git || true
|
||||
git fetch test-infra "${SCRIPTS_REF}"
|
||||
git rm -fr scripts/test-infra
|
||||
rm -fR scripts/test-infra
|
||||
do_read_tree
|
||||
fi
|
||||
}
|
||||
|
||||
run
|
|
@ -1,97 +0,0 @@
|
|||
# dep-collector
|
||||
|
||||
> Deprecation notice: the CI/CD flow has switched the license tool to
|
||||
> [go-licenses](https://github.com/google/go-licenses), and deprecated
|
||||
> `dep-collector`. We need to keep it for now as the old release branches are
|
||||
> still using it. It can be safely deleted after we only support branches >=
|
||||
> release-0.15.
|
||||
|
||||
`dep-collector` is a tool for gathering up a collection of licenses for Go
|
||||
dependencies that have been pulled into the idiomatic `vendor/` directory. The
|
||||
resulting file from running `dep-collector` is intended for inclusion in
|
||||
container images to respect the licenses of the included software.
|
||||
|
||||
## Basic Usage
|
||||
|
||||
You can run `dep-collector` on one or more Go import paths as entrypoints, and
|
||||
it will:
|
||||
|
||||
1. Walk the transitive dependencies to identify vendored software packages,
|
||||
1. Search for licenses for each vendored dependency,
|
||||
1. Dump a file containing the licenses for each vendored import.
|
||||
|
||||
For example (single import path):
|
||||
|
||||
```shell
|
||||
$ dep-collector .
|
||||
===========================================================
|
||||
Import: github.com/mattmoor/dep-collector/vendor/github.com/google/licenseclassifier
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
...
|
||||
|
||||
```
|
||||
|
||||
For example (multiple import paths):
|
||||
|
||||
```shell
|
||||
$ dep-collector ./cmd/controller ./cmd/sleeper
|
||||
|
||||
===========================================================
|
||||
Import: github.com/mattmoor/warm-image/vendor/cloud.google.com/go
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
```
|
||||
|
||||
## CSV Usage
|
||||
|
||||
You can also run `dep-collector` in a mode that produces CSV output, including
|
||||
basic classification of the license.
|
||||
|
||||
> In order to run dep-collector in this mode, you must first run: go get
|
||||
> github.com/google/licenseclassifier
|
||||
|
||||
For example:
|
||||
|
||||
```shell
|
||||
$ dep-collector -csv .
|
||||
github.com/google/licenseclassifier,Static,,https://github.com/mattmoor/dep-collector/blob/master/vendor/github.com/google/licenseclassifier/LICENSE,Apache-2.0
|
||||
github.com/google/licenseclassifier/stringclassifier,Static,,https://github.com/mattmoor/dep-collector/blob/master/vendor/github.com/google/licenseclassifier/stringclassifier/LICENSE,Apache-2.0
|
||||
github.com/sergi/go-diff,Static,,https://github.com/mattmoor/dep-collector/blob/master/vendor/github.com/sergi/go-diff/LICENSE,MIT
|
||||
|
||||
```
|
||||
|
||||
The columns here are:
|
||||
|
||||
- Import Path,
|
||||
- How the dependency is linked in (always reports "static"),
|
||||
- A column for whether any modifications have been made (always empty),
|
||||
- The URL by which to access the license file (assumes `master`),
|
||||
- A classification of what license this is
|
||||
([using this](https://github.com/google/licenseclassifier)).
|
||||
|
||||
## Check mode
|
||||
|
||||
`dep-collector` also includes a mode that will check for "forbidden" licenses.
|
||||
|
||||
> In order to run dep-collector in this mode, you must first run: go get
|
||||
> github.com/google/licenseclassifier
|
||||
|
||||
For example (failing):
|
||||
|
||||
```shell
|
||||
$ dep-collector -check ./foo/bar/baz
|
||||
2018/07/20 22:01:29 Error checking license collection: Errors validating licenses:
|
||||
Found matching forbidden license in "foo.io/bar/vendor/github.com/BurntSushi/toml":WTFPL
|
||||
```
|
||||
|
||||
For example (passing):
|
||||
|
||||
```shell
|
||||
$ dep-collector -check .
|
||||
2018/07/20 22:29:09 No errors found.
|
||||
```
|
|
@ -1,88 +0,0 @@
|
|||
/*
|
||||
Copyright 2020 The Knative Authors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
gb "go/build"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// https://golang.org/pkg/cmd/go/internal/modinfo/#ModulePublic
|
||||
type modInfo struct {
|
||||
Path string
|
||||
Dir string
|
||||
}
|
||||
|
||||
type gobuild struct {
|
||||
mod *modInfo
|
||||
}
|
||||
|
||||
// moduleInfo returns the module path and module root directory for a project
|
||||
// using go modules, otherwise returns nil.
|
||||
// If there is something wrong in getting the module info, it will return an error.
|
||||
//
|
||||
// Related: https://github.com/golang/go/issues/26504
|
||||
func moduleInfo() (*modInfo, error) {
|
||||
// If `go list -m` returns an error, the project is not using Go modules.
|
||||
c := exec.Command("go", "list", "-m")
|
||||
_, err := c.Output()
|
||||
if err != nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
lc := exec.Command("go", "list", "-mod=readonly", "-m", "-json")
|
||||
output, err := lc.Output()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed getting module info: %v", err)
|
||||
}
|
||||
var info modInfo
|
||||
if err := json.Unmarshal(output, &info); err != nil {
|
||||
return nil, fmt.Errorf("failed parsing module info %q: %v", output, err)
|
||||
}
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// importPackage wraps go/build.Import to handle go modules.
|
||||
//
|
||||
// Note that we will fall back to GOPATH if the project isn't using go modules.
|
||||
func (g *gobuild) importPackage(s string) (*gb.Package, error) {
|
||||
if g.mod == nil {
|
||||
return gb.Import(s, WorkingDir, gb.ImportComment)
|
||||
}
|
||||
|
||||
// If we're inside a go modules project, try to use the module's directory
|
||||
// as our source root to import:
|
||||
// * paths that match module path prefix (they should be in this project)
|
||||
// * relative paths (they should also be in this project)
|
||||
gp, err := gb.Import(s, g.mod.Dir, gb.ImportComment)
|
||||
return gp, err
|
||||
}
|
||||
|
||||
func (g *gobuild) qualifyLocalImport(ip string) (string, error) {
|
||||
if g.mod == nil {
|
||||
gopathsrc := filepath.Join(gb.Default.GOPATH, "src")
|
||||
if !strings.HasPrefix(WorkingDir, gopathsrc) {
|
||||
return "", fmt.Errorf("working directory must be on ${GOPATH}/src = %s", gopathsrc)
|
||||
}
|
||||
return filepath.Join(strings.TrimPrefix(WorkingDir, gopathsrc+string(filepath.Separator)), ip), nil
|
||||
}
|
||||
return filepath.Join(g.mod.Path, ip), nil
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
/*
|
||||
Copyright 2018 The Knative Authors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
gb "go/build"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type ImportInfo struct {
|
||||
ImportPath string
|
||||
Dir string
|
||||
}
|
||||
|
||||
func CollectTransitiveImports(binaries []string) ([]ImportInfo, error) {
|
||||
// Perform a simple DFS to collect the binaries' transitive dependencies.
|
||||
visited := make(map[string]ImportInfo)
|
||||
mi, err := moduleInfo()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed getting Go module info: %v", err)
|
||||
}
|
||||
g := &gobuild{mi}
|
||||
for _, importpath := range binaries {
|
||||
if gb.IsLocalImport(importpath) {
|
||||
ip, err := g.qualifyLocalImport(importpath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
importpath = ip
|
||||
}
|
||||
|
||||
pkg, err := g.importPackage(importpath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := visit(g, pkg, visited); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// Sort the dependencies deterministically.
|
||||
var list sort.StringSlice
|
||||
for dir := range visited {
|
||||
if !strings.Contains(dir, "/vendor/") {
|
||||
// Skip files outside of vendor
|
||||
continue
|
||||
}
|
||||
list = append(list, dir)
|
||||
}
|
||||
list.Sort()
|
||||
|
||||
iiList := make([]ImportInfo, len(list))
|
||||
for i := range iiList {
|
||||
iiList[i] = visited[list[i]]
|
||||
}
|
||||
|
||||
return iiList, nil
|
||||
}
|
||||
|
||||
func visit(g *gobuild, pkg *gb.Package, visited map[string]ImportInfo) error {
|
||||
if _, ok := visited[pkg.Dir]; ok {
|
||||
return nil
|
||||
}
|
||||
visited[pkg.Dir] = ImportInfo{Dir: pkg.Dir, ImportPath: pkg.ImportPath}
|
||||
|
||||
for _, ip := range pkg.Imports {
|
||||
if ip == "C" {
|
||||
// skip cgo
|
||||
continue
|
||||
}
|
||||
subpkg, err := g.importPackage(ip)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%v\n -> %v", pkg.ImportPath, err)
|
||||
}
|
||||
if !strings.HasPrefix(subpkg.Dir, WorkingDir) {
|
||||
// Skip import paths outside of our workspace (std library)
|
||||
continue
|
||||
}
|
||||
if err := visit(g, subpkg, visited); err != nil {
|
||||
return fmt.Errorf("%v (%v)\n -> %v", pkg.ImportPath, pkg.Dir, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
|
@ -1,263 +0,0 @@
|
|||
/*
|
||||
Copyright 2018 The Knative Authors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/google/licenseclassifier"
|
||||
)
|
||||
|
||||
// Type identifies a class of software license.
|
||||
type Type string
|
||||
|
||||
// License types
|
||||
const (
|
||||
// Unknown license type.
|
||||
Unknown = Type("")
|
||||
// Restricted licenses require mandatory source distribution if we ship a
|
||||
// product that includes third-party code protected by such a license.
|
||||
Restricted = Type("restricted")
|
||||
// Reciprocal licenses allow usage of software made available under such
|
||||
// licenses freely in *unmodified* form. If the third-party source code is
|
||||
// modified in any way these modifications to the original third-party
|
||||
// source code must be made available.
|
||||
Reciprocal = Type("reciprocal")
|
||||
// Notice licenses contain few restrictions, allowing original or modified
|
||||
// third-party software to be shipped in any product without endangering or
|
||||
// encumbering our source code. All of the licenses in this category do,
|
||||
// however, have an "original Copyright notice" or "advertising clause",
|
||||
// wherein any external distributions must include the notice or clause
|
||||
// specified in the license.
|
||||
Notice = Type("notice")
|
||||
// Permissive licenses are even more lenient than a 'notice' license.
|
||||
// Not even a copyright notice is required for license compliance.
|
||||
Permissive = Type("permissive")
|
||||
// Unencumbered covers licenses that basically declare that the code is "free for any use".
|
||||
Unencumbered = Type("unencumbered")
|
||||
// Forbidden licenses are forbidden to be used.
|
||||
Forbidden = Type("FORBIDDEN")
|
||||
)
|
||||
|
||||
func (t Type) String() string {
|
||||
switch t {
|
||||
case Unknown:
|
||||
// licenseclassifier uses an empty string to indicate an unknown license
|
||||
// type, which is unclear to users when printed as a string.
|
||||
return "unknown"
|
||||
default:
|
||||
return string(t)
|
||||
}
|
||||
}
|
||||
|
||||
var LicenseNames = []string{
|
||||
"LICENCE",
|
||||
"LICENSE",
|
||||
"LICENSE.code",
|
||||
"LICENSE.md",
|
||||
"LICENSE.txt",
|
||||
"COPYING",
|
||||
"copyright",
|
||||
}
|
||||
|
||||
const MatchThreshold = 0.9
|
||||
|
||||
type LicenseFile struct {
|
||||
EnclosingImportPath string
|
||||
LicensePath string
|
||||
}
|
||||
|
||||
func (lf *LicenseFile) Body() (string, error) {
|
||||
body, err := ioutil.ReadFile(lf.LicensePath)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(body), nil
|
||||
}
|
||||
|
||||
func (lf *LicenseFile) Classify(classifier *licenseclassifier.License) (string, error) {
|
||||
body, err := lf.Body()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
m := classifier.NearestMatch(body)
|
||||
if m == nil {
|
||||
return "", fmt.Errorf("unable to classify license: %v", lf.EnclosingImportPath)
|
||||
}
|
||||
return m.Name, nil
|
||||
}
|
||||
|
||||
func (lf *LicenseFile) Check(classifier *licenseclassifier.License) error {
|
||||
body, err := lf.Body()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ms := classifier.MultipleMatch(body, false)
|
||||
for _, m := range ms {
|
||||
return fmt.Errorf("found matching forbidden license in %q: %v", lf.EnclosingImportPath, m.Name)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (lf *LicenseFile) Entry() (string, error) {
|
||||
body, err := lf.Body()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return fmt.Sprintf(`
|
||||
===========================================================
|
||||
Import: %s
|
||||
|
||||
%s
|
||||
`, lf.EnclosingImportPath, body), nil
|
||||
}
|
||||
|
||||
func (lf *LicenseFile) CSVRow(classifier *licenseclassifier.License) (string, error) {
|
||||
classification, err := lf.Classify(classifier)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
parts := strings.Split(lf.EnclosingImportPath, "/vendor/")
|
||||
if len(parts) != 2 {
|
||||
return "", fmt.Errorf("wrong number of parts splitting import path on %q : %q", "/vendor/", lf.EnclosingImportPath)
|
||||
}
|
||||
return strings.Join([]string{
|
||||
parts[1],
|
||||
"Static",
|
||||
"", // TODO(mattmoor): Modifications?
|
||||
"https://" + parts[0] + "/blob/master/vendor/" + parts[1] + "/" + filepath.Base(lf.LicensePath),
|
||||
classification,
|
||||
}, ","), nil
|
||||
}
|
||||
|
||||
func findLicense(ii ImportInfo) (*LicenseFile, error) {
|
||||
dir := ii.Dir
|
||||
ip := ii.ImportPath
|
||||
for {
|
||||
// When we reach the root of our workspace, stop searching.
|
||||
if dir == WorkingDir {
|
||||
return nil, fmt.Errorf("unable to find license for %q", ip)
|
||||
}
|
||||
|
||||
for _, name := range LicenseNames {
|
||||
p := filepath.Join(dir, name)
|
||||
if _, err := os.Stat(p); err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
return &LicenseFile{
|
||||
EnclosingImportPath: ip,
|
||||
LicensePath: p,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Walk to the parent directory / import path
|
||||
dir = filepath.Dir(dir)
|
||||
ip = filepath.Dir(ip)
|
||||
}
|
||||
}
|
||||
|
||||
type LicenseCollection []*LicenseFile
|
||||
|
||||
func (lc LicenseCollection) Entries() (string, error) {
|
||||
sections := make([]string, 0, len(lc))
|
||||
for _, key := range lc {
|
||||
entry, err := key.Entry()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
sections = append(sections, entry)
|
||||
}
|
||||
return strings.Join(sections, "\n"), nil
|
||||
}
|
||||
|
||||
func (lc LicenseCollection) CSV(classifier *licenseclassifier.License) (string, error) {
|
||||
sections := make([]string, 0, len(lc))
|
||||
for _, entry := range lc {
|
||||
row, err := entry.CSVRow(classifier)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
sections = append(sections, row)
|
||||
}
|
||||
return strings.Join(sections, "\n"), nil
|
||||
}
|
||||
|
||||
func (lc LicenseCollection) Check(classifier *licenseclassifier.License) error {
|
||||
errors := []string{}
|
||||
for _, entry := range lc {
|
||||
licenseName, licenseType, err := entry.Identify(entry.LicensePath, classifier)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if licenseType == Forbidden {
|
||||
errors = append(errors, fmt.Sprintf("Forbidden license type %s for library %v\n", licenseName, entry))
|
||||
}
|
||||
}
|
||||
if len(errors) == 0 {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("Errors validating licenses:\n%v", strings.Join(errors, "\n"))
|
||||
}
|
||||
|
||||
// Identify returns the name and type of a license, given its file path.
|
||||
// An empty license path results in an empty name and Unknown type.
|
||||
func (lf *LicenseFile) Identify(licensePath string, classifier *licenseclassifier.License) (string, Type, error) {
|
||||
if licensePath == "" {
|
||||
return "", Unknown, nil
|
||||
}
|
||||
content, err := ioutil.ReadFile(licensePath)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
matches := classifier.MultipleMatch(string(content), true)
|
||||
if len(matches) == 0 {
|
||||
return "", "", fmt.Errorf("unknown license")
|
||||
}
|
||||
licenseName := matches[0].Name
|
||||
return licenseName, Type(licenseclassifier.LicenseType(licenseName)), nil
|
||||
}
|
||||
|
||||
// CollectLicenses collects a list of licenses for the given imports.
|
||||
func CollectLicenses(importInfos []ImportInfo) (LicenseCollection, error) {
|
||||
// for each of the import paths, search for a license file.
|
||||
licenseFiles := make(map[string]*LicenseFile)
|
||||
for _, info := range importInfos {
|
||||
lf, err := findLicense(info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
licenseFiles[lf.EnclosingImportPath] = lf
|
||||
}
|
||||
|
||||
order := sort.StringSlice{}
|
||||
for key := range licenseFiles {
|
||||
order = append(order, key)
|
||||
}
|
||||
order.Sort()
|
||||
|
||||
licenseTypes := LicenseCollection{}
|
||||
for _, key := range order {
|
||||
licenseTypes = append(licenseTypes, licenseFiles[key])
|
||||
}
|
||||
return licenseTypes, nil
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
/*
|
||||
Copyright 2018 The Knative Authors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/google/licenseclassifier"
|
||||
)
|
||||
|
||||
var WorkingDir, _ = os.Getwd()
|
||||
|
||||
var (
|
||||
csv = flag.Bool("csv", false, "Whether to print in CSV format (with slow classification).")
|
||||
check = flag.Bool("check", false, "Whether to just check license files for forbidden licenses.")
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
if flag.NArg() == 0 {
|
||||
log.Fatalf("Expected a list of import paths, got: %v", flag.Args())
|
||||
}
|
||||
|
||||
// Perform a simple DFS to collect the binaries' transitive dependencies.
|
||||
transitiveImports, err := CollectTransitiveImports(flag.Args())
|
||||
if err != nil {
|
||||
log.Fatalf("Error collecting transitive dependencies: %v", err)
|
||||
}
|
||||
|
||||
// Gather all of the license data from the imports.
|
||||
collection, err := CollectLicenses(transitiveImports)
|
||||
if err != nil {
|
||||
log.Fatalf("Error identifying licenses for transitive dependencies: %v", err)
|
||||
}
|
||||
|
||||
if *check {
|
||||
classifier, err := licenseclassifier.New(MatchThreshold)
|
||||
if err != nil {
|
||||
log.Fatalf("Error creating license classifier: %v", err)
|
||||
}
|
||||
if err := collection.Check(classifier); err != nil {
|
||||
log.Fatalf("Error checking license collection: %v", err)
|
||||
}
|
||||
log.Printf("No errors found.")
|
||||
return
|
||||
}
|
||||
|
||||
if *csv {
|
||||
classifier, err := licenseclassifier.New(MatchThreshold)
|
||||
if err != nil {
|
||||
log.Fatalf("Error creating license classifier: %v", err)
|
||||
}
|
||||
output, err := collection.CSV(classifier)
|
||||
if err != nil {
|
||||
log.Fatalf("Error generating CSV: %v", err)
|
||||
}
|
||||
os.Stdout.Write([]byte(output))
|
||||
} else {
|
||||
entries, err := collection.Entries()
|
||||
if err != nil {
|
||||
log.Fatalf("Error generating entries: %v", err)
|
||||
}
|
||||
os.Stdout.Write([]byte(entries))
|
||||
}
|
||||
}
|
|
@ -733,7 +733,10 @@ k8s.io/kube-openapi/pkg/util/sets
|
|||
k8s.io/utils/buffer
|
||||
k8s.io/utils/integer
|
||||
k8s.io/utils/trace
|
||||
# knative.dev/pkg v0.0.0-20201027121533-273ba59a1132
|
||||
# knative.dev/hack v0.0.0-20201027221733-0d7f2f064b7b
|
||||
## explicit
|
||||
knative.dev/hack
|
||||
# knative.dev/pkg v0.0.0-20201027223833-826303ca0653
|
||||
## explicit
|
||||
knative.dev/pkg/apis
|
||||
knative.dev/pkg/apis/duck
|
||||
|
@ -760,10 +763,6 @@ knative.dev/pkg/reconciler
|
|||
knative.dev/pkg/signals
|
||||
knative.dev/pkg/system
|
||||
knative.dev/pkg/tracker
|
||||
# knative.dev/test-infra v0.0.0-20201026182042-46291de4ab66
|
||||
## explicit
|
||||
knative.dev/test-infra/scripts
|
||||
knative.dev/test-infra/tools/dep-collector
|
||||
# sigs.k8s.io/structured-merge-diff/v3 v3.0.1-0.20200706213357-43c19bbb7fba
|
||||
sigs.k8s.io/structured-merge-diff/v3/value
|
||||
# sigs.k8s.io/yaml v1.2.0
|
||||
|
|
Loading…
Reference in New Issue