From 201a690dbd34add3aeb1cbc94f1eef17c64ca6b8 Mon Sep 17 00:00:00 2001 From: motoki317 Date: Thu, 5 Oct 2023 17:54:12 +0900 Subject: [PATCH 01/42] Fix top page retrieval when no apps are on the page --- pkg/infrastructure/repository/build.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/infrastructure/repository/build.go b/pkg/infrastructure/repository/build.go index 45fda7483..41f874f78 100644 --- a/pkg/infrastructure/repository/build.go +++ b/pkg/infrastructure/repository/build.go @@ -79,6 +79,9 @@ func (r *buildRepository) GetBuilds(ctx context.Context, cond domain.GetBuildCon } func (r *buildRepository) GetLatestBuilds(ctx context.Context, appIDIn []string) ([]*domain.Build, error) { + if len(appIDIn) == 0 { + return nil, nil + } // NOTE: safe to do raw sql building because appIDIn is always in form of app's ID inClause := strings.Join( ds.Map(appIDIn, func(s string) string { return `'` + s + `'` }), From 47c28e7184067b9ea9824205ea1b192cbf2c399a Mon Sep 17 00:00:00 2001 From: motoki317 Date: Fri, 6 Oct 2023 14:18:38 +0900 Subject: [PATCH 02/42] Upgrade to moby/buildkit@v0.12.2 --- go.mod | 14 ++--- go.sum | 58 +++++++++---------- .../backend/dockerimpl/backend.go | 10 +++- .../buildpack/dockerimpl/backend.go | 7 ++- pkg/usecase/builder/build_buildkit.go | 11 +++- 5 files changed, 58 insertions(+), 42 deletions(-) diff --git a/go.mod b/go.mod index 06423dc7d..5c6139f45 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/aws/aws-sdk-go v1.45.19 github.com/cert-manager/cert-manager v1.13.1 github.com/docker/cli v24.0.6+incompatible - github.com/docker/docker v24.0.6+incompatible + github.com/docker/docker v24.0.0-rc.2.0.20230718135204-8e51b8b59cb8+incompatible // v25 master@8e51b8b59cb8 (2023-07-18), required by github.com/moby/buildkit@v0.12.2 github.com/docker/go-connections v0.4.0 github.com/friendsofgo/errors v0.9.2 github.com/gliderlabs/ssh v0.3.5 @@ -22,7 +22,7 @@ require ( github.com/google/wire v0.5.0 github.com/labstack/echo/v4 v4.11.1 github.com/lukesampson/figlet v0.0.0-20190211215653-8a3ef4a6ac42 - github.com/moby/buildkit v0.11.6 // NOTE: Requires github.com/docker/docker master tag (v25) as of v0.12.2, making it hard to upgrade + github.com/moby/buildkit v0.12.2 github.com/motoki317/sc v1.6.0 github.com/ncw/swift v1.0.53 github.com/prometheus/client_golang v1.17.0 @@ -70,10 +70,9 @@ require ( github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/cloudflare/circl v1.3.3 // indirect github.com/containerd/console v1.0.3 // indirect - github.com/containerd/containerd v1.7.0 // indirect - github.com/containerd/continuity v0.3.1-0.20230206214859-2a963a2f56e8 // indirect - github.com/containerd/ttrpc v1.2.1 // indirect - github.com/containerd/typeurl v1.0.2 // indirect + github.com/containerd/containerd v1.7.2 // indirect + github.com/containerd/continuity v0.4.1 // indirect + github.com/containerd/ttrpc v1.2.2 // indirect github.com/containerd/typeurl/v2 v2.1.1 // indirect github.com/cyphar/filepath-securejoin v0.2.4 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect @@ -143,7 +142,7 @@ require ( github.com/morikuni/aec v1.0.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b // indirect + github.com/opencontainers/image-spec v1.1.0-rc3 // indirect github.com/patrickmn/go-cache v2.1.0+incompatible // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect github.com/pjbgf/sha1cd v0.3.0 // indirect @@ -151,6 +150,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/secure-systems-lab/go-securesystemslib v0.7.0 // indirect github.com/sergi/go-diff v1.3.1 // indirect + github.com/shibumi/go-pathspec v1.3.0 // indirect github.com/shopspring/decimal v1.3.1 // indirect github.com/skeema/knownhosts v1.2.0 // indirect github.com/spf13/afero v1.9.5 // indirect diff --git a/go.sum b/go.sum index 811eb4ce3..64b7cb6ba 100644 --- a/go.sum +++ b/go.sum @@ -94,8 +94,8 @@ github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBa github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= -github.com/Microsoft/hcsshim v0.10.0-rc.7 h1:HBytQPxcv8Oy4244zbQbe6hnOnx544eL5QPUqhJldz8= -github.com/Microsoft/hcsshim v0.10.0-rc.7/go.mod h1:ILuwjA+kNW+MrN/w5un7n3mTqkwsFu4Bp05/okFUZlE= +github.com/Microsoft/hcsshim v0.10.0-rc.8 h1:YSZVvlIIDD1UxQpJp0h+dnpLUw+TrY0cx8obKsp3bek= +github.com/Microsoft/hcsshim v0.10.0-rc.8/go.mod h1:OEthFdQv/AD2RAdzR6Mm1N1KPCztGKDurW1Z8b8VGMM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 h1:kkhsdkhsCvIsutKu5zLMgWtgh9YxGCNAw8Ad8hjwfYg= github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= @@ -108,6 +108,8 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/anchore/go-struct-converter v0.0.0-20221118182256-c68fdcfa2092 h1:aM1rlcoLz8y5B2r4tTLMiVTrMtpfY0O8EScKJxaSaEc= +github.com/anchore/go-struct-converter v0.0.0-20221118182256-c68fdcfa2092/go.mod h1:rYqSE9HbjzpHTI74vwPvae4ZVYZd1lue2ta6xHPdblA= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= @@ -158,25 +160,25 @@ github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+gqO04wryn5h75LSazbRlnya1k= github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= +github.com/codahale/rfc6979 v0.0.0-20141003034818-6a90f24967eb h1:EDmT6Q9Zs+SbUoc7Ik9EfrFqcylYqgPZ9ANSbTAntnE= +github.com/codahale/rfc6979 v0.0.0-20141003034818-6a90f24967eb/go.mod h1:ZjrT6AXHbDs86ZSdt/osfBi5qfexBrKUdONk989Wnk4= github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= github.com/containerd/console v1.0.3 h1:lIr7SlA5PxZyMV30bDW0MGbiOPXwc63yRuCP0ARubLw= github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= -github.com/containerd/containerd v1.7.0 h1:G/ZQr3gMZs6ZT0qPUZ15znx5QSdQdASW11nXTLTM2Pg= -github.com/containerd/containerd v1.7.0/go.mod h1:QfR7Efgb/6X2BDpTPJRvPTYDE9rsF0FsXX9J8sIs/sc= -github.com/containerd/continuity v0.3.1-0.20230206214859-2a963a2f56e8 h1:EdSQb65ohzz4jsyPOhxfu3/+c9nnU0euk0otferwl9A= -github.com/containerd/continuity v0.3.1-0.20230206214859-2a963a2f56e8/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= +github.com/containerd/containerd v1.7.2 h1:UF2gdONnxO8I6byZXDi5sXWiWvlW3D/sci7dTQimEJo= +github.com/containerd/containerd v1.7.2/go.mod h1:afcz74+K10M/+cjGHIVQrCt3RAQhUSCAjJ9iMYhhkuI= +github.com/containerd/continuity v0.4.1 h1:wQnVrjIyQ8vhU2sgOiL5T07jo+ouqc2bnKsv5/EqGhU= +github.com/containerd/continuity v0.4.1/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ= github.com/containerd/fifo v1.1.0 h1:4I2mbh5stb1u6ycIABlBw9zgtlK8viPI9QkQNRQEEmY= github.com/containerd/fifo v1.1.0/go.mod h1:bmC4NWMbXlt2EZ0Hc7Fx7QzTFxgPID13eH0Qu+MAb2o= -github.com/containerd/nydus-snapshotter v0.3.1 h1:b8WahTrPkt3XsabjG2o/leN4fw3HWZYr+qxo/Z8Mfzk= -github.com/containerd/nydus-snapshotter v0.3.1/go.mod h1:+8R7NX7vrjlxAgtidnsstwIhpzyTlriYPssTxH++uiM= -github.com/containerd/stargz-snapshotter v0.13.0 h1:3zr1/IkW1aEo6cMYTQeZ4L2jSuCN+F4kgGfjnuowe4U= -github.com/containerd/stargz-snapshotter/estargz v0.13.0 h1:fD7AwuVV+B40p0d9qVkH/Au1qhp8hn/HWJHIYjpEcfw= -github.com/containerd/stargz-snapshotter/estargz v0.13.0/go.mod h1:m+9VaGJGlhCnrcEUod8mYumTmRgblwd3rC5UCEh2Yp0= -github.com/containerd/ttrpc v1.2.1 h1:VWv/Rzx023TBLv4WQ+9WPXlBG/s3rsRjY3i9AJ2BJdE= -github.com/containerd/ttrpc v1.2.1/go.mod h1:sIT6l32Ph/H9cvnJsfXM5drIVzTr5A2flTf1G5tYZak= -github.com/containerd/typeurl v1.0.2 h1:Chlt8zIieDbzQFzXzAeBEF92KhExuE4p9p92/QmY7aY= -github.com/containerd/typeurl v1.0.2/go.mod h1:9trJWW2sRlGub4wZJRTW83VtbOLS6hwcDZXTn6oPz9s= +github.com/containerd/nydus-snapshotter v0.8.2 h1:7SOrMU2YmLzfbsr5J7liMZJlNi5WT6vtIOxLGv+iz7E= +github.com/containerd/nydus-snapshotter v0.8.2/go.mod h1:UJILTN5LVBRY+dt8BGJbp72Xy729hUZsOugObEI3/O8= +github.com/containerd/stargz-snapshotter v0.14.3 h1:OTUVZoPSPs8mGgmQUE1dqw3WX/3nrsmsurW7UPLWl1U= +github.com/containerd/stargz-snapshotter/estargz v0.14.3 h1:OqlDCK3ZVUO6C3B/5FSkDwbkEETK84kQgEeFwDC+62k= +github.com/containerd/stargz-snapshotter/estargz v0.14.3/go.mod h1:KY//uOCIkSuNAHhJogcZtrNHdKrA99/FCCRjE3HD36o= +github.com/containerd/ttrpc v1.2.2 h1:9vqZr0pxwOF5koz6N0N3kJ0zDHokrcPxIR/ZR2YFtOs= +github.com/containerd/ttrpc v1.2.2/go.mod h1:sIT6l32Ph/H9cvnJsfXM5drIVzTr5A2flTf1G5tYZak= github.com/containerd/typeurl/v2 v2.1.1 h1:3Q4Pt7i8nYwy2KmQWIw2+1hTvwTE/6w9FqcttATPO/4= github.com/containerd/typeurl/v2 v2.1.1/go.mod h1:IDp2JFvbwZ31H8dQbEIY7sDl2L3o3HZj1hsSQlywkQ0= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -197,8 +199,8 @@ github.com/docker/cli v24.0.6+incompatible h1:fF+XCQCgJjjQNIMjzaSmiKJSCcfcXb3TWT github.com/docker/cli v24.0.6+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v24.0.6+incompatible h1:hceabKCtUgDqPu+qm0NgsaXf28Ljf4/pWFL7xjWWDgE= -github.com/docker/docker v24.0.6+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v24.0.0-rc.2.0.20230718135204-8e51b8b59cb8+incompatible h1:qMc+sk+l2GSLokgRA1uuKgkUVQ/vhAm4LYHC5rtSMq0= +github.com/docker/docker v24.0.0-rc.2.0.20230718135204-8e51b8b59cb8+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.8.0 h1:YQFtbBQb4VrpoPxhFuzEBPQ9E16qz5SpHLS+uswaCp8= github.com/docker/docker-credential-helpers v0.8.0/go.mod h1:UGFXcuoQ5TxPiB54nHOZ32AWRqQdECoh/Mg0AlEYb40= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= @@ -572,8 +574,8 @@ github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/moby/buildkit v0.11.6 h1:VYNdoKk5TVxN7k4RvZgdeM4GOyRvIi4Z8MXOY7xvyUs= -github.com/moby/buildkit v0.11.6/go.mod h1:GCqKfHhz+pddzfgaR7WmHVEE3nKKZMMDPpK8mh3ZLv4= +github.com/moby/buildkit v0.12.2 h1:B7guBgY6sfk4dBlv/ORUxyYlp0UojYaYyATgtNwSCXc= +github.com/moby/buildkit v0.12.2/go.mod h1:adB4y0SxxX8trnrY+oEulb48ODLqPO6pKMF0ppGcCoI= github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg= github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk= @@ -617,17 +619,15 @@ github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b h1:YWuSjZCQAPM8UUBLkYUk1e+rZcvWHJmFb6i6rM44Xs8= -github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ= -github.com/opencontainers/runc v1.1.5 h1:L44KXEpKmfWDcS02aeGm8QNTFXTo2D+8MYGDIJ/GDEs= -github.com/opencontainers/runc v1.1.5/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg= -github.com/opencontainers/runtime-spec v1.1.0-rc.1 h1:wHa9jroFfKGQqFHj0I1fMRKLl0pfj+ynAqBxo3v6u9w= -github.com/opencontainers/runtime-spec v1.1.0-rc.1/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/image-spec v1.1.0-rc3 h1:fzg1mXZFj8YdPeNkRXMg+zb88BFV0Ys52cJydRwBkb8= +github.com/opencontainers/image-spec v1.1.0-rc3/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8= +github.com/opencontainers/runc v1.1.7 h1:y2EZDS8sNng4Ksf0GUYNhKbTShZJPJg1FiXJNH/uoCk= +github.com/opencontainers/runc v1.1.7/go.mod h1:CbUumNnWCuTGFukNXahoo/RFBZvDAgRh/smNYNOhA50= +github.com/opencontainers/runtime-spec v1.1.0-rc.2 h1:ucBtEms2tamYYW/SvGpvq9yUN0NEVL6oyLEwDcTSrk8= +github.com/opencontainers/runtime-spec v1.1.0-rc.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/selinux v1.11.0 h1:+5Zbo97w3Lbmb3PeqQtpmTkMwsW5nRI3YaLpt7tQ7oU= github.com/opencontainers/selinux v1.11.0/go.mod h1:E5dMC3VPuVvVHDYmi78qvhJp8+M586T4DlDRYpFkyec= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/package-url/packageurl-go v0.1.1-0.20220428063043-89078438f170 h1:DiLBVp4DAcZlBVBEtJpNWZpZVq0AEeCY7Hqk8URVs4o= -github.com/package-url/packageurl-go v0.1.1-0.20220428063043-89078438f170/go.mod h1:uQd4a7Rh3ZsVg5j0lNyAfyxIeGde9yrlhjF78GzeW0c= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= @@ -716,8 +716,8 @@ github.com/skeema/knownhosts v1.2.0/go.mod h1:g4fPeYpque7P0xefxtGzV81ihjC8sX2Iqp github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spdx/tools-golang v0.3.1-0.20230104082527-d6f58551be3f h1:9B623Cfs+mclYK6dsae7gLSwuIBHvlgmEup87qpqsAQ= -github.com/spdx/tools-golang v0.3.1-0.20230104082527-d6f58551be3f/go.mod h1:VHzvNsKAfAGqs4ZvwRL+7a0dNsL20s7lGui4K9C0xQM= +github.com/spdx/tools-golang v0.5.1 h1:fJg3SVOGG+eIva9ZUBm/hvyA7PIPVFjRxUKe6fdAgwE= +github.com/spdx/tools-golang v0.5.1/go.mod h1:/DRDQuBfB37HctM29YtrX1v+bXiVmT2OpQDalRmX9aU= github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= github.com/spf13/afero v1.9.5 h1:stMpOSZFs//0Lv29HduCmli3GUfpFoF3Y1Q/aXj/wVM= diff --git a/pkg/infrastructure/backend/dockerimpl/backend.go b/pkg/infrastructure/backend/dockerimpl/backend.go index c66d26094..0bb1a65a9 100644 --- a/pkg/infrastructure/backend/dockerimpl/backend.go +++ b/pkg/infrastructure/backend/dockerimpl/backend.go @@ -8,6 +8,7 @@ import ( "sync" "time" + clitypes "github.com/docker/cli/cli/config/types" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/client" @@ -45,7 +46,12 @@ type Backend struct { } func NewClientFromEnv() (*client.Client, error) { - return client.NewClientWithOpts(client.FromEnv) + return client.NewClientWithOpts( + client.FromEnv, + // Using github.com/moby/moby of v25 master@8e51b8b59cb8 (2023-07-18), required by github.com/moby/buildkit@v0.12.2, + // defaults to API version 1.44, which currently available docker installation does not support. + client.WithVersion("1.43"), + ) } func NewDockerBackend( @@ -164,7 +170,7 @@ func (b *Backend) authConfig() (string, error) { if b.image.Registry.Username == "" && b.image.Registry.Password == "" { return "", nil } - c := types.AuthConfig{ + c := clitypes.AuthConfig{ Username: b.image.Registry.Username, Password: b.image.Registry.Password, } diff --git a/pkg/infrastructure/buildpack/dockerimpl/backend.go b/pkg/infrastructure/buildpack/dockerimpl/backend.go index d298ec4d2..79627baea 100644 --- a/pkg/infrastructure/buildpack/dockerimpl/backend.go +++ b/pkg/infrastructure/buildpack/dockerimpl/backend.go @@ -33,7 +33,12 @@ func NewBuildpackBackend( config Config, image builder.ImageConfig, ) (builder.BuildpackBackend, error) { - c, err := client.NewClientWithOpts(client.FromEnv) + c, err := client.NewClientWithOpts( + client.FromEnv, + // Using github.com/moby/moby of v25 master@8e51b8b59cb8 (2023-07-18), required by github.com/moby/buildkit@v0.12.2, + // defaults to API version 1.44, which currently available docker installation does not support. + client.WithVersion("1.43"), + ) if err != nil { return nil, err } diff --git a/pkg/usecase/builder/build_buildkit.go b/pkg/usecase/builder/build_buildkit.go index ac45e50e1..4aab2d2ec 100644 --- a/pkg/usecase/builder/build_buildkit.go +++ b/pkg/usecase/builder/build_buildkit.go @@ -16,6 +16,7 @@ import ( "github.com/moby/buildkit/client/llb" "github.com/moby/buildkit/exporter/containerimage/exptypes" "github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb" + "github.com/moby/buildkit/frontend/dockerui" "github.com/moby/buildkit/session" "github.com/moby/buildkit/session/auth/authprovider" "github.com/moby/buildkit/util/progress/progressui" @@ -38,7 +39,7 @@ func withBuildkitProgress(ctx context.Context, logger io.Writer, buildFn func(ct }) eg.Go(func() error { // TODO: VertexWarningを使う (LLBのどのvertexに問題があったか) - _, err := progressui.DisplaySolveStatus(ctx, "", nil, logger, ch) + _, err := progressui.DisplaySolveStatus(ctx, nil, logger, ch) return err }) return eg.Wait() @@ -116,7 +117,9 @@ func (s *builderService) buildRuntimeCmd( } b, img, _, err := dockerfile2llb.Dockerfile2LLB(ctx, dockerfile.Bytes(), dockerfile2llb.ConvertOpt{ - BuildArgs: env, + Config: dockerui.Config{ + BuildArgs: env, + }, }) if err != nil { return err @@ -263,7 +266,9 @@ func (s *builderService) buildStaticDockerfile( } b, _, _, err := dockerfile2llb.Dockerfile2LLB(ctx, dockerfile, dockerfile2llb.ConvertOpt{ - BuildArgs: env, + Config: dockerui.Config{ + BuildArgs: env, + }, }) if err != nil { return err From eb3317e39d6d3e2c68c24bb23b98ac3f4929bec7 Mon Sep 17 00:00:00 2001 From: motoki317 Date: Fri, 6 Oct 2023 14:21:56 +0900 Subject: [PATCH 03/42] Fix buildkit Solve hang on context cancellation resolves #568, ref: https://github.com/moby/buildkit/pull/1721#issuecomment-703937866 --- pkg/usecase/builder/build_buildkit.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/usecase/builder/build_buildkit.go b/pkg/usecase/builder/build_buildkit.go index 4aab2d2ec..501abe777 100644 --- a/pkg/usecase/builder/build_buildkit.go +++ b/pkg/usecase/builder/build_buildkit.go @@ -39,7 +39,9 @@ func withBuildkitProgress(ctx context.Context, logger io.Writer, buildFn func(ct }) eg.Go(func() error { // TODO: VertexWarningを使う (LLBのどのvertexに問題があったか) - _, err := progressui.DisplaySolveStatus(ctx, nil, logger, ch) + // NOTE: https://github.com/moby/buildkit/pull/1721#issuecomment-703937866 + // DisplaySolveStatus's context should not be cancelled, in order to receive 'cancelled' events from buildkit API call. + _, err := progressui.DisplaySolveStatus(context.WithoutCancel(ctx), nil, logger, ch) return err }) return eg.Wait() From ba1852a1bd5cddc85e8921e51390409da021a5a0 Mon Sep 17 00:00:00 2001 From: motoki317 Date: Fri, 6 Oct 2023 14:53:34 +0900 Subject: [PATCH 04/42] Use normal dockerfile interface --- pkg/usecase/builder/build_buildkit.go | 34 ++++++++++++--------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/pkg/usecase/builder/build_buildkit.go b/pkg/usecase/builder/build_buildkit.go index 501abe777..7b260968a 100644 --- a/pkg/usecase/builder/build_buildkit.go +++ b/pkg/usecase/builder/build_buildkit.go @@ -3,7 +3,6 @@ package builder import ( "bytes" "context" - "encoding/json" "fmt" "io" "os" @@ -14,7 +13,6 @@ import ( "github.com/friendsofgo/errors" buildkit "github.com/moby/buildkit/client" "github.com/moby/buildkit/client/llb" - "github.com/moby/buildkit/exporter/containerimage/exptypes" "github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb" "github.com/moby/buildkit/frontend/dockerui" "github.com/moby/buildkit/session" @@ -118,35 +116,33 @@ func (s *builderService) buildRuntimeCmd( dockerfile.WriteString(fmt.Sprintf("RUN rm ./%v\n", buildScriptName)) } - b, img, _, err := dockerfile2llb.Dockerfile2LLB(ctx, dockerfile.Bytes(), dockerfile2llb.ConvertOpt{ - Config: dockerui.Config{ - BuildArgs: env, - }, - }) + tmpDockerfile, err := os.CreateTemp("", "dockerfile-*") if err != nil { - return err - } - config, err := json.Marshal(img) - if err != nil { - return errors.Wrap(err, "marshaling image config") + return errors.Wrap(err, "creating tmp dockerfile") } - def, err := b.Marshal(ctx) + defer os.Remove(tmpDockerfile.Name()) + _, err = io.Copy(tmpDockerfile, &dockerfile) if err != nil { - return err + return errors.Wrap(err, "writing tmp dockerfile") } - _, err = s.buildkit.Solve(ctx, def, buildkit.SolveOpt{ + _, err = s.buildkit.Solve(ctx, nil, buildkit.SolveOpt{ Exports: []buildkit.ExportEntry{{ Type: buildkit.ExporterImage, Attrs: map[string]string{ - "name": s.destImage(st.app, st.build), - "push": "true", - exptypes.ExporterImageConfigKey: string(config), + "name": s.destImage(st.app, st.build), + "push": "true", }, }}, LocalDirs: map[string]string{ - "context": st.repositoryTempDir, + "context": st.repositoryTempDir, + "dockerfile": filepath.Dir(tmpDockerfile.Name()), }, + Frontend: "dockerfile.v0", + FrontendAttrs: ds.MergeMap( + map[string]string{"filename": filepath.Base(tmpDockerfile.Name())}, + appEnvAttributes(env), + ), Session: s.authSessions(), }, ch) return err From d1d9f17d5138ba09002a17a477d4b5f0dc2879ad Mon Sep 17 00:00:00 2001 From: motoki317 Date: Fri, 6 Oct 2023 16:34:40 +0900 Subject: [PATCH 05/42] Unify build method with Dockerfile frontend (using buildkit internal llb format really makes the code fragile) --- pkg/usecase/builder/build.go | 20 +- pkg/usecase/builder/build_buildkit.go | 246 +++++++++++-------------- pkg/usecase/builder/build_buildpack.go | 50 +---- pkg/usecase/builder/build_static.go | 53 ++++++ pkg/usecase/builder/state.go | 2 +- 5 files changed, 185 insertions(+), 186 deletions(-) create mode 100644 pkg/usecase/builder/build_static.go diff --git a/pkg/usecase/builder/build.go b/pkg/usecase/builder/build.go index bff15393a..eea6e1170 100644 --- a/pkg/usecase/builder/build.go +++ b/pkg/usecase/builder/build.go @@ -140,11 +140,11 @@ func (s *builderService) buildSteps(ctx context.Context, st *state) ([]buildStep }}) steps = append(steps, buildStep{"Extract from Temporary Image", func() error { return withBuildkitProgress(ctx, st.logWriter, func(ctx context.Context, ch chan *buildkit.SolveStatus) error { - return s.buildStaticBuildpackExtract(ctx, st, ch, bc) + return s.buildStaticExtract(ctx, st, ch) }) }}) steps = append(steps, buildStep{"Cleanup Temporary Image", func() error { - return s.buildStaticBuildpackCleanup(ctx, st) + return s.buildStaticCleanup(ctx, st) }}) steps = append(steps, buildStep{"Save Artifact", func() error { return s.saveArtifact(ctx, st) @@ -155,6 +155,14 @@ func (s *builderService) buildSteps(ctx context.Context, st *state) ([]buildStep return s.buildStaticCmd(ctx, st, ch, bc) }) }}) + steps = append(steps, buildStep{"Extract from Temporary Image", func() error { + return withBuildkitProgress(ctx, st.logWriter, func(ctx context.Context, ch chan *buildkit.SolveStatus) error { + return s.buildStaticExtract(ctx, st, ch) + }) + }}) + steps = append(steps, buildStep{"Cleanup Temporary Image", func() error { + return s.buildStaticCleanup(ctx, st) + }}) steps = append(steps, buildStep{"Save Artifact", func() error { return s.saveArtifact(ctx, st) }}) @@ -164,6 +172,14 @@ func (s *builderService) buildSteps(ctx context.Context, st *state) ([]buildStep return s.buildStaticDockerfile(ctx, st, ch, bc) }) }}) + steps = append(steps, buildStep{"Extract from Temporary Image", func() error { + return withBuildkitProgress(ctx, st.logWriter, func(ctx context.Context, ch chan *buildkit.SolveStatus) error { + return s.buildStaticExtract(ctx, st, ch) + }) + }}) + steps = append(steps, buildStep{"Cleanup Temporary Image", func() error { + return s.buildStaticCleanup(ctx, st) + }}) steps = append(steps, buildStep{"Save Artifact", func() error { return s.saveArtifact(ctx, st) }}) diff --git a/pkg/usecase/builder/build_buildkit.go b/pkg/usecase/builder/build_buildkit.go index 7b260968a..cd0013217 100644 --- a/pkg/usecase/builder/build_buildkit.go +++ b/pkg/usecase/builder/build_buildkit.go @@ -1,24 +1,22 @@ package builder import ( - "bytes" "context" "fmt" "io" "os" "path/filepath" + "strings" "github.com/docker/cli/cli/config/configfile" "github.com/docker/cli/cli/config/types" "github.com/friendsofgo/errors" buildkit "github.com/moby/buildkit/client" - "github.com/moby/buildkit/client/llb" - "github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb" - "github.com/moby/buildkit/frontend/dockerui" "github.com/moby/buildkit/session" "github.com/moby/buildkit/session/auth/authprovider" "github.com/moby/buildkit/util/progress/progressui" "github.com/samber/lo" + log "github.com/sirupsen/logrus" "golang.org/x/sync/errgroup" "github.com/traPtitech/neoshowcase/pkg/domain" @@ -45,6 +43,26 @@ func withBuildkitProgress(ctx context.Context, logger io.Writer, buildFn func(ct return eg.Wait() } +func createTempFile(pattern string, content string) (name string, cleanup func(), err error) { + f, err := os.CreateTemp("", pattern) + if err != nil { + return "", nil, errors.Wrap(err, "creating temp "+pattern+" file") + } + defer f.Close() + cleanup = func() { + err := os.Remove(f.Name()) + if err != nil { + log.Errorf("removing temp file "+f.Name()+": %+v", err) + } + } + _, err = f.WriteString(content) + if err != nil { + cleanup() + return "", nil, errors.Wrap(err, "writing to temp file "+f.Name()) + } + return f.Name(), cleanup, nil +} + func createFile(filename string, content string) error { f, err := os.OpenFile(filename, os.O_RDWR|os.O_CREATE|os.O_TRUNC, os.ModePerm) if err != nil { @@ -76,10 +94,37 @@ func (s *builderService) authSessions() []session.Attachable { })} } -func appEnvAttributes(env map[string]string) map[string]string { - return lo.MapEntries(env, func(k string, v string) (string, string) { - return "build-arg:" + k, v - }) +func (s *builderService) solveDockerfile( + ctx context.Context, + dest string, + contextDir string, + dockerfileDir, dockerfileName string, + env map[string]string, + ch chan *buildkit.SolveStatus, +) error { + opts := buildkit.SolveOpt{ + Exports: []buildkit.ExportEntry{{ + Type: buildkit.ExporterImage, + Attrs: map[string]string{ + "name": dest, + "push": "true", + }, + }}, + LocalDirs: map[string]string{ + "context": contextDir, + "dockerfile": dockerfileDir, + }, + Frontend: "dockerfile.v0", + FrontendAttrs: ds.MergeMap( + map[string]string{"filename": dockerfileName}, + lo.MapEntries(env, func(k string, v string) (string, string) { + return "build-arg:" + k, v + }), + ), + Session: s.authSessions(), + } + _, err := s.buildkit.Solve(ctx, nil, opts, ch) + return err } func (s *builderService) buildRuntimeCmd( @@ -88,7 +133,7 @@ func (s *builderService) buildRuntimeCmd( ch chan *buildkit.SolveStatus, bc *domain.BuildConfigRuntimeCmd, ) error { - var dockerfile bytes.Buffer + var dockerfile strings.Builder if bc.BaseImage == "" { dockerfile.WriteString("FROM scratch\n") } else { @@ -116,36 +161,21 @@ func (s *builderService) buildRuntimeCmd( dockerfile.WriteString(fmt.Sprintf("RUN rm ./%v\n", buildScriptName)) } - tmpDockerfile, err := os.CreateTemp("", "dockerfile-*") - if err != nil { - return errors.Wrap(err, "creating tmp dockerfile") - } - defer os.Remove(tmpDockerfile.Name()) - _, err = io.Copy(tmpDockerfile, &dockerfile) + tmpName, cleanup, err := createTempFile("dockerfile-*", dockerfile.String()) if err != nil { - return errors.Wrap(err, "writing tmp dockerfile") + return err } + defer cleanup() - _, err = s.buildkit.Solve(ctx, nil, buildkit.SolveOpt{ - Exports: []buildkit.ExportEntry{{ - Type: buildkit.ExporterImage, - Attrs: map[string]string{ - "name": s.destImage(st.app, st.build), - "push": "true", - }, - }}, - LocalDirs: map[string]string{ - "context": st.repositoryTempDir, - "dockerfile": filepath.Dir(tmpDockerfile.Name()), - }, - Frontend: "dockerfile.v0", - FrontendAttrs: ds.MergeMap( - map[string]string{"filename": filepath.Base(tmpDockerfile.Name())}, - appEnvAttributes(env), - ), - Session: s.authSessions(), - }, ch) - return err + return s.solveDockerfile( + ctx, + s.destImage(st.app, st.build), + st.repositoryTempDir, + filepath.Dir(tmpName), + filepath.Base(tmpName), + env, + ch, + ) } func (s *builderService) buildRuntimeDockerfile( @@ -158,28 +188,16 @@ func (s *builderService) buildRuntimeDockerfile( if err != nil { return err } - contextDir := lo.Ternary(bc.Context != "", bc.Context, ".") - _, err = s.buildkit.Solve(ctx, nil, buildkit.SolveOpt{ - Exports: []buildkit.ExportEntry{{ - Type: buildkit.ExporterImage, - Attrs: map[string]string{ - "name": s.destImage(st.app, st.build), - "push": "true", - }, - }}, - LocalDirs: map[string]string{ - "context": filepath.Join(st.repositoryTempDir, contextDir), - "dockerfile": filepath.Join(st.repositoryTempDir, contextDir), - }, - Frontend: "dockerfile.v0", - FrontendAttrs: ds.MergeMap( - map[string]string{"filename": bc.DockerfileName}, - appEnvAttributes(env), - ), - Session: s.authSessions(), - }, ch) - return err + return s.solveDockerfile( + ctx, + s.destImage(st.app, st.build), + filepath.Join(st.repositoryTempDir, contextDir), + filepath.Join(st.repositoryTempDir, contextDir), + bc.DockerfileName, + env, + ch, + ) } func (s *builderService) buildStaticCmd( @@ -188,62 +206,50 @@ func (s *builderService) buildStaticCmd( ch chan *buildkit.SolveStatus, bc *domain.BuildConfigStaticCmd, ) error { - var ls llb.State - if bc.BaseImage == "" { - ls = llb.Scratch() - } else { - ls = llb.Image(bc.BaseImage) - } + var dockerfile strings.Builder + + dockerfile.WriteString(fmt.Sprintf( + "FROM %s\n", + lo.Ternary(bc.BaseImage == "", "scratch", bc.BaseImage), + )) env, err := s.appEnv(ctx, st.app) if err != nil { return err } - for key, value := range env { - ls = ls.AddEnv(key, value) + for key := range env { + dockerfile.WriteString(fmt.Sprintf("ARG %v\n", key)) + dockerfile.WriteString(fmt.Sprintf("ENV %v=$%v\n", key, key)) } - ls = ls. - Dir("/srv"). - File(llb.Copy(llb.Local("local-src"), ".", ".", &llb.CopyInfo{ - CopyDirContentsOnly: true, - AllowWildcard: true, - CreateDestPath: true, - })) + dockerfile.WriteString("WORKDIR /srv\n") + dockerfile.WriteString("COPY . .\n") if bc.BuildCmd != "" { err := createScriptFile(filepath.Join(st.repositoryTempDir, buildScriptName), bc.BuildCmd) if err != nil { return err } - ls = ls.Run(llb.Args([]string{"./" + buildScriptName})).Root() - ls = ls.Run(llb.Args([]string{"rm", "./" + buildScriptName})).Root() + dockerfile.WriteString("RUN ./" + buildScriptName + "\n") + dockerfile.WriteString("RUN rm ./" + buildScriptName + "\n") } - // ビルドで生成された静的ファイルのみを含むScratchイメージを構成 - def, err := llb. - Scratch(). - File(llb.Copy(ls, filepath.Join("/srv", bc.ArtifactPath), "/", &llb.CopyInfo{ - CopyDirContentsOnly: true, - CreateDestPath: true, - AllowWildcard: true, - })). - Marshal(ctx) + tmpName, cleanup, err := createTempFile("dockerfile-*", dockerfile.String()) if err != nil { - return errors.Wrap(err, "failed to marshal llb") + return err } + defer cleanup() - _, err = s.buildkit.Solve(ctx, def, buildkit.SolveOpt{ - Exports: []buildkit.ExportEntry{{ - Type: buildkit.ExporterTar, - Output: func(_ map[string]string) (io.WriteCloser, error) { return st.artifactTempFile, nil }, - }}, - LocalDirs: map[string]string{ - "local-src": st.repositoryTempDir, - }, - Session: s.authSessions(), - }, ch) - return err + st.staticDest = filepath.Join("/srv", bc.ArtifactPath) + return s.solveDockerfile( + ctx, + s.tmpDestImage(st.app, st.build), + st.repositoryTempDir, + filepath.Dir(tmpName), + filepath.Base(tmpName), + env, + ch, + ) } func (s *builderService) buildStaticDockerfile( @@ -252,47 +258,19 @@ func (s *builderService) buildStaticDockerfile( ch chan *buildkit.SolveStatus, bc *domain.BuildConfigStaticDockerfile, ) error { - contextDir := lo.Ternary(bc.Context != "", bc.Context, ".") - dockerfile, err := os.ReadFile(filepath.Join(st.repositoryTempDir, contextDir, bc.DockerfileName)) - if err != nil { - return err - } - env, err := s.appEnv(ctx, st.app) if err != nil { return err } - - b, _, _, err := dockerfile2llb.Dockerfile2LLB(ctx, dockerfile, dockerfile2llb.ConvertOpt{ - Config: dockerui.Config{ - BuildArgs: env, - }, - }) - if err != nil { - return err - } - - def, err := llb. - Scratch(). - File(llb.Copy(*b, bc.ArtifactPath, "/", &llb.CopyInfo{ - CopyDirContentsOnly: true, - CreateDestPath: true, - AllowWildcard: true, - })). - Marshal(ctx) - if err != nil { - return err - } - - _, err = s.buildkit.Solve(ctx, def, buildkit.SolveOpt{ - Exports: []buildkit.ExportEntry{{ - Type: buildkit.ExporterTar, - Output: func(_ map[string]string) (io.WriteCloser, error) { return st.artifactTempFile, nil }, - }}, - LocalDirs: map[string]string{ - "context": filepath.Join(st.repositoryTempDir, contextDir), - }, - Session: s.authSessions(), - }, ch) - return err + contextDir := lo.Ternary(bc.Context != "", bc.Context, ".") + st.staticDest = bc.ArtifactPath + return s.solveDockerfile( + ctx, + s.tmpDestImage(st.app, st.build), + filepath.Join(st.repositoryTempDir, contextDir), + filepath.Join(st.repositoryTempDir, contextDir), + bc.DockerfileName, + env, + ch, + ) } diff --git a/pkg/usecase/builder/build_buildpack.go b/pkg/usecase/builder/build_buildpack.go index f83e9c273..5bb24275c 100644 --- a/pkg/usecase/builder/build_buildpack.go +++ b/pkg/usecase/builder/build_buildpack.go @@ -2,13 +2,8 @@ package builder import ( "context" - "io" "path/filepath" - "github.com/friendsofgo/errors" - buildkit "github.com/moby/buildkit/client" - "github.com/moby/buildkit/client/llb" - "github.com/regclient/regclient/types/ref" "github.com/samber/lo" "github.com/traPtitech/neoshowcase/pkg/domain" @@ -44,49 +39,6 @@ func (s *builderService) buildStaticBuildpackPack( if err != nil { return err } - st.buildpackDest = path + st.staticDest = filepath.Join(path, bc.ArtifactPath) return nil } - -func (s *builderService) buildStaticBuildpackExtract( - ctx context.Context, - st *state, - ch chan *buildkit.SolveStatus, - bc *domain.BuildConfigStaticBuildpack, -) error { - ls := llb.Image(s.tmpDestImage(st.app, st.build)) - // ビルドで生成された静的ファイルのみを含むScratchイメージを構成 - def, err := llb. - Scratch(). - File(llb.Copy(ls, filepath.Join(st.buildpackDest, bc.ArtifactPath), "/", &llb.CopyInfo{ - CopyDirContentsOnly: true, - CreateDestPath: true, - AllowWildcard: true, - })). - Marshal(ctx) - if err != nil { - return errors.Wrap(err, "failed to marshal llb") - } - _, err = s.buildkit.Solve(ctx, def, buildkit.SolveOpt{ - Exports: []buildkit.ExportEntry{{ - Type: buildkit.ExporterTar, - Output: func(_ map[string]string) (io.WriteCloser, error) { return st.artifactTempFile, nil }, - }}, - LocalDirs: map[string]string{ - "local-src": st.repositoryTempDir, - }, - Session: s.authSessions(), - }, ch) - return err -} - -func (s *builderService) buildStaticBuildpackCleanup( - ctx context.Context, - st *state, -) error { - tagRef, err := ref.New(s.config.TmpImageName(st.app.ID) + ":" + st.build.ID) - if err != nil { - return err - } - return s.registry.TagDelete(ctx, tagRef) -} diff --git a/pkg/usecase/builder/build_static.go b/pkg/usecase/builder/build_static.go new file mode 100644 index 000000000..e22015e18 --- /dev/null +++ b/pkg/usecase/builder/build_static.go @@ -0,0 +1,53 @@ +package builder + +import ( + "context" + "io" + + "github.com/friendsofgo/errors" + buildkit "github.com/moby/buildkit/client" + "github.com/moby/buildkit/client/llb" + "github.com/regclient/regclient/types/ref" +) + +func (s *builderService) buildStaticExtract( + ctx context.Context, + st *state, + ch chan *buildkit.SolveStatus, +) error { + ls := llb.Image(s.tmpDestImage(st.app, st.build)) + // ビルドで生成された静的ファイルのみを含むScratchイメージを構成 + def, err := llb. + Scratch(). + File(llb.Copy(ls, st.staticDest, "/", &llb.CopyInfo{ + CopyDirContentsOnly: true, + CreateDestPath: true, + AllowWildcard: true, + })). + Marshal(ctx) + if err != nil { + return errors.Wrap(err, "failed to marshal llb") + } + _, err = s.buildkit.Solve(ctx, def, buildkit.SolveOpt{ + Exports: []buildkit.ExportEntry{{ + Type: buildkit.ExporterTar, + Output: func(_ map[string]string) (io.WriteCloser, error) { return st.artifactTempFile, nil }, + }}, + LocalDirs: map[string]string{ + "local-src": st.repositoryTempDir, + }, + Session: s.authSessions(), + }, ch) + return err +} + +func (s *builderService) buildStaticCleanup( + ctx context.Context, + st *state, +) error { + tagRef, err := ref.New(s.tmpDestImage(st.app, st.build)) + if err != nil { + return err + } + return s.registry.TagDelete(ctx, tagRef) +} diff --git a/pkg/usecase/builder/state.go b/pkg/usecase/builder/state.go index 10bf9e406..5f79d6ae6 100644 --- a/pkg/usecase/builder/state.go +++ b/pkg/usecase/builder/state.go @@ -54,7 +54,7 @@ type state struct { artifactTempFile *os.File done chan struct{} - buildpackDest string + staticDest string } func newState(app *domain.Application, build *domain.Build, repo *domain.Repository, response chan<- *pb.BuilderResponse) (*state, error) { From eef7592771dacc82f57041dc600ec820299e6c24 Mon Sep 17 00:00:00 2001 From: motoki317 Date: Fri, 6 Oct 2023 17:12:10 +0900 Subject: [PATCH 06/42] Add development instructions --- .local-dev/manifest/README.md | 2 +- README.md | 13 +------- docs/development.md | 63 +++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 13 deletions(-) create mode 100644 docs/development.md diff --git a/.local-dev/manifest/README.md b/.local-dev/manifest/README.md index 8737249f9..f6c6a0709 100644 --- a/.local-dev/manifest/README.md +++ b/.local-dev/manifest/README.md @@ -1,6 +1,6 @@ # manifest -Manifest files required to deploy NeoShowcase locally +Manifest files required to deploy NeoShowcase locally using k8s backend ## bootstrap diff --git a/README.md b/README.md index 558b410f0..fb4aaf71e 100644 --- a/README.md +++ b/README.md @@ -10,15 +10,4 @@ This application is a successor to [kaz/showcase](https://github.com/kaz/showcas ## Development -- `make`: Display Makefile help -- `make up`: Spin up development environment -- `make down`: Tear down development environment - -### Workaround - -Add following to your `/etc/hosts` before executing `make up` -(workaround to issue #493) - -``` -127.0.0.1 registry.local -``` +See [development.md](./docs/development.md). diff --git a/docs/development.md b/docs/development.md new file mode 100644 index 000000000..0f0924e2f --- /dev/null +++ b/docs/development.md @@ -0,0 +1,63 @@ +# Development + +## Workaround Notes + +### Local (docker) + +Add following to your `/etc/hosts` before executing `make up` +(workaround to issue #493) + +``` +127.0.0.1 registry.local +``` + +### Accessing wildcard local domains + +`*.local.trapti.tech`, `local.trapti.tech` which points to `127.0.0.1` are used during development. + +Accessing wildcard domains when running under WSL environment may require configuring Windows `C:\Windows\System32\drivers\etc\hosts` file like following. + +```plaintext +127.0.0.1 ns.local.trapti.tech +::1 ns.local.trapti.tech localhost +``` + +## Environments + +### docker (main dev environment) + +- `make`: Display Makefile help +- `make up`: Spin up local docker development environment +- `make down`: Tear down local docker development environment + +Everything should automatically start after running `make up`. + +- Dashboard: http://ns.local.trapti.tech/ +- Gateway debug: `make ns-evans` + +### k3s + +Manifest files and instructions for debugging k8s backend implementation using k3s are available at [.local-dev/manifest](../.local-dev/manifest). + +## Testing + +### dind for docker test + +dind (Docker in Docker) allows separation of docker environment from the host. + +Run docker backend implementation tests as follows: + +1. `make dind-up` +2. `make docker-test` +3. `make dind-down` + +### k3d for k8s test + +k3d (k3s in docker) allows separation of k3s environment from the host. +k3s nodes will be available as docker containers. + +Run k8s backend implementation tests as follows: + +1. `make k3d-up` +2. `make k8s-test` +3. `make k3d-down` From 1c22ca1e084ed1f71d992739f6334b0c42a75337 Mon Sep 17 00:00:00 2001 From: motoki317 Date: Fri, 6 Oct 2023 17:16:04 +0900 Subject: [PATCH 07/42] add architecture doc resolves #697 --- docs/architecture.md | 108 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 docs/architecture.md diff --git a/docs/architecture.md b/docs/architecture.md new file mode 100644 index 000000000..19b06f524 --- /dev/null +++ b/docs/architecture.md @@ -0,0 +1,108 @@ +# Architecture + +Currently only available in Japanese. + +## 概要 + +NeoShowcaseはtraP部員(ユーザー)が利用できるPaaS(Platform as a Service)です。 +ここでのPaaSとは、ユーザーが動かしたいアプリケーションのコードと少しの設定を持ち込むだけで、PaaSがアプリケーションをユーザーの代わりに動かすサービスをいいます。 +ユーザーはGit上で自身のアプリケーションのコードを管理し、GitHubやGiteaなどのサービスにそれをpushすることで、NeoShowcaseが更新を自動で検知し、ユーザーの設定に従ってビルドを行いアプリケーションを動かします。 + +NeoShowcaseの大きな設計思想の一つに"reconciliation loop"というものがあります(reconciliation pattern, synchronization, eventual consistencyなどとも)。 +これはKubernetesのcontrollerの処理方法に大きく影響を受けています(実際、NeoShowcase自身も一種のcontrollerと呼べるはずです)。 +対比されるものに"イベント駆動"(event-driven)な設計があり、これはユーザーのアクションや外部のイベントなどにより内部のプロセスが起動し、何らかの処理を行い、またさらに必要に応じてイベントを発火するものです。 +しかし、通信中にイベントが失われたり、イベントによって起動された処理が失敗したりクラッシュしたりすると、それのリトライ処理や失敗の処理の方法が複雑になったりします。 +対して"reconciliation loop"では、あるプロセスは一定時間ごとにシステムの状態を監視し、現在の状態が望むものでなかった場合のみ、望む状態になるように処理 "reconciliation" を行います。 +イベント駆動に対して少し計算量は多くなる傾向にありますが、複雑なリトライ処理を考える必要はなく、各プロセスは自身が担当する状態のみを理想状態に持っていくことだけを管理すればよくなるため、処理が簡単になります。 + +各コンポーネントは自身の"reconciliation loop"を持っています。 + +- controller/repository_fetcher: 3分毎またはイベント発生時に、DBからリポジトリ一覧とアプリ一覧を取得、アプリそれぞれが指定するgit refに対応する最新のcommit hashを取得、DBにその値を保存します。 + - これはArgoCDの更新方法に影響を受けています + - > Argo CD polls Git repositories every three minutes to detect changes to the manifests. https://argo-cd.readthedocs.io/en/stable/operator-manual/webhook/ +- controller/continuous_deployment/build_registerer: 3分毎またはイベント発生時に、まだビルドが行われていない(DBにビルド情報がqueueされていない)アプリをリストアップし、必要なビルド情報をDBに"queued"として保存します。 +- controller/continuous_deployment/build_starter: 3分毎またはイベント発生に、接続されているbuilderに次にqueueされたビルドを行うよう指示します。 +- controller/continuous_deployment/build_crash_detector: 1分毎に、builderがクラッシュまたは応答しなくなった場合にそれを検知し、該当ビルドを失敗として記録します。 +- controller/continuous_deployment/deployments_synchronizer: 3分毎またはイベント発生時に、"起動しているべき"アプリそれぞれに対して最新のビルドが終了したかチェックし、その場合はbackendとssgenにsynchronizationを依頼します。 +- controller/backend: dockerまたはk8sのシステムに接続し、実際にコンテナの起動やネットワークの管理を行います。"起動しているべき"アプリの設定一覧を受け取り、実際のシステムの状態がそれと一致するようにコンテナの起動/削除やルーティングを行います。また、ss-genが設定した配信サーバーへルーティングも行います。 +- ss-gen: 3分毎またはイベント発生時に、静的サイトのファイルをStorageからダウンロードし、配信可能なように配置します。 + +以上のように、各コンポーネントは自身が担当する状態のみを監視しそれに専念することで、全体としてはfailureに強いシステムを構築できます。 + +## コンポーネント + +### traefik-forward-auth + +https://github.com/traPtitech/traefik-forward-auth + +[traefik proxy](https://doc.traefik.io/traefik/) のforward auth middlewareを利用して、ユーザー認証を行います。 + +基本的に、 + +- 認証済みなら200 OK + - softの場合は `/_oauth/login` でログイン可能 +- 未認証なら設定されたOAuth/OIDCの認証を行うために307 Temporary Redirect + - OAuth2リクエストではprompt=noneを最初に試すため、認可画面は(ルートドメインごとに)最初の一度だけしか現れない + +のみを行うHTTPサーバーです。 +細かい挙動はREADMEを見てください。 + +### Gateway (ns-gateway) + +ユーザーがフロントエンド(dashboard)から直接操作する部分です。 +HTTP/1.1上で既存のproxy認証を利用しつつ、型付きの安全な通信を行うため、[Connect · Simple, reliable, interoperable. A better gRPC.](https://connect.build/) を使用しています。 + +Gatewayというと多数のmicroserviceをまとめるAPI Gatewayがよくありますが、そこまで複雑なAPIでもないため、Gateway自身が全てのAPI操作を担っています。 + +リクエストを受け取り、ControllerやDB、Storageから各種必要な情報を読取ったり、書き込みます。 +Controllerに向けてイベントも発火しますが、このイベントが万が一抜け落ちてもcontroller内部のreconciliation loopによりシステムは自動的に自身の状態を回復します。 + +### Controller (ns-controller) + +NeoShowcaseのコアとなる部分です。 +DBに記述された状態を各サブコンポーネントが監視し、望む状態へと持っていき、最終的にアプリのデプロイを行います。 + +重要なサブコンポーネントの機能は上の記述を参照してください。 + +### Builder (ns-builder) + +Controllerからビルドの指示を受け取り、実際にOCI Image(docker image)のビルドを行います。 + +現在、ビルド方法は5種類存在します。 + +- Runtime (buildpack): [Cloud Native Buildpacks · Cloud Native Buildpacks](https://buildpacks.io/) を用いてruntimeアプリのビルドを行います。一般的なアプリであればzero configでビルドすることも可能です。herokuでも使われているやつです。 +- Runtime (command): ベースイメージ、ビルド時と起動時のコマンド(シェルスクリプト)をそれぞれ直接記述する方式です。 +- Runtime (dockerfile): Dockerfileを指定してビルドする方式です。上2つよりカスタマイズ性が高くなります。 +- Static (command): ベースイメージ、ビルド時のコマンド(シェルスクリプト)、ビルド成果物(artifact)が生成されるパスをそれぞれ直接指定し、静的サイトをビルドする方式です。 +- Static (dockerfile): Dockerfileを指定して静的サイトをビルドする方式です。上のcommand方式よりカスタマイズ性が高くなります。 + +それぞれのビルド方法に従ってビルドを行い、生成されたイメージをregistryにpushします。 + +### Static-Site Generator (ns-ssgen) + +静的サイトのビルド成果物ファイルを配置し、配信を行うように設定します。 + +apache httpd, nginx, caddyなどの静的配信プロセスに対して設定を行うように拡張できます。 + +### Migrator (ns-migrate) + +データベースのマイグレーションを行います。 +Goのコードすら無く、[sqldef](https://github.com/k0kubun/sqldef) を実行するスクリプトからのみなります。 + +マイグレーション時はまず新旧バージョン両方にcompatibleなスキーマを定義し、先にsqldefを実行してスキーマを変更します。 +その後、手動もしくはコード内から必要なデータを補完していくことで、ゼロダウンタイムでの移行が可能になります。 + +もっとも、NeoShowcaseのアプリ自体はcontrollerの介入が無くても動き続けるため、NeoShowcase自身のHigh Availabilityを保証しなくて良い場合はスキーマがbackwards-compatibleなマイグレーションを行う必要は無いです。 + +## 各種バックエンドとの対応 + +NeoShowcaseは特定のクラウドに依存しないよう、traefikをベースに設計されています。 +各種クラウドのIngress Controllerに対応させることも理論上は可能ですが、実装が多くなって辛いと思います。 + +| | Docker(traefik) | K8s(traefik) | K8s(Cloud) | +|-----------|-------------------------|---------------------------------------|----------------| +| ルーティング | traefik docker provider | traefik CRD provider | Ingress (未実装) | +| 証明書取得 | traefik Let's encrypt | traefik Let's encrypt or cert-manager | クラウドによる | +| 部員認証 | traefik middleware | traefik middleware | クラウドによる | +| ネットワークの分離 | docker network | NetworkPolicy | クラウドによる | +| コンテナ | docker container | StatefulSet など | StatefulSet など | From 78160674a8d0bc829e2ae727202ceb506b9e817e Mon Sep 17 00:00:00 2001 From: motoki317 Date: Fri, 6 Oct 2023 17:26:22 +0900 Subject: [PATCH 08/42] Add components doc --- README.md | 6 ++ docs/components.md | 171 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 177 insertions(+) create mode 100644 docs/components.md diff --git a/README.md b/README.md index fb4aaf71e..c6781e729 100644 --- a/README.md +++ b/README.md @@ -11,3 +11,9 @@ This application is a successor to [kaz/showcase](https://github.com/kaz/showcas ## Development See [development.md](./docs/development.md). + +## Architecture + +See: +- [architecture.md](./docs/architecture.md) for big picture of the architecture +- [components.md](./docs/components.md) for detailed explanation of components and libraries diff --git a/docs/components.md b/docs/components.md new file mode 100644 index 000000000..a2ba091ad --- /dev/null +++ b/docs/components.md @@ -0,0 +1,171 @@ +# Components + +Currently only available in Japanese. + +NeoShowcaseの開発・運用に使われている要素技術の紹介 + +## Standalone Components + +### [Buildkit](https://github.com/moby/buildkit) + +Dockerイメージをビルドするツール + +Dockerの代わりにDockerイメージをビルドできて、コンテナの中で動かすことができる。 +[`buildkitd`](https://github.com/moby/buildkit#containerizing-buildkit)と言うデーモンを起動することでgRPC APIを用いてリモートから操作できるので、NeoShowcaseではこれをアプリビルド用のサーバーとして使う。 + +Buildkit内部ではLLB(Low Level Build definition format)という中間表現を用いてイメージのビルドを行っており、これを直接操作することも可能。 +ただしドキュメントに乏しく、Dockerfile frontendのほうが安定しているため、ほとんどはDockerfile経由でビルドしている。 +静的サイトを生成物をイメージから取り出すときなどにLLBを使っている。 + +### [Buildpacks](https://buildpacks.io/) + +Dockerfile無しでアプリケーションのコードからDockerイメージをビルドするツール + +アプリケーションが含むファイルやコードから、各"buildpack"が最適なビルド設定を検出し、Dockerイメージを作成する。 +自身で"buildpack"を作成することもできる。 + +NeoShowcaseでは主に、buildpackの実装の一つであるpaketo-buildpacksを使用。 + +### [gRPC](https://grpc.io/) + +Google謹製のHTTP/2を利用したRPCフレームワーク + +NeoShowcaseでは、管理サーバー・ビルドサーバーなど目的別サーバー間の通信手段としてgRPCを用いる。 + +`Protocol Buffer 3`形式(`.proto`)で通信で使う関数の仕様を定義すると、各種言語に対応したサーバー・クライアントのコードを自動生成してくれて、開発者は関数の中身だけ実装すれば良くなる。 + +例: [Controllerコンポーネントの`proto`ファイル](https://github.com/traPtitech/NeoShowcase/blob/bc9694ca525c1c52530fe2b0358987e64e34900e/api/proto/neoshowcase/protobuf/controller.proto) でns-controllerとns-gatewayの通信を定義して、コード自動生成すると[こんなコード](https://github.com/traPtitech/NeoShowcase/blob/bc9694ca525c1c52530fe2b0358987e64e34900e/pkg/infrastructure/grpc/pb/controller.pb.go)を自動生成してくれて、自分たちは[関数の中身の実装](https://github.com/traPtitech/NeoShowcase/blob/bc9694ca525c1c52530fe2b0358987e64e34900e/pkg/infrastructure/grpc/controller_service.go)をすればいいだけになる。 + +### [Connect](https://connect.build/) + +A better gRPC. + +HTTP/1.1, HTTP/2のPOSTメソッドだけを用いて通信を行うプロトコル。 +Connectによって生成されたサーバーまたはクライアントのコードはデフォルトでgRPC, gRPC-Web, Connectの3つのプロトコルに対応する。 + +Connect protocolのWebクライアントはデフォルトでapplication/jsonで通信を行うため、人間が理解しやすく、既存のRESTful APIのエコシステムにも上手くハマる。 +NeoShowcaseではこの利点を生かしてtraefik forward auth middlewareに認証を委譲している。 + +### [protoc (Protocol Buffer Compiler)](https://github.com/protocolbuffers/protobuf) + +`.proto`ファイルから`.go`ファイルなどを生成するときに使うコンパイラ + +`make init` で入るようにしてある。 +macなら`brew install protobuf`でも入るはず。 + +`protoc-gen-go` (protocのgoコンパイルプラグイン) が必要。 +インストール: `go install google.golang.org/protobuf/cmd/protoc-gen-go` + +https://grpc.io/docs/languages/go/quickstart/ も参照 + +### [evans](https://github.com/ktr0731/evans) + +gRPC用クライアント + +gRPCは当然Postmanとかcurlとかでアクセス出来ないので、デバッグするときとかには専用クライアントが必要。 +これは対話的に呼び出せたりして補完とかも効くので便利。 + +### [sqldef](https://github.com/k0kubun/sqldef) + +> The easiest idempotent MySQL/PostgreSQL/SQLite3/SQL Server schema management by SQL. + +.sqlファイルにテーブルやindex, foreign keyの定義を書いて、`sqldef schema.sql` すると、.sqlファイルの内容に沿うようにスキーマを変更してくれる。 + +マイグレーションバージョンの管理が必要なく、冪等で扱いやすい。 +新・旧どちらのバージョンにも互換性のあるスキーマを定義し、sqldefでスキーマを更新してから新しいバージョンのデプロイを行うのが普通。 +ただし少し凝ったスキーマの変更を行うときは、データの手動マイグレーションが必要になったり、データがうっかり落ちないように注意する必要がある。 + +### [sql-migrate](https://github.com/rubenv/sql-migrate) (現在不使用 -> sqldef) + +DBスキーママイグレーションツール + +新たなテーブルを追加したり、既存のテーブルのカラムを追加したりして、開発中にDBのテーブル構造を変えるときに、その変更手順や巻き戻し手順を書いて、DBの構造のバージョン管理をするようにするためのツール。 +多分一番シンプル。マイグレーションバージョンの管理、正しいマイグレーションスクリプトの管理を自分で行う必要がある。 + +NeoShowcaseでは昔sql-migrateを使っていたが、冪等なツールが便利そうだったのでsqldefに移行した。 + +### [tbls](https://github.com/k1LoW/tbls) + +RDBドキュメント自動生成ツール + +実際のDBからER図やドキュメントを自動生成したり、DBのLintなどもできる。 + +例: [こういうの](https://github.com/traPtitech/NeoShowcase/tree/master/docs/dbschema)を自動生成する。 + +### [golangci-lint](https://github.com/golangci/golangci-lint) + +Goコード用のLinter + +Linter: コードのフォーマットを指摘してくれたり、危ないコードや不要なコードを検出してくれるツール + +### [swagger / OpenAPI 3.0](https://swagger.io/specification/) (現在不使用 -> Connect) + +HTTPのAPI仕様を記述するための仕様 + +traPの内製サービスはほぼ全てこれでAPIの仕様を決定している。 +https://apis.trap.jp/ + +NeoShowcaseでは、昔、Webダッシュボード(管理画面)とサーバー間のAPI仕様を書くのに使っていた。 +現在はprotocファイルにかかれていることが全て。 + +### [spectral](https://github.com/stoplightio/spectral) (現在不使用) + +`swagger.yaml`用のLinter + +## Go Libraries + +### [sqlboiler](https://github.com/volatiletech/sqlboiler) + +Go用のSQLDBのORマッパー**ジェネレーター** + +他のSysAdプロジェクトでGoからMariaDBにアクセスするときには主に[Gorm](https://gorm.io/)というORMライブラリを使ってますが、NeoShowcaseではデータベースのスキーマからORMライブラリを**生成**するsqlboilerを使います。 +NeoShowcase専用のORMライブラリが出来る。 + +[DBスキーマ](https://github.com/traPtitech/NeoShowcase/tree/master/docs/dbschema)に従ってDBを作成した後、そのDBの構造に従った構造体を[こんな感じ](https://github.com/traPtitech/NeoShowcase/blob/bc9694ca525c1c52530fe2b0358987e64e34900e/pkg/infrastructure/repository/models/applications.go)で自動生成してくれる。 + +参考: +[Goの新定番?ORMのSQLBoilerを使ってみる | Qiita](https://qiita.com/uhey22e/items/640a4ae861d123b15b53) +[SQLBoiler の使い方を簡単にまとめた | note](https://note.crohaco.net/2020/golang-sqlboiler/) + +### [Echo](https://echo.labstack.com/) + +SysAd内のデファクトスタンダードなWebサーバーライブラリ + +built-inのstatic-site generator内で使用 + +### [logrus](https://github.com/sirupsen/logrus) + +コンソールログをいい感じに出力するようにするやつ + +Goの標準logライブラリと互換性があるのでimport文変えるだけで使える。 +NeoShowcase自身のログの出力にはこれを使う。 + +### [cobra](https://github.com/spf13/cobra) / [viper](https://github.com/spf13/viper) + +cobraはGoのコマンドラインツール作成支援ライブラリ +viperは設定ファイル取り扱いライブラリ + +同じ作者のライブラリで連携している。 +NeoShowcaseでは、[`cmd`](https://github.com/traPtitech/NeoShowcase/tree/master/cmd)以下で、実際の実行バイナリのコマンドを作るのに使う。 + +### [Wire](https://github.com/google/wire) + +DI(Dependency Injection)のためのコードを自動生成してくれるライブラリ + +参考: https://github.com/google/wire/tree/main/_tutorial + +### [docker/client](https://github.com/moby/moby) + +GoからDockerを操作するための公式ライブラリ + +[`backend/dockerimpl`](https://github.com/traPtitech/NeoShowcase/tree/master/pkg/infrastructure/backend/dockerimpl)中で使ってる。 + +### [Hub](https://github.com/leandro-lugaresi/hub) (現在不使用) + +PubSub型の内部イベントバスライブラリ。 + +コード内でイベントのPublish / Subscribeができる。 +イベントバス使うとコード依存が疎結合になってメンテしやすくなる。 + +任意のコントロールフローのスパゲッティ化を容易にしてしまうため、使いすぎには注意。 +必要ない場合は使わない方が吉かも。 From 9d53eae8ff51be3b2a80eaa85357889f5c9324ba Mon Sep 17 00:00:00 2001 From: motoki317 Date: Fri, 6 Oct 2023 17:30:29 +0900 Subject: [PATCH 09/42] rename --- docker-compose.yaml => compose.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docker-compose.yaml => compose.yaml (100%) diff --git a/docker-compose.yaml b/compose.yaml similarity index 100% rename from docker-compose.yaml rename to compose.yaml From d4f567d5d636cfa894824bd9b5f2523f90e0a364 Mon Sep 17 00:00:00 2001 From: motoki317 Date: Fri, 6 Oct 2023 17:33:21 +0900 Subject: [PATCH 10/42] add short intro of traefik --- docs/components.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/components.md b/docs/components.md index a2ba091ad..612fdf015 100644 --- a/docs/components.md +++ b/docs/components.md @@ -46,6 +46,13 @@ Connectによって生成されたサーバーまたはクライアントのコ Connect protocolのWebクライアントはデフォルトでapplication/jsonで通信を行うため、人間が理解しやすく、既存のRESTful APIのエコシステムにも上手くハマる。 NeoShowcaseではこの利点を生かしてtraefik forward auth middlewareに認証を委譲している。 +### [traefik proxy](https://doc.traefik.io/traefik/) + +モダンなリバースプロキシ + +各コンポーネントの接続と、ユーザーのアプリへのルーティングに使用している。 +K8s backendでは、Ingress Controllerとして使用。 + ### [protoc (Protocol Buffer Compiler)](https://github.com/protocolbuffers/protobuf) `.proto`ファイルから`.go`ファイルなどを生成するときに使うコンパイラ From dafccf1df8904c47395ce19e6be8ea7e7b81339f Mon Sep 17 00:00:00 2001 From: motoki317 Date: Fri, 6 Oct 2023 17:53:20 +0900 Subject: [PATCH 11/42] Add simple deployment instructions --- README.md | 4 ++++ docs/deployment.md | 50 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 docs/deployment.md diff --git a/README.md b/README.md index c6781e729..2a05cc422 100644 --- a/README.md +++ b/README.md @@ -17,3 +17,7 @@ See [development.md](./docs/development.md). See: - [architecture.md](./docs/architecture.md) for big picture of the architecture - [components.md](./docs/components.md) for detailed explanation of components and libraries + +## Production Deployment + +See [deployment.md](./docs/deployment.md). diff --git a/docs/deployment.md b/docs/deployment.md new file mode 100644 index 000000000..421856670 --- /dev/null +++ b/docs/deployment.md @@ -0,0 +1,50 @@ +# Deployment + +How to run a production environment + +NeoShowcase is backed by either docker or kubernetes. +Both environment works, but docker backend is limited to only one node (machine) and has a limited scalability. +Using kubernetes backend is recommended for large-scale set-up. + +NeoShowcase heavily makes use of traefik reverse-proxy. +Combining with other reverse-proxies like nginx "may" work, but is not tested. +Use and expose traefik when possible. + +Authentication is done by proxy authentication. +By default, it uses [traefik-forward-auth](https://github.com/traPtitech/traefik-forward-auth). + +## Using docker + +See [../compose.yaml](../compose.yaml) for required components. + +- ns-gateway, dashboard, ns-controller, ns-builder, ns-ssgen, ns-migrate + - NeoShowcase itself +- ns-gitea-integration (optional) + - Allows auto-sync of Gitea repositories, if you own an instance. +- ns-auth + - Proxy authentication with traefik +- static-server + - Used by "ns-ssgen", serves applications' static files. +- registry, registry-frontend + - Hosting your own docker registry is recommended. + - Public registries "may" work, but is not tested. +- buildpack, buildkitd + - Used by "ns-builder", this is where applications are actually built. +- mysql, adminer + - Used by NeoShowcase itself +- mysql, mongo, adminer + - Used by applications +- grafana, loki, promtail, victoria-metrics (or prometheus), cadvisor + - Used for displaying application metrics and logs + +## Using k8s + +NeoShowcase is NOT built against some specific cloud vendor, it is a cloud-agnostic application; it uses traefik reverse-proxy for both Ingress Controller and for routing components / deployed applications. + +Use of [k3s](https://k3s.io/) is recommended whenever possible as it is well tested against. +Using other distributions "may" very well work, but it is not tested. + +See [../.local-dev/manifest](../.local-dev/manifest) for a complete list of require components to deploy NeoShowcase. +Required components are (almost) the same with docker-backed deployment. + +Our production manifest is also available at [traPtitech/manifest](https://github.com/traPtitech/manifest). From b71157bda6e5d13cf45c7a6b139b6c21c0ff0e66 Mon Sep 17 00:00:00 2001 From: Mike DuPont Date: Tue, 10 Oct 2023 07:58:04 -0400 Subject: [PATCH 12/42] Update architecture.md --- docs/architecture.md | 114 +++++++++++++++++++------------------------ 1 file changed, 50 insertions(+), 64 deletions(-) diff --git a/docs/architecture.md b/docs/architecture.md index 19b06f524..979f5a968 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -1,108 +1,94 @@ +Here is the translation of the provided text: + # Architecture -Currently only available in Japanese. +## Overview + +NeoShowcase is a PaaS (Platform as a Service) that traP members (users) can use. In this context, PaaS refers to a service that runs applications on behalf of users with just the code of the application and minimal configuration brought in by the user. Users manage the code of their applications on Git and push it to services like GitHub or Gitea. NeoShowcase automatically detects updates and builds applications according to user settings. + +One of the major design principles of NeoShowcase is the "reconciliation loop" (also known as the reconciliation pattern, synchronization, eventual consistency, etc.). This is heavily influenced by the processing method of Kubernetes controllers (in fact, NeoShowcase can also be considered a type of controller). In contrast, there is an "event-driven" design, where internal processes are triggered by user actions or external events and perform some processing, and may fire events as needed. However, event-driven designs can become complex when events are lost during communication or when processes triggered by events fail or crash. In contrast, the "reconciliation loop" periodically monitors the system's state and only performs "reconciliation" processing if the current state is not as desired. + +While the event-driven approach tends to have slightly higher computational overhead, it eliminates the need for complex retry logic. Each process only needs to manage bringing its responsible state to the desired state, making the processing simpler. + +Each component has its own "reconciliation loop." -## 概要 +- controller/repository_fetcher: Every 3 minutes or when an event occurs, it retrieves a list of repositories and applications from the database, fetches the latest commit hash corresponding to the git ref specified by each application, and stores that value in the database. + - This is influenced by the way ArgoCD updates. Argo CD polls Git repositories every three minutes to detect changes to the manifests. -NeoShowcaseはtraP部員(ユーザー)が利用できるPaaS(Platform as a Service)です。 -ここでのPaaSとは、ユーザーが動かしたいアプリケーションのコードと少しの設定を持ち込むだけで、PaaSがアプリケーションをユーザーの代わりに動かすサービスをいいます。 -ユーザーはGit上で自身のアプリケーションのコードを管理し、GitHubやGiteaなどのサービスにそれをpushすることで、NeoShowcaseが更新を自動で検知し、ユーザーの設定に従ってビルドを行いアプリケーションを動かします。 +- controller/continuous_deployment/build_registerer: Every 3 minutes or when an event occurs, it lists applications that have not been built yet (no build information queued in the database) and saves the necessary build information in the database as "queued." -NeoShowcaseの大きな設計思想の一つに"reconciliation loop"というものがあります(reconciliation pattern, synchronization, eventual consistencyなどとも)。 -これはKubernetesのcontrollerの処理方法に大きく影響を受けています(実際、NeoShowcase自身も一種のcontrollerと呼べるはずです)。 -対比されるものに"イベント駆動"(event-driven)な設計があり、これはユーザーのアクションや外部のイベントなどにより内部のプロセスが起動し、何らかの処理を行い、またさらに必要に応じてイベントを発火するものです。 -しかし、通信中にイベントが失われたり、イベントによって起動された処理が失敗したりクラッシュしたりすると、それのリトライ処理や失敗の処理の方法が複雑になったりします。 -対して"reconciliation loop"では、あるプロセスは一定時間ごとにシステムの状態を監視し、現在の状態が望むものでなかった場合のみ、望む状態になるように処理 "reconciliation" を行います。 -イベント駆動に対して少し計算量は多くなる傾向にありますが、複雑なリトライ処理を考える必要はなく、各プロセスは自身が担当する状態のみを理想状態に持っていくことだけを管理すればよくなるため、処理が簡単になります。 +- controller/continuous_deployment/build_starter: Every 3 minutes or when an event occurs, it instructs the connected builder to perform the next queued build. -各コンポーネントは自身の"reconciliation loop"を持っています。 +- controller/continuous_deployment/build_crash_detector: Every 1 minute, it detects when the builder crashes or becomes unresponsive and records the corresponding build as a failure. -- controller/repository_fetcher: 3分毎またはイベント発生時に、DBからリポジトリ一覧とアプリ一覧を取得、アプリそれぞれが指定するgit refに対応する最新のcommit hashを取得、DBにその値を保存します。 - - これはArgoCDの更新方法に影響を受けています - - > Argo CD polls Git repositories every three minutes to detect changes to the manifests. https://argo-cd.readthedocs.io/en/stable/operator-manual/webhook/ -- controller/continuous_deployment/build_registerer: 3分毎またはイベント発生時に、まだビルドが行われていない(DBにビルド情報がqueueされていない)アプリをリストアップし、必要なビルド情報をDBに"queued"として保存します。 -- controller/continuous_deployment/build_starter: 3分毎またはイベント発生に、接続されているbuilderに次にqueueされたビルドを行うよう指示します。 -- controller/continuous_deployment/build_crash_detector: 1分毎に、builderがクラッシュまたは応答しなくなった場合にそれを検知し、該当ビルドを失敗として記録します。 -- controller/continuous_deployment/deployments_synchronizer: 3分毎またはイベント発生時に、"起動しているべき"アプリそれぞれに対して最新のビルドが終了したかチェックし、その場合はbackendとssgenにsynchronizationを依頼します。 -- controller/backend: dockerまたはk8sのシステムに接続し、実際にコンテナの起動やネットワークの管理を行います。"起動しているべき"アプリの設定一覧を受け取り、実際のシステムの状態がそれと一致するようにコンテナの起動/削除やルーティングを行います。また、ss-genが設定した配信サーバーへルーティングも行います。 -- ss-gen: 3分毎またはイベント発生時に、静的サイトのファイルをStorageからダウンロードし、配信可能なように配置します。 +- controller/continuous_deployment/deployments_synchronizer: Every 3 minutes or when an event occurs, it checks whether the latest build has completed for each "should be running" application and, if so, requests synchronization with backend and ssgen according to the user's settings. -以上のように、各コンポーネントは自身が担当する状態のみを監視しそれに専念することで、全体としてはfailureに強いシステムを構築できます。 +- controller/backend: It connects to Docker or Kubernetes systems and manages the actual launching of containers and network management. It receives a list of "should be running" applications and ensures that the actual system state matches it by starting/terminating containers and routing as needed. It also handles routing to the delivery server set by ss-gen. -## コンポーネント +- ss-gen: Every 3 minutes or when an event occurs, it downloads static site files from storage and arranges them for delivery. + +In this way, each component monitors only the state it is responsible for and focuses on bringing it to the desired state, resulting in a system that is robust against failures. + +## Components ### traefik-forward-auth https://github.com/traPtitech/traefik-forward-auth -[traefik proxy](https://doc.traefik.io/traefik/) のforward auth middlewareを利用して、ユーザー認証を行います。 +This component performs user authentication using the forward auth middleware of the traefik proxy. -基本的に、 +Basically, it does the following: -- 認証済みなら200 OK - - softの場合は `/_oauth/login` でログイン可能 -- 未認証なら設定されたOAuth/OIDCの認証を行うために307 Temporary Redirect - - OAuth2リクエストではprompt=noneを最初に試すため、認可画面は(ルートドメインごとに)最初の一度だけしか現れない +- If authenticated, return 200 OK. + - In the case of "soft," login is possible at `/_oauth/login`. +- If not authenticated, perform a 307 Temporary Redirect to carry out OAuth/OIDC authentication set in the configuration. + - OAuth2 requests first attempt "prompt=none," so the authorization screen only appears once per root domain. -のみを行うHTTPサーバーです。 -細かい挙動はREADMEを見てください。 +This is an HTTP server that performs only these actions. For detailed behavior, please refer to the README. ### Gateway (ns-gateway) -ユーザーがフロントエンド(dashboard)から直接操作する部分です。 -HTTP/1.1上で既存のproxy認証を利用しつつ、型付きの安全な通信を行うため、[Connect · Simple, reliable, interoperable. A better gRPC.](https://connect.build/) を使用しています。 +This is the part that users operate directly from the front end (dashboard). It uses [Connect](https://connect.build/) to perform typed and secure communication while using existing proxy authentication on HTTP/1.1. -Gatewayというと多数のmicroserviceをまとめるAPI Gatewayがよくありますが、そこまで複雑なAPIでもないため、Gateway自身が全てのAPI操作を担っています。 - -リクエストを受け取り、ControllerやDB、Storageから各種必要な情報を読取ったり、書き込みます。 -Controllerに向けてイベントも発火しますが、このイベントが万が一抜け落ちてもcontroller内部のreconciliation loopによりシステムは自動的に自身の状態を回復します。 +While API Gateways often aggregate multiple microservices, this Gateway handles all API operations since NeoShowcase's API is not that complex. It receives requests and reads and writes various necessary information from Controller, DB, and Storage. It also triggers events to the Controller, and even if these events were to be missed, the system would automatically recover its state through the Controller's internal reconciliation loop. ### Controller (ns-controller) -NeoShowcaseのコアとなる部分です。 -DBに記述された状態を各サブコンポーネントが監視し、望む状態へと持っていき、最終的にアプリのデプロイを行います。 +This is the core of NeoShowcase. It monitors the state recorded in the database, and each subcomponent brings it to the desired state and eventually deploys the application. -重要なサブコンポーネントの機能は上の記述を参照してください。 +For the functionality of important subcomponents, please refer to the description above. ### Builder (ns-builder) -Controllerからビルドの指示を受け取り、実際にOCI Image(docker image)のビルドを行います。 +It receives build instructions from the Controller and actually performs the build of OCI Images (Docker images). -現在、ビルド方法は5種類存在します。 +Currently, there are five types of build methods: -- Runtime (buildpack): [Cloud Native Buildpacks · Cloud Native Buildpacks](https://buildpacks.io/) を用いてruntimeアプリのビルドを行います。一般的なアプリであればzero configでビルドすることも可能です。herokuでも使われているやつです。 -- Runtime (command): ベースイメージ、ビルド時と起動時のコマンド(シェルスクリプト)をそれぞれ直接記述する方式です。 -- Runtime (dockerfile): Dockerfileを指定してビルドする方式です。上2つよりカスタマイズ性が高くなります。 -- Static (command): ベースイメージ、ビルド時のコマンド(シェルスクリプト)、ビルド成果物(artifact)が生成されるパスをそれぞれ直接指定し、静的サイトをビルドする方式です。 -- Static (dockerfile): Dockerfileを指定して静的サイトをビルドする方式です。上のcommand方式よりカスタマイズ性が高くなります。 +- Runtime (buildpack): It uses [Cloud Native Buildpacks](https://buildpacks.io/) to build runtime applications. It can build most common applications with zero config. It's also used in Heroku. +- Runtime (command): This method directly specifies the base image and the commands (shell scripts) for building and running during build. +- Runtime (dockerfile): This method specifies a Dockerfile for building. It offers higher customization than the previous two methods. +- Static (command): This method directly specifies the base image, build-time command (shell script), and the path where build artifacts are generated, to build static sites. +- Static (dockerfile): This method specifies a Dockerfile for building static sites. It offers higher customization than the command-based approach. -それぞれのビルド方法に従ってビルドを行い、生成されたイメージをregistryにpushします。 +It performs builds according to each build method and pushes the generated images to the registry. ### Static-Site Generator (ns-ssgen) -静的サイトのビルド成果物ファイルを配置し、配信を行うように設定します。 +It places the build artifacts of static sites and configures them for delivery. -apache httpd, nginx, caddyなどの静的配信プロセスに対して設定を行うように拡張できます。 +It can be extended to configure settings for static delivery processes like Apache HTTPD, Nginx, Caddy, etc. ### Migrator (ns-migrate) -データベースのマイグレーションを行います。 -Goのコードすら無く、[sqldef](https://github.com/k0kubun/sqldef) を実行するスクリプトからのみなります。 - -マイグレーション時はまず新旧バージョン両方にcompatibleなスキーマを定義し、先にsqldefを実行してスキーマを変更します。 -その後、手動もしくはコード内から必要なデータを補完していくことで、ゼロダウンタイムでの移行が可能になります。 +It performs database migrations. It relies solely on scripts executed from [sqldef](https://github.com/k0kubun/sqldef), without any Go code. -もっとも、NeoShowcaseのアプリ自体はcontrollerの介入が無くても動き続けるため、NeoShowcase自身のHigh Availabilityを保証しなくて良い場合はスキーマがbackwards-compatibleなマイグレーションを行う必要は無いです。 +During migration, it first defines a schema that is compatible with both the old and new versions. Then, it uses sqldef to make schema changes. Afterward, it complements the necessary data manually or from within the code to enable zero-downtime migration. However, since NeoShowcase's application itself continues to run without controller intervention, it's not necessary to perform migrations that are not backwards-compatible with the schema. -## 各種バックエンドとの対応 +## Compatibility with Various Backends -NeoShowcaseは特定のクラウドに依存しないよう、traefikをベースに設計されています。 -各種クラウドのIngress Controllerに対応させることも理論上は可能ですが、実装が多くなって辛いと思います。 +NeoShowcase is designed to be cloud-agnostic, based on traefik. While it's theoretically possible to adapt it to various cloud's Ingress Controllers, implementing it extensively can become challenging. | | Docker(traefik) | K8s(traefik) | K8s(Cloud) | |-----------|-------------------------|---------------------------------------|----------------| -| ルーティング | traefik docker provider | traefik CRD provider | Ingress (未実装) | -| 証明書取得 | traefik Let's encrypt | traefik Let's encrypt or cert-manager | クラウドによる | -| 部員認証 | traefik middleware | traefik middleware | クラウドによる | -| ネットワークの分離 | docker network | NetworkPolicy | クラウドによる | -| コンテナ | docker container | StatefulSet など | StatefulSet など | +| Routing | traefik docker provider | traefik CRD provider | Ingress (not implemented) | +| Certificate Acquisition | traefik From fcb2a99d7f71f93cf2642d763cba8b790233a2cb Mon Sep 17 00:00:00 2001 From: motoki317 Date: Tue, 10 Oct 2023 22:50:02 +0900 Subject: [PATCH 13/42] Format, correct some wording --- docs/architecture.md | 74 ++++++++++++++++++++++++++------------------ 1 file changed, 44 insertions(+), 30 deletions(-) diff --git a/docs/architecture.md b/docs/architecture.md index 979f5a968..d19877df8 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -1,30 +1,30 @@ -Here is the translation of the provided text: - # Architecture ## Overview -NeoShowcase is a PaaS (Platform as a Service) that traP members (users) can use. In this context, PaaS refers to a service that runs applications on behalf of users with just the code of the application and minimal configuration brought in by the user. Users manage the code of their applications on Git and push it to services like GitHub or Gitea. NeoShowcase automatically detects updates and builds applications according to user settings. +NeoShowcase is a PaaS (Platform as a Service) that traP members (users) can use. +Here, PaaS refers to a service that runs applications on behalf of users just with the source code of the application and a minimal configuration. +Users manage the source code of their applications on Git and push it to services like GitHub or Gitea. +NeoShowcase automatically detects updates and builds applications according to user settings. -One of the major design principles of NeoShowcase is the "reconciliation loop" (also known as the reconciliation pattern, synchronization, eventual consistency, etc.). This is heavily influenced by the processing method of Kubernetes controllers (in fact, NeoShowcase can also be considered a type of controller). In contrast, there is an "event-driven" design, where internal processes are triggered by user actions or external events and perform some processing, and may fire events as needed. However, event-driven designs can become complex when events are lost during communication or when processes triggered by events fail or crash. In contrast, the "reconciliation loop" periodically monitors the system's state and only performs "reconciliation" processing if the current state is not as desired. +One of the major design principles of NeoShowcase is the "reconciliation loop" (also known as the reconciliation pattern, synchronization, eventual consistency, etc.). +This is heavily influenced by the processing method of Kubernetes controllers (in fact, NeoShowcase can also be considered a Kubernetes controller). +In contrast, there is an "event-driven" design, where internal processes are triggered by user actions or external events, and perform some processing which may fire more events. +However, event-driven designs can become complex when events are lost during communication or when processes triggered by events fail or crash. +In contrast, the "reconciliation loop" periodically monitors the system's state and performs "reconciliation" only when it is not in the desired state. -While the event-driven approach tends to have slightly higher computational overhead, it eliminates the need for complex retry logic. Each process only needs to manage bringing its responsible state to the desired state, making the processing simpler. +While the event-driven approach tends to have slightly higher computational overhead, it eliminates the need for complex retry logic. +Each process only needs to bring its responsible state to the desired state, making the logic simpler. Each component has its own "reconciliation loop." - controller/repository_fetcher: Every 3 minutes or when an event occurs, it retrieves a list of repositories and applications from the database, fetches the latest commit hash corresponding to the git ref specified by each application, and stores that value in the database. - - This is influenced by the way ArgoCD updates. Argo CD polls Git repositories every three minutes to detect changes to the manifests. - + - This is influenced by the way ArgoCD updates. Argo CD polls Git repositories every three minutes to detect changes to the manifests. https://argo-cd.readthedocs.io/en/stable/operator-manual/webhook/ - controller/continuous_deployment/build_registerer: Every 3 minutes or when an event occurs, it lists applications that have not been built yet (no build information queued in the database) and saves the necessary build information in the database as "queued." - -- controller/continuous_deployment/build_starter: Every 3 minutes or when an event occurs, it instructs the connected builder to perform the next queued build. - -- controller/continuous_deployment/build_crash_detector: Every 1 minute, it detects when the builder crashes or becomes unresponsive and records the corresponding build as a failure. - -- controller/continuous_deployment/deployments_synchronizer: Every 3 minutes or when an event occurs, it checks whether the latest build has completed for each "should be running" application and, if so, requests synchronization with backend and ssgen according to the user's settings. - -- controller/backend: It connects to Docker or Kubernetes systems and manages the actual launching of containers and network management. It receives a list of "should be running" applications and ensures that the actual system state matches it by starting/terminating containers and routing as needed. It also handles routing to the delivery server set by ss-gen. - +- controller/continuous_deployment/build_starter: Every 3 minutes or when an event occurs, it instructs connected builders to process the next queued build. +- controller/continuous_deployment/build_crash_detector: Every 1 minute, it detects whether the builder crashed or became unresponsive and records the corresponding build as a failure. +- controller/continuous_deployment/deployments_synchronizer: Every 3 minutes or when an event occurs, it checks whether the latest build has completed for each application whose desired state is "running" and, if so, requests synchronization with backend and ssgen. +- controller/backend: It connects to Docker or Kubernetes and manages the actual containers and network. It receives a list of applications whose desired state is "running" and ensures that the actual system state matches it by starting/terminating containers and configuring routing. It also handles routing to the static file server configured by ss-gen. - ss-gen: Every 3 minutes or when an event occurs, it downloads static site files from storage and arranges them for delivery. In this way, each component monitors only the state it is responsible for and focuses on bringing it to the desired state, resulting in a system that is robust against failures. @@ -37,36 +37,42 @@ https://github.com/traPtitech/traefik-forward-auth This component performs user authentication using the forward auth middleware of the traefik proxy. -Basically, it does the following: +It is a simple HTTP server that performs the following: - If authenticated, return 200 OK. - - In the case of "soft," login is possible at `/_oauth/login`. + - In the case of "soft" authentication, login is possible at `/_oauth/login`. - If not authenticated, perform a 307 Temporary Redirect to carry out OAuth/OIDC authentication set in the configuration. - - OAuth2 requests first attempt "prompt=none," so the authorization screen only appears once per root domain. + - It first attempts "prompt=none", so the authorization screen should only appear once per root domain. -This is an HTTP server that performs only these actions. For detailed behavior, please refer to the README. +For detailed behavior, please refer to the README. ### Gateway (ns-gateway) -This is the part that users operate directly from the front end (dashboard). It uses [Connect](https://connect.build/) to perform typed and secure communication while using existing proxy authentication on HTTP/1.1. +This is the part where users operate directly from the front-end (dashboard). +It uses [Connect](https://connect.build/) to perform typed communication while using existing proxy authentication on HTTP/1.1. -While API Gateways often aggregate multiple microservices, this Gateway handles all API operations since NeoShowcase's API is not that complex. It receives requests and reads and writes various necessary information from Controller, DB, and Storage. It also triggers events to the Controller, and even if these events were to be missed, the system would automatically recover its state through the Controller's internal reconciliation loop. +Normally, "API Gateways" often refer to components that aggregate multiple microservices, NeoShowcase's Gateway handles all API operations by itself since NeoShowcase's API is not that complex. +It reads and writes various necessary information from the Controller, DB, and storage. +It also triggers events to the Controller, and even if these events were to be missed, the system would automatically recover to its desired state through the Controller's internal reconciliation loop. ### Controller (ns-controller) -This is the core of NeoShowcase. It monitors the state recorded in the database, and each subcomponent brings it to the desired state and eventually deploys the application. +Core of NeoShowcase + +It monitors the state in the database, and each subcomponent brings it to the desired state and eventually deploys the application. For the functionality of important subcomponents, please refer to the description above. ### Builder (ns-builder) -It receives build instructions from the Controller and actually performs the build of OCI Images (Docker images). +Receives build instructions from the Controller and performs the build of OCI Images (Docker images). -Currently, there are five types of build methods: +Currently, there are six types of build methods: - Runtime (buildpack): It uses [Cloud Native Buildpacks](https://buildpacks.io/) to build runtime applications. It can build most common applications with zero config. It's also used in Heroku. - Runtime (command): This method directly specifies the base image and the commands (shell scripts) for building and running during build. - Runtime (dockerfile): This method specifies a Dockerfile for building. It offers higher customization than the previous two methods. +- Runtime (buildpack): It uses [Cloud Native Buildpacks](https://buildpacks.io/) and a specified output path to build static applications. - Static (command): This method directly specifies the base image, build-time command (shell script), and the path where build artifacts are generated, to build static sites. - Static (dockerfile): This method specifies a Dockerfile for building static sites. It offers higher customization than the command-based approach. @@ -80,15 +86,23 @@ It can be extended to configure settings for static delivery processes like Apac ### Migrator (ns-migrate) -It performs database migrations. It relies solely on scripts executed from [sqldef](https://github.com/k0kubun/sqldef), without any Go code. +Performs database migrations. +Migrator consists of a single shell script that executes [sqldef](https://github.com/k0kubun/sqldef). + +If possible, you should first define a schema that is compatible with both the old and new versions. +Then, run this migrator to make schema changes. +Afterward, migrate the necessary data manually or from within the code to perform zero-downtime migration. -During migration, it first defines a schema that is compatible with both the old and new versions. Then, it uses sqldef to make schema changes. Afterward, it complements the necessary data manually or from within the code to enable zero-downtime migration. However, since NeoShowcase's application itself continues to run without controller intervention, it's not necessary to perform migrations that are not backwards-compatible with the schema. +However, since NeoShowcase's gateway works fine with a short controller downtime, you don't necessarily have to perform migrations that are backward-compatible. ## Compatibility with Various Backends NeoShowcase is designed to be cloud-agnostic, based on traefik. While it's theoretically possible to adapt it to various cloud's Ingress Controllers, implementing it extensively can become challenging. -| | Docker(traefik) | K8s(traefik) | K8s(Cloud) | +| | Docker(traefik) | K8s(traefik) | K8s(Cloud, not implemented) | |-----------|-------------------------|---------------------------------------|----------------| -| Routing | traefik docker provider | traefik CRD provider | Ingress (not implemented) | -| Certificate Acquisition | traefik +| Routing | traefik docker provider | traefik CRD provider | Ingress | +| Certificate Acquisition | traefik Let's encrypt | traefik Let's encrypt or cert-manager | Depends on cloud | +| Member Authentication | traefik middleware | traefik middleware | Depends on cloud | +| Networking | docker network | NetworkPolicy | Depends on cloud | +| Container | docker container | StatefulSet etc. | StatefulSet etc. | From 03e05e60c56f6440fc891e0fb8deafb0e3247225 Mon Sep 17 00:00:00 2001 From: motoki317 Date: Fri, 13 Oct 2023 09:49:19 +0900 Subject: [PATCH 14/42] display waiting / running detailed msg --- .../backend/k8simpl/list_containers.go | 22 ++++++++++++-- pkg/util/fmtutil/time.go | 29 +++++++++++++++++++ 2 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 pkg/util/fmtutil/time.go diff --git a/pkg/infrastructure/backend/k8simpl/list_containers.go b/pkg/infrastructure/backend/k8simpl/list_containers.go index 6e8380522..8a3d7bce0 100644 --- a/pkg/infrastructure/backend/k8simpl/list_containers.go +++ b/pkg/infrastructure/backend/k8simpl/list_containers.go @@ -3,6 +3,8 @@ package k8simpl import ( "context" "fmt" + "github.com/traPtitech/neoshowcase/pkg/util/fmtutil" + "time" "github.com/friendsofgo/errors" "github.com/samber/lo" @@ -63,10 +65,10 @@ func getContainerState(status v1.PodStatus) (state domain.ContainerState, messag if cs.LastTerminationState.Terminated != nil { return domain.ContainerStateRestarting, terminatedMessage(cs.LastTerminationState.Terminated) } - return domain.ContainerStateStarting, "" + return domain.ContainerStateStarting, waitingMessage(cs.State.Waiting) } if cs.State.Running != nil { - return domain.ContainerStateRunning, "" + return domain.ContainerStateRunning, runningMessage(cs.State.Running) } if cs.State.Terminated != nil { if cs.State.Terminated.ExitCode == 0 { @@ -75,7 +77,21 @@ func getContainerState(status v1.PodStatus) (state domain.ContainerState, messag return domain.ContainerStateErrored, terminatedMessage(cs.State.Terminated) } } - return domain.ContainerStateUnknown, "" + return domain.ContainerStateUnknown, "internal error: state unknown" +} + +func waitingMessage(state *v1.ContainerStateWaiting) string { + msg := state.Reason + if state.Message != "" { + msg += ": " + msg += state.Message + } + return msg +} + +func runningMessage(state *v1.ContainerStateRunning) string { + runningFor := time.Since(state.StartedAt.Time) + return "Running for " + fmtutil.DurationHuman(runningFor) } func terminatedMessage(state *v1.ContainerStateTerminated) string { diff --git a/pkg/util/fmtutil/time.go b/pkg/util/fmtutil/time.go new file mode 100644 index 000000000..af59d0302 --- /dev/null +++ b/pkg/util/fmtutil/time.go @@ -0,0 +1,29 @@ +package fmtutil + +import ( + "fmt" + "time" +) + +func DurationHuman(d time.Duration) string { + switch { + case d < time.Second: + return "less than a second" + case d < 2*time.Second: + return "a second" + case d < time.Minute: + return fmt.Sprintf("%d seconds", d/time.Second) + case d < 2*time.Minute: + return "a minute" + case d < time.Hour: + return fmt.Sprintf("%d minutes", d/time.Minute) + case d < 2*time.Hour: + return "an hour" + case d < 24*time.Hour: + return fmt.Sprintf("%d hours", d/time.Hour) + case d < 48*time.Hour: + return "a day" + default: + return fmt.Sprintf("%d days", d/time.Hour/24) + } +} From 25da5224846d851897be57b9358d9eeaedb7ffef Mon Sep 17 00:00:00 2001 From: motoki317 Date: Mon, 16 Oct 2023 15:09:56 +0900 Subject: [PATCH 15/42] Copy repository owners to app owners by default --- pkg/usecase/apiserver/app_service.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/usecase/apiserver/app_service.go b/pkg/usecase/apiserver/app_service.go index a6d089c66..83464f2e9 100644 --- a/pkg/usecase/apiserver/app_service.go +++ b/pkg/usecase/apiserver/app_service.go @@ -53,8 +53,15 @@ func (s *Service) validateApp(ctx context.Context, app *domain.Application) erro } func (s *Service) CreateApplication(ctx context.Context, app *domain.Application) (*domain.Application, error) { + // Fill owners field + repo, err := s.gitRepo.GetRepository(ctx, app.RepositoryID) + if err != nil { + return nil, errors.Wrap(err, "failed to get repository metadata") + } + app.OwnerIDs = repo.OwnerIDs + // Validate - err := s.validateApp(ctx, app) + err = s.validateApp(ctx, app) if err != nil { return nil, err } From 188ef815ca689ed8ff2d2be6bf3257024bea315e Mon Sep 17 00:00:00 2001 From: motoki317 Date: Mon, 16 Oct 2023 15:51:57 +0900 Subject: [PATCH 16/42] Sync owners of gitea repos/apps by adding owners --- cmd/wire_gen.go | 3 +- pkg/usecase/gitea-integration/integration.go | 3 ++ pkg/usecase/gitea-integration/sync.go | 55 +++++++++++++++----- pkg/util/ds/slice.go | 13 +++++ 4 files changed, 59 insertions(+), 15 deletions(-) diff --git a/cmd/wire_gen.go b/cmd/wire_gen.go index 3253eb858..404cb9d46 100644 --- a/cmd/wire_gen.go +++ b/cmd/wire_gen.go @@ -310,8 +310,9 @@ func NewGiteaIntegration(c Config) (component, error) { return nil, err } gitRepositoryRepository := repository.NewGitRepositoryRepository(db) + applicationRepository := repository.NewApplicationRepository(db) userRepository := repository.NewUserRepository(db) - integration, err := giteaintegration.NewIntegration(giteaintegrationConfig, gitRepositoryRepository, userRepository) + integration, err := giteaintegration.NewIntegration(giteaintegrationConfig, gitRepositoryRepository, applicationRepository, userRepository) if err != nil { return nil, err } diff --git a/pkg/usecase/gitea-integration/integration.go b/pkg/usecase/gitea-integration/integration.go index 4dea8848a..ce6d82f71 100644 --- a/pkg/usecase/gitea-integration/integration.go +++ b/pkg/usecase/gitea-integration/integration.go @@ -38,12 +38,14 @@ type Integration struct { cancel func() gitRepo domain.GitRepositoryRepository + appRepo domain.ApplicationRepository userRepo domain.UserRepository } func NewIntegration( c Config, gitRepo domain.GitRepositoryRepository, + appRepo domain.ApplicationRepository, userRepo domain.UserRepository, ) (*Integration, error) { if err := c.Validate(); err != nil { @@ -65,6 +67,7 @@ func NewIntegration( listInterval: time.Duration(c.ListIntervalMs) * time.Millisecond, gitRepo: gitRepo, + appRepo: appRepo, userRepo: userRepo, }, nil } diff --git a/pkg/usecase/gitea-integration/sync.go b/pkg/usecase/gitea-integration/sync.go index 73ed0d580..a9dc3a135 100644 --- a/pkg/usecase/gitea-integration/sync.go +++ b/pkg/usecase/gitea-integration/sync.go @@ -134,7 +134,7 @@ func (i *Integration) _sync(ctx context.Context) error { return nil } -func (i *Integration) syncRepository(ctx context.Context, username string, ownerIDs []string, giteaRepo *gitea.Repository) error { +func (i *Integration) syncRepository(ctx context.Context, username string, giteaOwnerIDs []string, giteaRepo *gitea.Repository) error { // NOTE: no transaction, creating repository is assumed rare repos, err := i.gitRepo.GetRepositories(ctx, domain.GetRepositoryCondition{URLs: optional.From([]string{giteaRepo.SSHURL})}) if err != nil { @@ -142,30 +142,57 @@ func (i *Integration) syncRepository(ctx context.Context, username string, owner } if len(repos) == 0 { + // Does not exist, sync repository metadata repo := domain.NewRepository( fmt.Sprintf("%v/%v", username, giteaRepo.Name), giteaRepo.SSHURL, optional.From(domain.RepositoryAuth{Method: domain.RepositoryAuthMethodSSH}), - ownerIDs, + giteaOwnerIDs, ) log.Infof("Syncing repository %v -> id: %v", repo.Name, repo.ID) - err = i.gitRepo.CreateRepository(ctx, repo) + return i.gitRepo.CreateRepository(ctx, repo) + } + + // Already exists + repo := repos[0] + + // Sync owners + // Are all repository owners on Gitea also an owner of the repository on NeoShowcase? + allOwnersAdded := lo.EveryBy(giteaOwnerIDs, func(ownerID string) bool { return slices.Contains(repo.OwnerIDs, ownerID) }) + if !allOwnersAdded { + newOwners := ds.UniqMergeSlice(repo.OwnerIDs, giteaOwnerIDs) + log.Infof("Syncing repository %v (id: %v) owners, %v users -> %v users", repo.Name, repo.ID, len(repo.OwnerIDs), len(newOwners)) + err = i.gitRepo.UpdateRepository(ctx, repo.ID, &domain.UpdateRepositoryArgs{OwnerIDs: optional.From(newOwners)}) if err != nil { return err } - } else { - // Already exists, sync owners - repo := repos[0] - slices.Sort(repo.OwnerIDs) - slices.Sort(ownerIDs) - if !ds.Equals(repo.OwnerIDs, ownerIDs) { - log.Infof("Syncing repository %v (id: %v) owners, %v users -> %v users", repo.Name, repo.ID, len(repo.OwnerIDs), len(ownerIDs)) - err = i.gitRepo.UpdateRepository(ctx, repo.ID, &domain.UpdateRepositoryArgs{OwnerIDs: optional.From(ownerIDs)}) - if err != nil { - return err - } + } + + // Sync owners of generated applications + apps, err := i.appRepo.GetApplications(ctx, domain.GetApplicationCondition{RepositoryID: optional.From(repo.ID)}) + if err != nil { + return err + } + for _, app := range apps { + err = i.syncApplication(ctx, app, giteaOwnerIDs) + if err != nil { + return err } } return nil } + +func (i *Integration) syncApplication(ctx context.Context, app *domain.Application, giteaOwnerIDs []string) error { + // Are all repository owners on Gitea also an owner of generated application on NeoShowcase? + allOwnersAdded := lo.EveryBy(giteaOwnerIDs, func(ownerID string) bool { return slices.Contains(app.OwnerIDs, ownerID) }) + if !allOwnersAdded { + newOwners := ds.UniqMergeSlice(app.OwnerIDs, giteaOwnerIDs) + log.Infof("Syncing application %v (id: %v) owners, %v users -> %v users", app.Name, app.ID, len(app.OwnerIDs), newOwners) + err := i.appRepo.UpdateApplication(ctx, app.ID, &domain.UpdateApplicationArgs{OwnerIDs: optional.From(newOwners)}) + if err != nil { + return err + } + } + return nil +} diff --git a/pkg/util/ds/slice.go b/pkg/util/ds/slice.go index 072bc50d9..2c6c0cf4f 100644 --- a/pkg/util/ds/slice.go +++ b/pkg/util/ds/slice.go @@ -1,6 +1,7 @@ package ds import ( + "github.com/samber/lo" "golang.org/x/exp/constraints" ) @@ -64,3 +65,15 @@ func FirstN[T any](s []T, n int) []T { } return s[:n] } + +func UniqMergeSlice[T comparable](s1, s2 []T) []T { + s := make([]T, 0, len(s1)+len(s2)) + for _, elt := range s1 { + s = append(s, elt) + } + for _, elt := range s2 { + s = append(s, elt) + } + lo.Uniq(s) + return s +} From 7fc9b1482d2ec98ae53504ef8a2da58023da470a Mon Sep 17 00:00:00 2001 From: motoki317 Date: Mon, 16 Oct 2023 16:27:52 +0900 Subject: [PATCH 17/42] fix logging --- pkg/usecase/gitea-integration/sync.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/usecase/gitea-integration/sync.go b/pkg/usecase/gitea-integration/sync.go index a9dc3a135..eab58fd9b 100644 --- a/pkg/usecase/gitea-integration/sync.go +++ b/pkg/usecase/gitea-integration/sync.go @@ -188,7 +188,7 @@ func (i *Integration) syncApplication(ctx context.Context, app *domain.Applicati allOwnersAdded := lo.EveryBy(giteaOwnerIDs, func(ownerID string) bool { return slices.Contains(app.OwnerIDs, ownerID) }) if !allOwnersAdded { newOwners := ds.UniqMergeSlice(app.OwnerIDs, giteaOwnerIDs) - log.Infof("Syncing application %v (id: %v) owners, %v users -> %v users", app.Name, app.ID, len(app.OwnerIDs), newOwners) + log.Infof("Syncing application %v (id: %v) owners, %v users -> %v users", app.Name, app.ID, len(app.OwnerIDs), len(newOwners)) err := i.appRepo.UpdateApplication(ctx, app.ID, &domain.UpdateApplicationArgs{OwnerIDs: optional.From(newOwners)}) if err != nil { return err From aca0f1ae35fe91b323fa21cfc9ed0689d47e86de Mon Sep 17 00:00:00 2001 From: motoki317 Date: Tue, 17 Oct 2023 13:10:10 +0900 Subject: [PATCH 18/42] reorder function --- pkg/usecase/cleaner/service.go | 60 +++++++++++++++++----------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/pkg/usecase/cleaner/service.go b/pkg/usecase/cleaner/service.go index 6d9989b8d..d95d9f5a7 100644 --- a/pkg/usecase/cleaner/service.go +++ b/pkg/usecase/cleaner/service.go @@ -92,21 +92,6 @@ func (c *cleanerService) Shutdown(_ context.Context) error { return nil } -func (c *cleanerService) getOlderBuilds(ctx context.Context, appID string, targetBuildID string) ([]*domain.Build, error) { - if targetBuildID == "" { - return nil, nil - } - builds, err := c.buildRepo.GetBuilds(ctx, domain.GetBuildCondition{ApplicationID: optional.From(appID)}) - if err != nil { - return nil, err - } - current, ok := lo.Find(builds, func(b *domain.Build) bool { return b.ID == targetBuildID }) - if !ok { - return nil, errors.Errorf("failed to find build %v in retrieved builds", targetBuildID) - } - return lo.Filter(builds, func(b *domain.Build, _ int) bool { return b.QueuedAt.Before(current.QueuedAt) }), nil -} - func (c *cleanerService) pruneImages(ctx context.Context, r *regclient.RegClient, regHost string) error { applications, err := c.appRepo.GetApplications(ctx, domain.GetApplicationCondition{DeployType: optional.From(domain.DeployTypeRuntime)}) if err != nil { @@ -171,25 +156,19 @@ func (c *cleanerService) pruneImage(ctx context.Context, r *regclient.RegClient, return nil } -func (c *cleanerService) getArtifactsNoLongerInUse(ctx context.Context) ([]*domain.Artifact, error) { - applications, err := c.appRepo.GetApplications(ctx, domain.GetApplicationCondition{ - DeployType: optional.From(domain.DeployTypeStatic), - }) +func (c *cleanerService) getOlderBuilds(ctx context.Context, appID string, targetBuildID string) ([]*domain.Build, error) { + if targetBuildID == "" { + return nil, nil + } + builds, err := c.buildRepo.GetBuilds(ctx, domain.GetBuildCondition{ApplicationID: optional.From(appID)}) if err != nil { return nil, err } - - artifacts := make([]*domain.Artifact, 0, len(applications)) - for _, app := range applications { - olderBuilds, err := c.getOlderBuilds(ctx, app.ID, app.CurrentBuild) - if err != nil { - return nil, err - } - for _, b := range olderBuilds { - artifacts = append(artifacts, b.Artifacts...) - } + current, ok := lo.Find(builds, func(b *domain.Build) bool { return b.ID == targetBuildID }) + if !ok { + return nil, errors.Errorf("failed to find build %v in retrieved builds", targetBuildID) } - return artifacts, nil + return lo.Filter(builds, func(b *domain.Build, _ int) bool { return b.QueuedAt.Before(current.QueuedAt) }), nil } func (c *cleanerService) pruneArtifacts(ctx context.Context) error { @@ -210,3 +189,24 @@ func (c *cleanerService) pruneArtifacts(ctx context.Context) error { } return nil } + +func (c *cleanerService) getArtifactsNoLongerInUse(ctx context.Context) ([]*domain.Artifact, error) { + applications, err := c.appRepo.GetApplications(ctx, domain.GetApplicationCondition{ + DeployType: optional.From(domain.DeployTypeStatic), + }) + if err != nil { + return nil, err + } + + artifacts := make([]*domain.Artifact, 0, len(applications)) + for _, app := range applications { + olderBuilds, err := c.getOlderBuilds(ctx, app.ID, app.CurrentBuild) + if err != nil { + return nil, err + } + for _, b := range olderBuilds { + artifacts = append(artifacts, b.Artifacts...) + } + } + return artifacts, nil +} From 49b24c16d20923155aaee5398e29161bb7fdf073 Mon Sep 17 00:00:00 2001 From: motoki317 Date: Tue, 17 Oct 2023 17:26:02 +0900 Subject: [PATCH 19/42] prune only current applications --- pkg/usecase/cleaner/service.go | 42 +++++++++++----------------------- 1 file changed, 13 insertions(+), 29 deletions(-) diff --git a/pkg/usecase/cleaner/service.go b/pkg/usecase/cleaner/service.go index d95d9f5a7..ca806a7d6 100644 --- a/pkg/usecase/cleaner/service.go +++ b/pkg/usecase/cleaner/service.go @@ -3,7 +3,6 @@ package cleaner import ( "context" "fmt" - "strings" "sync" "time" @@ -97,20 +96,11 @@ func (c *cleanerService) pruneImages(ctx context.Context, r *regclient.RegClient if err != nil { return err } - appsMap := lo.SliceToMap(applications, func(app *domain.Application) (string, *domain.Application) { return app.ID, app }) - repos, err := regutil.RepoList(ctx, r, regHost) - if err != nil { - return errors.Wrap(err, "failed to get image repositories") - } - - for _, imageName := range repos { - if !strings.HasPrefix(imageName, c.image.NamePrefix) { - continue - } - err = c.pruneImage(ctx, r, regHost, imageName, appsMap) + for _, app := range applications { + err = c.pruneImage(ctx, r, regHost, c.image.NamePrefix, app) if err != nil { - log.Errorf("pruning image %v: %+v", imageName, err) + log.Errorf("pruning image %v: %+v", c.image.NamePrefix+app.ID, err) // fail-safe for each image } } @@ -118,27 +108,21 @@ func (c *cleanerService) pruneImages(ctx context.Context, r *regclient.RegClient return nil } -func (c *cleanerService) pruneImage(ctx context.Context, r *regclient.RegClient, regHost string, imageName string, appsMap map[string]*domain.Application) error { - appID := strings.TrimPrefix(imageName, c.image.NamePrefix) - +func (c *cleanerService) pruneImage(ctx context.Context, r *regclient.RegClient, regHost string, imagePrefix string, app *domain.Application) error { + imageName := imagePrefix + app.ID tags, err := regutil.TagList(ctx, r, regHost, imageName) if err != nil { return errors.Wrap(err, "getting tags") } - app, ok := appsMap[appID] - var danglingTags []string - if ok { - // app still exists; compare by queued_at time, then delete any older builds - olderBuilds, err := c.getOlderBuilds(ctx, app.ID, app.CurrentBuild) - if err != nil { - return err - } - olderBuildIDs := ds.Map(olderBuilds, func(b *domain.Build) string { return b.ID }) - danglingTags = lo.Filter(tags, func(tag string, _ int) bool { return lo.Contains(olderBuildIDs, tag) }) - } else { - // app was deleted - danglingTags = tags + + // compare by queued_at time, then delete any older builds + olderBuilds, err := c.getOlderBuilds(ctx, app.ID, app.CurrentBuild) + if err != nil { + return err } + olderBuildIDs := ds.Map(olderBuilds, func(b *domain.Build) string { return b.ID }) + danglingTags := lo.Filter(tags, func(tag string, _ int) bool { return lo.Contains(olderBuildIDs, tag) }) + for _, tag := range danglingTags { // NOTE: needs manual execution of "registry garbage-collect --delete-untagged" in docker registry side // to actually delete the layers From fa97606d8f583800c9f001a53ec4e2fa79fd9f4f Mon Sep 17 00:00:00 2001 From: motoki317 Date: Tue, 17 Oct 2023 17:27:38 +0900 Subject: [PATCH 20/42] move function --- pkg/usecase/apiserver/app_service.go | 52 ++++++++++++++-------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/pkg/usecase/apiserver/app_service.go b/pkg/usecase/apiserver/app_service.go index 83464f2e9..f23405e27 100644 --- a/pkg/usecase/apiserver/app_service.go +++ b/pkg/usecase/apiserver/app_service.go @@ -145,32 +145,6 @@ func (s *Service) createApplicationDatabase(ctx context.Context, app *domain.App return nil } -func (s *Service) deleteApplicationDatabase(ctx context.Context, app *domain.Application, envs []*domain.Environment) error { - if app.Config.BuildConfig.MariaDB() { - dbKey, ok := lo.Find(envs, func(e *domain.Environment) bool { return e.Key == domain.EnvMariaDBDatabaseKey }) - if !ok { - return errors.New("failed to find mariadb name from env key") - } - err := s.mariaDBManager.Delete(ctx, domain.DeleteArgs{Database: dbKey.Value}) - if err != nil { - return err - } - } - - if app.Config.BuildConfig.MongoDB() { - dbKey, ok := lo.Find(envs, func(e *domain.Environment) bool { return e.Key == domain.EnvMongoDBDatabaseKey }) - if !ok { - return errors.New("failed to find mongodb name from env key") - } - err := s.mongoDBManager.Delete(ctx, domain.DeleteArgs{Database: dbKey.Value}) - if err != nil { - return err - } - } - - return nil -} - type TopAppInfo struct { App *domain.Application LatestBuild *domain.Build @@ -274,6 +248,32 @@ func (s *Service) UpdateApplication(ctx context.Context, id string, args *domain return nil } +func (s *Service) deleteApplicationDatabase(ctx context.Context, app *domain.Application, envs []*domain.Environment) error { + if app.Config.BuildConfig.MariaDB() { + dbKey, ok := lo.Find(envs, func(e *domain.Environment) bool { return e.Key == domain.EnvMariaDBDatabaseKey }) + if !ok { + return errors.New("failed to find mariadb name from env key") + } + err := s.mariaDBManager.Delete(ctx, domain.DeleteArgs{Database: dbKey.Value}) + if err != nil { + return err + } + } + + if app.Config.BuildConfig.MongoDB() { + dbKey, ok := lo.Find(envs, func(e *domain.Environment) bool { return e.Key == domain.EnvMongoDBDatabaseKey }) + if !ok { + return errors.New("failed to find mongodb name from env key") + } + err := s.mongoDBManager.Delete(ctx, domain.DeleteArgs{Database: dbKey.Value}) + if err != nil { + return err + } + } + + return nil +} + func (s *Service) DeleteApplication(ctx context.Context, id string) error { err := s.isApplicationOwner(ctx, id) if err != nil { From 41a6e031e84359545e823145a72bee6184a61b33 Mon Sep 17 00:00:00 2001 From: motoki317 Date: Tue, 17 Oct 2023 17:39:53 +0900 Subject: [PATCH 21/42] delete app images on app deletion --- cmd/wire_gen.go | 3 ++- pkg/usecase/apiserver/app_service.go | 34 ++++++++++++++++++++++++++++ pkg/usecase/apiserver/service.go | 7 ++++++ pkg/usecase/cleaner/service.go | 14 ++++++------ pkg/util/regutil/list.go | 4 ++-- 5 files changed, 52 insertions(+), 10 deletions(-) diff --git a/cmd/wire_gen.go b/cmd/wire_gen.go index 404cb9d46..375af1bb8 100644 --- a/cmd/wire_gen.go +++ b/cmd/wire_gen.go @@ -282,11 +282,12 @@ func NewGateway(c Config) (component, error) { } controllerServiceClientConfig := gatewayConfig.Controller controllerServiceClient := grpc.NewControllerServiceClient(controllerServiceClientConfig) + imageConfig := c.Image publicKeys, err := provideRepositoryPublicKey(c) if err != nil { return nil, err } - service, err := apiserver.NewService(artifactRepository, applicationRepository, buildRepository, environmentRepository, gitRepositoryRepository, userRepository, storage, mariaDBManager, mongoDBManager, metricsService, containerLogger, controllerServiceClient, publicKeys) + service, err := apiserver.NewService(artifactRepository, applicationRepository, buildRepository, environmentRepository, gitRepositoryRepository, userRepository, storage, mariaDBManager, mongoDBManager, metricsService, containerLogger, controllerServiceClient, imageConfig, publicKeys) if err != nil { return nil, err } diff --git a/pkg/usecase/apiserver/app_service.go b/pkg/usecase/apiserver/app_service.go index f23405e27..5bdfba93c 100644 --- a/pkg/usecase/apiserver/app_service.go +++ b/pkg/usecase/apiserver/app_service.go @@ -3,6 +3,8 @@ package apiserver import ( "context" "fmt" + "github.com/regclient/regclient/types/ref" + "github.com/traPtitech/neoshowcase/pkg/util/regutil" "strconv" "github.com/friendsofgo/errors" @@ -274,7 +276,31 @@ func (s *Service) deleteApplicationDatabase(ctx context.Context, app *domain.App return nil } +func (s *Service) deleteApplicationImages(ctx context.Context, app *domain.Application) error { + if app.DeployType != domain.DeployTypeRuntime { + return nil + } + + imageName := s.image.ImageName(app.ID) + tags, err := regutil.TagList(ctx, s.registry, imageName) + if err != nil { + return err + } + for _, tag := range tags { + tagRef, err := ref.New(imageName + ":" + tag) + if err != nil { + return err + } + err = s.registry.TagDelete(ctx, tagRef) + if err != nil { + return err + } + } + return nil +} + func (s *Service) DeleteApplication(ctx context.Context, id string) error { + // Validate err := s.isApplicationOwner(ctx, id) if err != nil { return err @@ -288,6 +314,7 @@ func (s *Service) DeleteApplication(ctx context.Context, id string) error { return newError(ErrorTypeBadRequest, "stop the application first before deleting", nil) } + // Delete app database env, err := s.envRepo.GetEnv(ctx, domain.GetEnvCondition{ApplicationID: optional.From(id)}) if err != nil { return err @@ -296,6 +323,13 @@ func (s *Service) DeleteApplication(ctx context.Context, id string) error { if err != nil { return err } + // Delete runtime app image in background + go func() { + err := s.deleteApplicationImages(context.WithoutCancel(ctx), app) + if err != nil { + log.Errorf("Deleting application %v (id: %v) image: %+v", app.Name, app.ID, err) + } + }() // delete artifacts artifacts, err := s.artifactRepo.GetArtifacts(ctx, domain.GetArtifactCondition{ApplicationID: optional.From(app.ID)}) diff --git a/pkg/usecase/apiserver/service.go b/pkg/usecase/apiserver/service.go index d9b31ff26..e0bb04e13 100644 --- a/pkg/usecase/apiserver/service.go +++ b/pkg/usecase/apiserver/service.go @@ -2,6 +2,8 @@ package apiserver import ( "context" + "github.com/regclient/regclient" + "github.com/traPtitech/neoshowcase/pkg/domain/builder" "github.com/friendsofgo/errors" "github.com/go-git/go-git/v5/plumbing/transport/ssh" @@ -35,6 +37,8 @@ type Service struct { containerLogger domain.ContainerLogger controller domain.ControllerServiceClient fallbackKey *ssh.PublicKeys + image builder.ImageConfig + registry *regclient.RegClient systemInfo func(ctx context.Context) (*domain.SystemInfo, error) tmpKeys *tmpKeyPairService @@ -53,6 +57,7 @@ func NewService( metricsService domain.MetricsService, containerLogger domain.ContainerLogger, controller domain.ControllerServiceClient, + image builder.ImageConfig, fallbackKey *ssh.PublicKeys, ) (*Service, error) { return &Service{ @@ -69,6 +74,8 @@ func NewService( containerLogger: containerLogger, controller: controller, fallbackKey: fallbackKey, + image: image, + registry: image.NewRegistry(), systemInfo: scutil.Once(controller.GetSystemInfo), tmpKeys: newTmpKeyPairService(), diff --git a/pkg/usecase/cleaner/service.go b/pkg/usecase/cleaner/service.go index ca806a7d6..d417c6bb5 100644 --- a/pkg/usecase/cleaner/service.go +++ b/pkg/usecase/cleaner/service.go @@ -59,7 +59,7 @@ func NewService( c.start = func() { go loop.Loop(ctx, func(ctx context.Context) { start := time.Now() - err := c.pruneImages(ctx, r, image.Registry.Addr) + err := c.pruneImages(ctx, r) if err != nil { log.Errorf("failed to prune images: %+v", err) return @@ -91,14 +91,14 @@ func (c *cleanerService) Shutdown(_ context.Context) error { return nil } -func (c *cleanerService) pruneImages(ctx context.Context, r *regclient.RegClient, regHost string) error { +func (c *cleanerService) pruneImages(ctx context.Context, r *regclient.RegClient) error { applications, err := c.appRepo.GetApplications(ctx, domain.GetApplicationCondition{DeployType: optional.From(domain.DeployTypeRuntime)}) if err != nil { return err } for _, app := range applications { - err = c.pruneImage(ctx, r, regHost, c.image.NamePrefix, app) + err = c.pruneImage(ctx, r, app) if err != nil { log.Errorf("pruning image %v: %+v", c.image.NamePrefix+app.ID, err) // fail-safe for each image @@ -108,9 +108,9 @@ func (c *cleanerService) pruneImages(ctx context.Context, r *regclient.RegClient return nil } -func (c *cleanerService) pruneImage(ctx context.Context, r *regclient.RegClient, regHost string, imagePrefix string, app *domain.Application) error { - imageName := imagePrefix + app.ID - tags, err := regutil.TagList(ctx, r, regHost, imageName) +func (c *cleanerService) pruneImage(ctx context.Context, r *regclient.RegClient, app *domain.Application) error { + imageName := c.image.ImageName(app.ID) + tags, err := regutil.TagList(ctx, r, imageName) if err != nil { return errors.Wrap(err, "getting tags") } @@ -127,7 +127,7 @@ func (c *cleanerService) pruneImage(ctx context.Context, r *regclient.RegClient, // NOTE: needs manual execution of "registry garbage-collect --delete-untagged" in docker registry side // to actually delete the layers // https://docs.docker.com/registry/garbage-collection/ - tagRef, err := ref.New(regHost + "/" + imageName + ":" + tag) + tagRef, err := ref.New(imageName + ":" + tag) if err != nil { return err } diff --git a/pkg/util/regutil/list.go b/pkg/util/regutil/list.go index bcd3ed4cd..19fac5b1e 100644 --- a/pkg/util/regutil/list.go +++ b/pkg/util/regutil/list.go @@ -27,7 +27,7 @@ func RepoList(ctx context.Context, r *regclient.RegClient, regHost string) ([]st } } -func TagList(ctx context.Context, r *regclient.RegClient, regHost string, imageName string) ([]string, error) { +func TagList(ctx context.Context, r *regclient.RegClient, imageName string) ([]string, error) { const limit = 100 var tags []string for { @@ -35,7 +35,7 @@ func TagList(ctx context.Context, r *regclient.RegClient, regHost string, imageN if len(tags) > 0 { opts = append(opts, scheme.WithTagLast(tags[len(tags)-1])) } - repoRef, err := ref.New(regHost + "/" + imageName) + repoRef, err := ref.New(imageName) if err != nil { return nil, err } From a6739ebdfca8d7ebfc833a2ad8d770ef5d2eb3d7 Mon Sep 17 00:00:00 2001 From: motoki317 Date: Fri, 20 Oct 2023 15:03:32 +0900 Subject: [PATCH 22/42] use pr target event to deal with fork pr --- .github/workflows/preview.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index d7f67473f..71929157c 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -1,7 +1,8 @@ name: preview on: - pull_request: + # pull_request_target を使うにあたって https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ の一読を推奨 + pull_request_target: permissions: packages: write @@ -12,9 +13,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Set PR_NUMBER env - run: echo "PR_NUMBER=$(echo $GITHUB_REF | sed -e 's/[^0-9]//g')" >> $GITHUB_ENV + run: echo "PR_NUMBER=${{ github.event.number }}" >> $GITHUB_ENV - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + persist-credentials: false - name: Set up QEMU uses: docker/setup-qemu-action@v3 From 7dec0949476a41cda4c7ba6e5982ae84d36d207c Mon Sep 17 00:00:00 2001 From: motoki317 Date: Fri, 20 Oct 2023 23:17:14 +0900 Subject: [PATCH 23/42] Display shorter failure message to users, keep stacktrace inside builder --- pkg/usecase/builder/build.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkg/usecase/builder/build.go b/pkg/usecase/builder/build.go index eea6e1170..baf792a95 100644 --- a/pkg/usecase/builder/build.go +++ b/pkg/usecase/builder/build.go @@ -213,10 +213,8 @@ func (s *builderService) process(ctx context.Context, st *state) domain.BuildSta return domain.BuildStatusCanceled } if err != nil { - msg := fmt.Sprintf("%+v", err) - log.Error(msg) - st.WriteLog("[ns-builder] Build failed:") - st.WriteLog(msg) + log.Errorf("Build failed for %v: %+v", st.build.ID, err) + st.WriteLog(fmt.Sprintf("[ns-builder] Build failed: %v", err)) return domain.BuildStatusFailed } st.WriteLog(fmt.Sprintf("[ns-builder] ==> (%d/%d) Done (%v).", i+1, len(steps), time.Since(start))) From 4ec4fc1131ddd41ca6a369140cab2961fa72407a Mon Sep 17 00:00:00 2001 From: motoki317 Date: Sat, 21 Oct 2023 20:54:38 +0900 Subject: [PATCH 24/42] Generate regclient instance for each repo access fixes bloating authorization header error --- pkg/domain/builder/registry.go | 6 ++++++ pkg/usecase/apiserver/app_service.go | 5 +++-- pkg/usecase/apiserver/service.go | 5 +---- pkg/usecase/builder/build_static.go | 3 ++- pkg/usecase/builder/service.go | 4 ---- pkg/usecase/cleaner/service.go | 7 +++---- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/pkg/domain/builder/registry.go b/pkg/domain/builder/registry.go index f92f52771..b9d13284a 100644 --- a/pkg/domain/builder/registry.go +++ b/pkg/domain/builder/registry.go @@ -16,6 +16,12 @@ type ImageConfig struct { TmpNamePrefix string `mapstructure:"tmpNamePrefix" yaml:"tmpNamePrefix"` } +// NewRegistry generates a new regclient instance. +// +// NOTE: should generate a new instance for each image repository access, +// because it internally stores JWT scopes for each repository it accesses. +// Accessing large number of repositories with a single regclient instance +// will result in a bloating "Authorization" header. func (c *ImageConfig) NewRegistry() *regclient.RegClient { var opts []regclient.Opt diff --git a/pkg/usecase/apiserver/app_service.go b/pkg/usecase/apiserver/app_service.go index 5bdfba93c..7d338f146 100644 --- a/pkg/usecase/apiserver/app_service.go +++ b/pkg/usecase/apiserver/app_service.go @@ -281,8 +281,9 @@ func (s *Service) deleteApplicationImages(ctx context.Context, app *domain.Appli return nil } + r := s.image.NewRegistry() imageName := s.image.ImageName(app.ID) - tags, err := regutil.TagList(ctx, s.registry, imageName) + tags, err := regutil.TagList(ctx, r, imageName) if err != nil { return err } @@ -291,7 +292,7 @@ func (s *Service) deleteApplicationImages(ctx context.Context, app *domain.Appli if err != nil { return err } - err = s.registry.TagDelete(ctx, tagRef) + err = r.TagDelete(ctx, tagRef) if err != nil { return err } diff --git a/pkg/usecase/apiserver/service.go b/pkg/usecase/apiserver/service.go index e0bb04e13..b3f4320af 100644 --- a/pkg/usecase/apiserver/service.go +++ b/pkg/usecase/apiserver/service.go @@ -2,13 +2,12 @@ package apiserver import ( "context" - "github.com/regclient/regclient" - "github.com/traPtitech/neoshowcase/pkg/domain/builder" "github.com/friendsofgo/errors" "github.com/go-git/go-git/v5/plumbing/transport/ssh" "github.com/traPtitech/neoshowcase/pkg/domain" + "github.com/traPtitech/neoshowcase/pkg/domain/builder" "github.com/traPtitech/neoshowcase/pkg/domain/web" "github.com/traPtitech/neoshowcase/pkg/infrastructure/repository" "github.com/traPtitech/neoshowcase/pkg/util/scutil" @@ -38,7 +37,6 @@ type Service struct { controller domain.ControllerServiceClient fallbackKey *ssh.PublicKeys image builder.ImageConfig - registry *regclient.RegClient systemInfo func(ctx context.Context) (*domain.SystemInfo, error) tmpKeys *tmpKeyPairService @@ -75,7 +73,6 @@ func NewService( controller: controller, fallbackKey: fallbackKey, image: image, - registry: image.NewRegistry(), systemInfo: scutil.Once(controller.GetSystemInfo), tmpKeys: newTmpKeyPairService(), diff --git a/pkg/usecase/builder/build_static.go b/pkg/usecase/builder/build_static.go index e22015e18..012a7904c 100644 --- a/pkg/usecase/builder/build_static.go +++ b/pkg/usecase/builder/build_static.go @@ -49,5 +49,6 @@ func (s *builderService) buildStaticCleanup( if err != nil { return err } - return s.registry.TagDelete(ctx, tagRef) + r := s.config.NewRegistry() + return r.TagDelete(ctx, tagRef) } diff --git a/pkg/usecase/builder/service.go b/pkg/usecase/builder/service.go index 11b1dd20c..9d93ac66f 100644 --- a/pkg/usecase/builder/service.go +++ b/pkg/usecase/builder/service.go @@ -7,7 +7,6 @@ import ( "github.com/go-git/go-git/v5/plumbing/transport/ssh" buildkit "github.com/moby/buildkit/client" - "github.com/regclient/regclient" "github.com/samber/lo" log "github.com/sirupsen/logrus" @@ -31,7 +30,6 @@ type builderService struct { storage domain.Storage pubKey *ssh.PublicKeys config builder.ImageConfig - registry *regclient.RegClient appRepo domain.ApplicationRepository artifactRepo domain.ArtifactRepository @@ -59,7 +57,6 @@ func NewService( envRepo domain.EnvironmentRepository, gitRepo domain.GitRepositoryRepository, ) (Service, error) { - r := config.NewRegistry() return &builderService{ client: client, buildkit: buildkit, @@ -72,7 +69,6 @@ func NewService( buildRepo: buildRepo, envRepo: envRepo, gitRepo: gitRepo, - registry: r, }, nil } diff --git a/pkg/usecase/cleaner/service.go b/pkg/usecase/cleaner/service.go index d417c6bb5..e3d832ca0 100644 --- a/pkg/usecase/cleaner/service.go +++ b/pkg/usecase/cleaner/service.go @@ -53,13 +53,11 @@ func NewService( storage: storage, } - r := image.NewRegistry() - ctx, cancel := context.WithCancel(context.Background()) c.start = func() { go loop.Loop(ctx, func(ctx context.Context) { start := time.Now() - err := c.pruneImages(ctx, r) + err := c.pruneImages(ctx) if err != nil { log.Errorf("failed to prune images: %+v", err) return @@ -91,13 +89,14 @@ func (c *cleanerService) Shutdown(_ context.Context) error { return nil } -func (c *cleanerService) pruneImages(ctx context.Context, r *regclient.RegClient) error { +func (c *cleanerService) pruneImages(ctx context.Context) error { applications, err := c.appRepo.GetApplications(ctx, domain.GetApplicationCondition{DeployType: optional.From(domain.DeployTypeRuntime)}) if err != nil { return err } for _, app := range applications { + r := c.image.NewRegistry() err = c.pruneImage(ctx, r, app) if err != nil { log.Errorf("pruning image %v: %+v", c.image.NamePrefix+app.ID, err) From fb31e1dee28f49b8a5430acaee8d2ba04ee1677e Mon Sep 17 00:00:00 2001 From: motoki317 Date: Sat, 21 Oct 2023 21:06:26 +0900 Subject: [PATCH 25/42] Remove workaround with RepoAuth option which tracks auth per repo --- pkg/domain/builder/registry.go | 9 ++++----- pkg/usecase/cleaner/service.go | 7 ++++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/domain/builder/registry.go b/pkg/domain/builder/registry.go index b9d13284a..81fa6e9f4 100644 --- a/pkg/domain/builder/registry.go +++ b/pkg/domain/builder/registry.go @@ -17,15 +17,14 @@ type ImageConfig struct { } // NewRegistry generates a new regclient instance. -// -// NOTE: should generate a new instance for each image repository access, -// because it internally stores JWT scopes for each repository it accesses. -// Accessing large number of repositories with a single regclient instance -// will result in a bloating "Authorization" header. func (c *ImageConfig) NewRegistry() *regclient.RegClient { var opts []regclient.Opt host := config.HostNewName(c.Registry.Scheme + "://" + c.Registry.Addr) + // RepoAuth should be set to true, because by default regclient internally merges scopes for all repositories + // it accesses, resulting in a bloating "Authorization" header when accessing large number of repositories at once. + // also see: https://distribution.github.io/distribution/spec/auth/jwt/ + host.RepoAuth = true if c.Registry.Username != "" { host.User = c.Registry.Username } diff --git a/pkg/usecase/cleaner/service.go b/pkg/usecase/cleaner/service.go index e3d832ca0..535afc3f2 100644 --- a/pkg/usecase/cleaner/service.go +++ b/pkg/usecase/cleaner/service.go @@ -53,11 +53,13 @@ func NewService( storage: storage, } + r := c.image.NewRegistry() + ctx, cancel := context.WithCancel(context.Background()) c.start = func() { go loop.Loop(ctx, func(ctx context.Context) { start := time.Now() - err := c.pruneImages(ctx) + err := c.pruneImages(ctx, r) if err != nil { log.Errorf("failed to prune images: %+v", err) return @@ -89,14 +91,13 @@ func (c *cleanerService) Shutdown(_ context.Context) error { return nil } -func (c *cleanerService) pruneImages(ctx context.Context) error { +func (c *cleanerService) pruneImages(ctx context.Context, r *regclient.RegClient) error { applications, err := c.appRepo.GetApplications(ctx, domain.GetApplicationCondition{DeployType: optional.From(domain.DeployTypeRuntime)}) if err != nil { return err } for _, app := range applications { - r := c.image.NewRegistry() err = c.pruneImage(ctx, r, app) if err != nil { log.Errorf("pruning image %v: %+v", c.image.NamePrefix+app.ID, err) From 8f9451fee207c3e4749e4ae6ca45802a6b0108ea Mon Sep 17 00:00:00 2001 From: pirosiki197 Date: Sun, 22 Oct 2023 00:48:46 +0900 Subject: [PATCH 26/42] =?UTF-8?q?=E3=83=9B=E3=82=B9=E3=83=88=E5=90=8D?= =?UTF-8?q?=E3=82=92lowercase=E3=81=AB=E6=AD=A3=E8=A6=8F=E5=8C=96=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/domain/app_website.go | 4 ++++ pkg/usecase/apiserver/app_service.go | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/pkg/domain/app_website.go b/pkg/domain/app_website.go index 31bf3bfcb..2fbb4fb82 100644 --- a/pkg/domain/app_website.go +++ b/pkg/domain/app_website.go @@ -151,6 +151,10 @@ func (w *Website) Validate() error { return nil } +func (w *Website) Normalize() { + w.FQDN = strings.ToLower(w.FQDN) +} + func (w *Website) pathComponents() []string { // NOTE: empty PathPrefix must not exist if w.PathPrefix == "/" { diff --git a/pkg/usecase/apiserver/app_service.go b/pkg/usecase/apiserver/app_service.go index 7d338f146..89b5fbee8 100644 --- a/pkg/usecase/apiserver/app_service.go +++ b/pkg/usecase/apiserver/app_service.go @@ -62,6 +62,9 @@ func (s *Service) CreateApplication(ctx context.Context, app *domain.Application } app.OwnerIDs = repo.OwnerIDs + for _, website := range app.Websites { + website.Normalize() + } // Validate err = s.validateApp(ctx, app) if err != nil { @@ -213,6 +216,9 @@ func (s *Service) UpdateApplication(ctx context.Context, id string, args *domain } app.Apply(args) + for _, website := range app.Websites { + website.Normalize() + } // Validate if err = s.validateApp(ctx, app); err != nil { return err From f597a245a4c839b03d1ac32015680fd43d4ac117 Mon Sep 17 00:00:00 2001 From: pirosiki197 Date: Sun, 22 Oct 2023 03:12:29 +0900 Subject: [PATCH 27/42] =?UTF-8?q?ValidateDomain=E3=81=AE=E4=B8=AD=E3=81=A7?= =?UTF-8?q?=E6=A4=9C=E8=A8=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/domain/app_website.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/domain/app_website.go b/pkg/domain/app_website.go index 2fbb4fb82..8314f4b3d 100644 --- a/pkg/domain/app_website.go +++ b/pkg/domain/app_website.go @@ -13,6 +13,10 @@ import ( ) func ValidateDomain(domain string) error { + // ドメインが大文字を含むときはエラー + if domain != strings.ToLower(domain) { + return errors.Errorf("domain %v must be lower case", domain) + } // 面倒なのでtrailing dotは無しで統一 if strings.HasSuffix(domain, ".") { return errors.Errorf("trailing dot not allowed in domain %v", domain) From 22625ff94cbfa6274ea4e13b8363bbde6d172539 Mon Sep 17 00:00:00 2001 From: pirosiki197 Date: Sun, 22 Oct 2023 03:12:38 +0900 Subject: [PATCH 28/42] =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E3=81=AE?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/domain/app_website_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/domain/app_website_test.go b/pkg/domain/app_website_test.go index b85e8e1fb..9bcf82277 100644 --- a/pkg/domain/app_website_test.go +++ b/pkg/domain/app_website_test.go @@ -20,6 +20,7 @@ func TestValidateDomain(t *testing.T) { {"ok 4", "underscore_allowed.example.com", false}, {"invalid characters 1", "admin@example.com", true}, {"invalid characters 2", "space not allowed.example.com", true}, + {"invalid characters 3", "UPPERCASE.example.com", true}, {"wildcard ng", "*.trap.show", true}, {"multi wildcard ng", "*.*.trap.show", true}, {"wildcard in middle", "trap.*.show", true}, @@ -157,6 +158,7 @@ func TestWebsite_Validate(t *testing.T) { {"invalid fqdn3", Website{FQDN: "google.*.com", PathPrefix: "/", HTTPPort: 80}, true}, {"invalid fqdn4", Website{FQDN: "goo gle.com", PathPrefix: "/", HTTPPort: 80}, true}, {"invalid fqdn5", Website{FQDN: "no space", PathPrefix: "/", HTTPPort: 80}, true}, + {"invalid fqdn6", Website{FQDN: "UPPERCASE.example.com", PathPrefix: "/", HTTPPort: 80}, true}, {"invalid path1", Website{FQDN: "google.com", PathPrefix: "", HTTPPort: 80}, true}, {"invalid path2", Website{FQDN: "google.com", PathPrefix: "../test", HTTPPort: 80}, true}, {"invalid path3", Website{FQDN: "google.com", PathPrefix: "/test/", HTTPPort: 80}, true}, From 512bb746d1cf1925fd5291f94d33ba39c6be8022 Mon Sep 17 00:00:00 2001 From: motoki317 Date: Tue, 31 Oct 2023 22:06:44 +0900 Subject: [PATCH 29/42] fix config key --- .../manifest/ns-system/components/builder-deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.local-dev/manifest/ns-system/components/builder-deployment.yaml b/.local-dev/manifest/ns-system/components/builder-deployment.yaml index d6fed3d94..5aec18851 100644 --- a/.local-dev/manifest/ns-system/components/builder-deployment.yaml +++ b/.local-dev/manifest/ns-system/components/builder-deployment.yaml @@ -75,7 +75,7 @@ spec: name: socket - mountPath: /opt/config/ns.yaml name: config - subPath: confnsig.yaml + subPath: ns.yaml - mountPath: /keys name: keys # - mountPath: /.docker From f4a2d2f0c959239ea01bb6180991c89a13a0db9b Mon Sep 17 00:00:00 2001 From: motoki317 Date: Tue, 31 Oct 2023 22:10:38 +0900 Subject: [PATCH 30/42] fix config path --- .../manifest/ns-system/components/gateway-deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.local-dev/manifest/ns-system/components/gateway-deployment.yaml b/.local-dev/manifest/ns-system/components/gateway-deployment.yaml index e1d9b6214..e4c90eef1 100644 --- a/.local-dev/manifest/ns-system/components/gateway-deployment.yaml +++ b/.local-dev/manifest/ns-system/components/gateway-deployment.yaml @@ -20,7 +20,7 @@ spec: imagePullPolicy: Never args: - --loglevel=debug - - --config=/opt/config/ns-gateway.yaml + - --config=/opt/config/ns.yaml ports: - containerPort: 8080 name: http From 07ae85595d88f16df97aeb0bbc78f84d003ac8ef Mon Sep 17 00:00:00 2001 From: motoki317 Date: Tue, 31 Oct 2023 22:27:21 +0900 Subject: [PATCH 31/42] pass explicit retry msg --- pkg/usecase/builder/service.go | 2 +- pkg/usecase/ssgen/generator.go | 2 +- pkg/util/retry/retry.go | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/usecase/builder/service.go b/pkg/usecase/builder/service.go index 9d93ac66f..6a452a2ca 100644 --- a/pkg/usecase/builder/service.go +++ b/pkg/usecase/builder/service.go @@ -97,7 +97,7 @@ func (s *builderService) Start(_ context.Context) error { go retry.Do(ctx, func(ctx context.Context) error { return s.client.ConnectBuilder(ctx, s.onRequest, response) - }) + }, "connect to controller") go loop.Loop(ctx, s.prune, 1*time.Hour, false) return nil diff --git a/pkg/usecase/ssgen/generator.go b/pkg/usecase/ssgen/generator.go index a269bfa8d..225b59c7a 100644 --- a/pkg/usecase/ssgen/generator.go +++ b/pkg/usecase/ssgen/generator.go @@ -69,7 +69,7 @@ func (s *generatorService) Start(_ context.Context) error { go retry.Do(ctx, func(ctx context.Context) error { return s.client.ConnectSSGen(ctx, s.onRequest) - }) + }, "connect to controller") go func() { for i := 0; i < 300; i++ { s.reload() diff --git a/pkg/util/retry/retry.go b/pkg/util/retry/retry.go index f0285032b..40a2bfabe 100644 --- a/pkg/util/retry/retry.go +++ b/pkg/util/retry/retry.go @@ -13,7 +13,7 @@ const ( successThreshold = 60 * time.Second ) -func Do(ctx context.Context, fn func(ctx context.Context) error) { +func Do(ctx context.Context, fn func(ctx context.Context) error, msg string) { backoff := initialBackoff for { start := time.Now() @@ -26,7 +26,11 @@ func Do(ctx context.Context, fn func(ctx context.Context) error) { if time.Since(start) >= successThreshold || err == nil { backoff = initialBackoff } - log.Infof("Lost connection, retrying in %v", backoff) + if err == nil { + log.Infof("Retrier: retrying in %v: %v", backoff, msg) + } else { + log.Errorf("Retrier: retrying in %v: %v: %v", backoff, msg, err) + } select { case <-time.After(backoff): case <-ctx.Done(): From 4fae54c51b7079d43f9cbd36eaa9276a7105d7d5 Mon Sep 17 00:00:00 2001 From: motoki317 Date: Tue, 31 Oct 2023 22:38:50 +0900 Subject: [PATCH 32/42] k8s backend: keep retrying pod watcher, may resolve #756 --- pkg/infrastructure/backend/k8simpl/backend.go | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/pkg/infrastructure/backend/k8simpl/backend.go b/pkg/infrastructure/backend/k8simpl/backend.go index 1244b37a2..8ee6572b0 100644 --- a/pkg/infrastructure/backend/k8simpl/backend.go +++ b/pkg/infrastructure/backend/k8simpl/backend.go @@ -3,6 +3,7 @@ package k8simpl import ( "context" "fmt" + "github.com/traPtitech/neoshowcase/pkg/util/retry" "strings" "sync" @@ -12,7 +13,6 @@ import ( traefikv1alpha1 "github.com/traefik/traefik/v2/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1" apiv1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" @@ -43,9 +43,9 @@ type Backend struct { certManagerClient *certmanagerv1.Clientset config Config - eventSubs domain.PubSub[*domain.ContainerEvent] + eventSubs domain.PubSub[*domain.ContainerEvent] + stopWatcher func() - podWatcher watch.Interface reloadLock sync.Mutex } @@ -71,8 +71,14 @@ func NewK8SBackend( } func (b *Backend) Start(_ context.Context) error { - var err error - b.podWatcher, err = b.client.CoreV1().Pods(b.config.Namespace).Watch(context.Background(), metav1.ListOptions{ + ctx, cancel := context.WithCancel(context.Background()) + b.stopWatcher = cancel + go retry.Do(ctx, b.eventListener, "pod watcher") + return nil +} + +func (b *Backend) eventListener(ctx context.Context) error { + podWatcher, err := b.client.CoreV1().Pods(b.config.Namespace).Watch(ctx, metav1.ListOptions{ LabelSelector: metav1.FormatLabelSelector(&metav1.LabelSelector{MatchLabels: map[string]string{ managedLabel: "true", }}), @@ -80,13 +86,9 @@ func (b *Backend) Start(_ context.Context) error { if err != nil { return errors.Wrap(err, "failed to watch pods") } - go b.eventListener() + defer podWatcher.Stop() - return nil -} - -func (b *Backend) eventListener() { - for ev := range b.podWatcher.ResultChan() { + for ev := range podWatcher.ResultChan() { p, ok := ev.Object.(*apiv1.Pod) if !ok { log.Warnf("unexpected type: %v", ev) @@ -99,10 +101,11 @@ func (b *Backend) eventListener() { } b.eventSubs.Publish(&domain.ContainerEvent{ApplicationID: appID}) } + return nil } func (b *Backend) Dispose(_ context.Context) error { - b.podWatcher.Stop() + b.stopWatcher() return nil } From 92187e2ebcec8f9ed1d9a15f5a760e7e5cd0607e Mon Sep 17 00:00:00 2001 From: motoki317 Date: Tue, 31 Oct 2023 22:41:22 +0900 Subject: [PATCH 33/42] docker backend: rewrite restart mechanism with retry.Do --- .../backend/dockerimpl/backend.go | 26 ++++--------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/pkg/infrastructure/backend/dockerimpl/backend.go b/pkg/infrastructure/backend/dockerimpl/backend.go index 0bb1a65a9..a7f48f8bd 100644 --- a/pkg/infrastructure/backend/dockerimpl/backend.go +++ b/pkg/infrastructure/backend/dockerimpl/backend.go @@ -5,6 +5,7 @@ import ( "encoding/base64" "encoding/json" "fmt" + "github.com/traPtitech/neoshowcase/pkg/util/retry" "sync" "time" @@ -13,8 +14,6 @@ import ( "github.com/docker/docker/api/types/filters" "github.com/docker/docker/client" "github.com/friendsofgo/errors" - log "github.com/sirupsen/logrus" - "github.com/traPtitech/neoshowcase/pkg/domain" "github.com/traPtitech/neoshowcase/pkg/domain/builder" "github.com/traPtitech/neoshowcase/pkg/util/ds" @@ -40,7 +39,7 @@ type Backend struct { image builder.ImageConfig eventSubs domain.PubSub[*domain.ContainerEvent] - eventCancel func() + stopWatcher func() reloadLock sync.Mutex } @@ -78,27 +77,12 @@ func (b *Backend) Start(ctx context.Context) error { } eventCtx, eventCancel := context.WithCancel(context.Background()) - b.eventCancel = eventCancel - go b.eventListenerLoop(eventCtx) + b.stopWatcher = eventCancel + go retry.Do(eventCtx, b.eventListener, "container watcher") return nil } -func (b *Backend) eventListenerLoop(ctx context.Context) { - for { - err := b.eventListener(ctx) - if err == nil { - return - } - log.Errorf("docker event listner errored, retrying in 1s: %+v", err) - select { - case <-time.After(time.Second): - case <-ctx.Done(): - return - } - } -} - func (b *Backend) eventListener(ctx context.Context) error { // https://docs.docker.com/engine/reference/commandline/events/ ch, errCh := b.c.Events(ctx, types.EventsOptions{Filters: filters.NewArgs(filters.Arg("type", "container"))}) @@ -126,7 +110,7 @@ func (b *Backend) eventListener(ctx context.Context) error { } func (b *Backend) Dispose(_ context.Context) error { - b.eventCancel() + b.stopWatcher() return nil } From 18710f51c559b1ca28738df93800eacc42f0db25 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Nov 2023 12:17:13 +0000 Subject: [PATCH 34/42] Bump actions/setup-node from 3 to 4 Bumps [actions/setup-node](https://github.com/actions/setup-node) from 3 to 4. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](https://github.com/actions/setup-node/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/setup-node dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/dashboard-ci.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dashboard-ci.yaml b/.github/workflows/dashboard-ci.yaml index 03e096111..85cc443ac 100644 --- a/.github/workflows/dashboard-ci.yaml +++ b/.github/workflows/dashboard-ci.yaml @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: 18 cache: yarn @@ -32,7 +32,7 @@ jobs: needs: [packages] steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: 18 cache: yarn @@ -45,7 +45,7 @@ jobs: needs: [packages] steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: 18 cache: yarn @@ -58,7 +58,7 @@ jobs: needs: [packages] steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: 18 cache: yarn From e133de037d2353cd35aaf08177488001771edec2 Mon Sep 17 00:00:00 2001 From: motoki317 Date: Wed, 1 Nov 2023 21:49:37 +0900 Subject: [PATCH 35/42] Upgrade moby/buildkit --- go.mod | 11 ++++------- go.sum | 19 ++++++++----------- .../backend/dockerimpl/backend.go | 6 ++++-- .../buildpack/dockerimpl/backend.go | 2 +- 4 files changed, 17 insertions(+), 21 deletions(-) diff --git a/go.mod b/go.mod index 5c6139f45..fdf6ddd50 100644 --- a/go.mod +++ b/go.mod @@ -9,8 +9,8 @@ require ( connectrpc.com/connect v1.11.1 github.com/aws/aws-sdk-go v1.45.19 github.com/cert-manager/cert-manager v1.13.1 - github.com/docker/cli v24.0.6+incompatible - github.com/docker/docker v24.0.0-rc.2.0.20230718135204-8e51b8b59cb8+incompatible // v25 master@8e51b8b59cb8 (2023-07-18), required by github.com/moby/buildkit@v0.12.2 + github.com/docker/cli v24.0.7+incompatible + github.com/docker/docker v24.0.0-rc.2.0.20230905130451-032797ea4bcb+incompatible // v25 master@032797ea4bcb (2023-09-05), required by github.com/moby/buildkit@v0.12.3 github.com/docker/go-connections v0.4.0 github.com/friendsofgo/errors v0.9.2 github.com/gliderlabs/ssh v0.3.5 @@ -22,7 +22,7 @@ require ( github.com/google/wire v0.5.0 github.com/labstack/echo/v4 v4.11.1 github.com/lukesampson/figlet v0.0.0-20190211215653-8a3ef4a6ac42 - github.com/moby/buildkit v0.12.2 + github.com/moby/buildkit v0.12.3 github.com/motoki317/sc v1.6.0 github.com/ncw/swift v1.0.53 github.com/prometheus/client_golang v1.17.0 @@ -65,18 +65,17 @@ require ( github.com/Microsoft/go-winio v0.6.1 // indirect github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect github.com/acomagu/bufpipe v1.0.4 // indirect - github.com/agext/levenshtein v1.2.3 // indirect github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be // indirect github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/cloudflare/circl v1.3.3 // indirect github.com/containerd/console v1.0.3 // indirect github.com/containerd/containerd v1.7.2 // indirect github.com/containerd/continuity v0.4.1 // indirect - github.com/containerd/ttrpc v1.2.2 // indirect github.com/containerd/typeurl/v2 v2.1.1 // indirect github.com/cyphar/filepath-securejoin v0.2.4 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/davidmz/go-pageant v1.0.2 // indirect + github.com/distribution/reference v0.5.0 // indirect github.com/docker/distribution v2.8.2+incompatible // indirect github.com/docker/docker-credential-helpers v0.8.0 // indirect github.com/docker/go-units v0.5.0 // indirect @@ -132,7 +131,6 @@ require ( github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect - github.com/moby/locker v1.0.1 // indirect github.com/moby/patternmatcher v0.6.0 // indirect github.com/moby/spdystream v0.2.0 // indirect github.com/moby/sys/signal v0.7.0 // indirect @@ -150,7 +148,6 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/secure-systems-lab/go-securesystemslib v0.7.0 // indirect github.com/sergi/go-diff v1.3.1 // indirect - github.com/shibumi/go-pathspec v1.3.0 // indirect github.com/shopspring/decimal v1.3.1 // indirect github.com/skeema/knownhosts v1.2.0 // indirect github.com/spf13/afero v1.9.5 // indirect diff --git a/go.sum b/go.sum index 64b7cb6ba..d58e546a2 100644 --- a/go.sum +++ b/go.sum @@ -101,8 +101,6 @@ github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 h1:kkhsdkhsCv github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ= github.com/acomagu/bufpipe v1.0.4/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= -github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= -github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -160,8 +158,6 @@ github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+gqO04wryn5h75LSazbRlnya1k= github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= -github.com/codahale/rfc6979 v0.0.0-20141003034818-6a90f24967eb h1:EDmT6Q9Zs+SbUoc7Ik9EfrFqcylYqgPZ9ANSbTAntnE= -github.com/codahale/rfc6979 v0.0.0-20141003034818-6a90f24967eb/go.mod h1:ZjrT6AXHbDs86ZSdt/osfBi5qfexBrKUdONk989Wnk4= github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= github.com/containerd/console v1.0.3 h1:lIr7SlA5PxZyMV30bDW0MGbiOPXwc63yRuCP0ARubLw= @@ -193,14 +189,16 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davidmz/go-pageant v1.0.2 h1:bPblRCh5jGU+Uptpz6LgMZGD5hJoOt7otgT454WvHn0= github.com/davidmz/go-pageant v1.0.2/go.mod h1:P2EDDnMqIwG5Rrp05dTRITj9z2zpGcD9efWSkTNKLIE= +github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0= +github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= -github.com/docker/cli v24.0.6+incompatible h1:fF+XCQCgJjjQNIMjzaSmiKJSCcfcXb3TWTcc7GAneOY= -github.com/docker/cli v24.0.6+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/cli v24.0.7+incompatible h1:wa/nIwYFW7BVTGa7SWPVyyXU9lgORqUb1xfI36MSkFg= +github.com/docker/cli v24.0.7+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v24.0.0-rc.2.0.20230718135204-8e51b8b59cb8+incompatible h1:qMc+sk+l2GSLokgRA1uuKgkUVQ/vhAm4LYHC5rtSMq0= -github.com/docker/docker v24.0.0-rc.2.0.20230718135204-8e51b8b59cb8+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v24.0.0-rc.2.0.20230905130451-032797ea4bcb+incompatible h1:1UUPAB9PAPUbM10+qIKPL5tKZ+VAddWgbQUf+x1QBfI= +github.com/docker/docker v24.0.0-rc.2.0.20230905130451-032797ea4bcb+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.8.0 h1:YQFtbBQb4VrpoPxhFuzEBPQ9E16qz5SpHLS+uswaCp8= github.com/docker/docker-credential-helpers v0.8.0/go.mod h1:UGFXcuoQ5TxPiB54nHOZ32AWRqQdECoh/Mg0AlEYb40= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= @@ -574,8 +572,8 @@ github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/moby/buildkit v0.12.2 h1:B7guBgY6sfk4dBlv/ORUxyYlp0UojYaYyATgtNwSCXc= -github.com/moby/buildkit v0.12.2/go.mod h1:adB4y0SxxX8trnrY+oEulb48ODLqPO6pKMF0ppGcCoI= +github.com/moby/buildkit v0.12.3 h1:cFaPVnyC0PwAP5xHHfzdU5v9rgQrCi6HnGSg3WuFKp4= +github.com/moby/buildkit v0.12.3/go.mod h1:adB4y0SxxX8trnrY+oEulb48ODLqPO6pKMF0ppGcCoI= github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg= github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk= @@ -708,7 +706,6 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/skeema/knownhosts v1.2.0 h1:h9r9cf0+u7wSE+M183ZtMGgOJKiL96brpaz5ekfJCpM= diff --git a/pkg/infrastructure/backend/dockerimpl/backend.go b/pkg/infrastructure/backend/dockerimpl/backend.go index a7f48f8bd..99f93e4bd 100644 --- a/pkg/infrastructure/backend/dockerimpl/backend.go +++ b/pkg/infrastructure/backend/dockerimpl/backend.go @@ -5,15 +5,17 @@ import ( "encoding/base64" "encoding/json" "fmt" - "github.com/traPtitech/neoshowcase/pkg/util/retry" "sync" "time" + "github.com/traPtitech/neoshowcase/pkg/util/retry" + clitypes "github.com/docker/cli/cli/config/types" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/client" "github.com/friendsofgo/errors" + "github.com/traPtitech/neoshowcase/pkg/domain" "github.com/traPtitech/neoshowcase/pkg/domain/builder" "github.com/traPtitech/neoshowcase/pkg/util/ds" @@ -47,7 +49,7 @@ type Backend struct { func NewClientFromEnv() (*client.Client, error) { return client.NewClientWithOpts( client.FromEnv, - // Using github.com/moby/moby of v25 master@8e51b8b59cb8 (2023-07-18), required by github.com/moby/buildkit@v0.12.2, + // Using github.com/moby/moby of v25 master@032797ea4bcb (2023-09-05), required by github.com/moby/buildkit@v0.12.3, // defaults to API version 1.44, which currently available docker installation does not support. client.WithVersion("1.43"), ) diff --git a/pkg/infrastructure/buildpack/dockerimpl/backend.go b/pkg/infrastructure/buildpack/dockerimpl/backend.go index 79627baea..18187f6ca 100644 --- a/pkg/infrastructure/buildpack/dockerimpl/backend.go +++ b/pkg/infrastructure/buildpack/dockerimpl/backend.go @@ -35,7 +35,7 @@ func NewBuildpackBackend( ) (builder.BuildpackBackend, error) { c, err := client.NewClientWithOpts( client.FromEnv, - // Using github.com/moby/moby of v25 master@8e51b8b59cb8 (2023-07-18), required by github.com/moby/buildkit@v0.12.2, + // Using github.com/moby/moby of v25 master@032797ea4bcb (2023-09-05), required by github.com/moby/buildkit@v0.12.3, // defaults to API version 1.44, which currently available docker installation does not support. client.WithVersion("1.43"), ) From 8c28bf66a11d35c4d1a75283ce085268fef1c78f Mon Sep 17 00:00:00 2001 From: motoki317 Date: Wed, 1 Nov 2023 22:03:34 +0900 Subject: [PATCH 36/42] Upgrade patches --- go.mod | 38 ++++++++++++++--------------- go.sum | 75 +++++++++++++++++++++++++++++----------------------------- 2 files changed, 57 insertions(+), 56 deletions(-) diff --git a/go.mod b/go.mod index fdf6ddd50..927de3b48 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( code.gitea.io/sdk/gitea v0.16.0 connectrpc.com/connect v1.11.1 github.com/aws/aws-sdk-go v1.45.19 - github.com/cert-manager/cert-manager v1.13.1 + github.com/cert-manager/cert-manager v1.13.2 github.com/docker/cli v24.0.7+incompatible github.com/docker/docker v24.0.0-rc.2.0.20230905130451-032797ea4bcb+incompatible // v25 master@032797ea4bcb (2023-09-05), required by github.com/moby/buildkit@v0.12.3 github.com/docker/go-connections v0.4.0 @@ -20,14 +20,14 @@ require ( github.com/golang/mock v1.6.0 github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 github.com/google/wire v0.5.0 - github.com/labstack/echo/v4 v4.11.1 + github.com/labstack/echo/v4 v4.11.2 github.com/lukesampson/figlet v0.0.0-20190211215653-8a3ef4a6ac42 github.com/moby/buildkit v0.12.3 github.com/motoki317/sc v1.6.0 github.com/ncw/swift v1.0.53 github.com/prometheus/client_golang v1.17.0 github.com/prometheus/common v0.44.0 - github.com/regclient/regclient v0.5.2 + github.com/regclient/regclient v0.5.3 github.com/samber/lo v1.38.1 github.com/shiguredo/websocket v1.6.1 github.com/sirupsen/logrus v1.9.3 @@ -36,23 +36,23 @@ require ( github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.16.0 github.com/stretchr/testify v1.8.4 - github.com/traefik/traefik/v2 v2.10.4 + github.com/traefik/traefik/v2 v2.10.5 github.com/volatiletech/null/v8 v8.1.2 github.com/volatiletech/sqlboiler/v4 v4.15.0 github.com/volatiletech/strmangle v0.0.5 github.com/whilp/git-urls v1.0.0 github.com/zeebo/xxh3 v1.0.2 go.mongodb.org/mongo-driver v1.12.1 - golang.org/x/crypto v0.13.0 + golang.org/x/crypto v0.14.0 golang.org/x/exp v0.0.0-20230905200255-921286631fa9 - golang.org/x/net v0.15.0 + golang.org/x/net v0.17.0 golang.org/x/sync v0.3.0 - google.golang.org/grpc v1.58.2 + google.golang.org/grpc v1.58.3 google.golang.org/protobuf v1.31.0 gopkg.in/yaml.v2 v2.4.0 - k8s.io/api v0.28.2 - k8s.io/apimachinery v0.28.2 - k8s.io/client-go v0.28.2 + k8s.io/api v0.28.3 + k8s.io/apimachinery v0.28.3 + k8s.io/client-go v0.28.3 ) require ( @@ -116,7 +116,7 @@ require ( github.com/in-toto/in-toto-golang v0.9.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect - github.com/jmespath/go-jmespath v0.4.0 // indirect + github.com/jmespath/go-jmespath v0.4.1-0.20220621161143-b0104c826a24 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/kevinburke/ssh_config v1.2.0 // indirect @@ -168,18 +168,18 @@ require ( github.com/xdg-go/scram v1.1.2 // indirect github.com/xdg-go/stringprep v1.0.4 // indirect github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.43.0 // indirect - go.opentelemetry.io/otel v1.17.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.17.0 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect - go.opentelemetry.io/otel/sdk v1.17.0 // indirect - go.opentelemetry.io/otel/trace v1.17.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.45.0 // indirect + go.opentelemetry.io/otel v1.19.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect + go.opentelemetry.io/otel/metric v1.19.0 // indirect + go.opentelemetry.io/otel/sdk v1.19.0 // indirect + go.opentelemetry.io/otel/trace v1.19.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/mod v0.12.0 // indirect golang.org/x/oauth2 v0.12.0 // indirect - golang.org/x/sys v0.12.0 // indirect - golang.org/x/term v0.12.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/term v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect golang.org/x/time v0.3.0 // indirect golang.org/x/tools v0.13.0 // indirect diff --git a/go.sum b/go.sum index d58e546a2..1d667df39 100644 --- a/go.sum +++ b/go.sum @@ -131,8 +131,8 @@ github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7N github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cert-manager/cert-manager v1.13.1 h1:hRST6l3G/Y3IDnn3H4zb6unDrZmtTPqaaz3TTGgfXNE= -github.com/cert-manager/cert-manager v1.13.1/go.mod h1:pJe/sqGZ6yX0kYcsAv3e2EQH+xn8Ag8WOLGl/qYWAps= +github.com/cert-manager/cert-manager v1.13.2 h1:LG8+OLvxtc49CSyfjW7zHSyvlt7JVaHgRGyhfdvPpkk= +github.com/cert-manager/cert-manager v1.13.2/go.mod h1:AdfSU8muS+bj3C46YaD1VrlpXh672z5MeW/k1k5Sl1w= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -474,8 +474,9 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= -github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath v0.4.1-0.20220621161143-b0104c826a24 h1:liMMTbpW34dhU4az1GN0pTPADwNmvoRSeoZ6PItiqnY= +github.com/jmespath/go-jmespath v0.4.1-0.20220621161143-b0104c826a24/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= @@ -517,8 +518,8 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/labstack/echo/v4 v4.11.1 h1:dEpLU2FLg4UVmvCGPuk/APjlH6GDpbEPti61srUUUs4= -github.com/labstack/echo/v4 v4.11.1/go.mod h1:YuYRTSM3CHs2ybfrL8Px48bO6BAnYIN4l8wSTMP6BDQ= +github.com/labstack/echo/v4 v4.11.2 h1:T+cTLQxWCDfqDEoydYm5kCobjmHwOwcv4OJAPHilmdE= +github.com/labstack/echo/v4 v4.11.2/go.mod h1:UcGuQ8V6ZNRmSweBIJkPvGfwCMIlFmiqrPqiEBfPYws= github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8= github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= @@ -676,8 +677,8 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI= github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY= -github.com/regclient/regclient v0.5.2 h1:8iLMsMIbI0/5iNwWUOHn463g3NSy9beLSpmFx/VfXAQ= -github.com/regclient/regclient v0.5.2/go.mod h1:2iTgEKbcEEa2tJr3gWs0s1nkRm4V72XbPVDxmF4biX4= +github.com/regclient/regclient v0.5.3 h1:5wooqJUC1XtZxVHWwWlFbSXCXzBUnZG4ExbNmbUsGgo= +github.com/regclient/regclient v0.5.3/go.mod h1:70mhq9v2ITfx80hR8EhkARiOkgN2UxyWEan33KMqOks= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= @@ -761,8 +762,8 @@ github.com/tonistiigi/vt100 v0.0.0-20230623042737-f9a4f7ef6531 h1:Y/M5lygoNPKwVN github.com/tonistiigi/vt100 v0.0.0-20230623042737-f9a4f7ef6531/go.mod h1:ulncasL3N9uLrVann0m+CDlJKWsIAP34MPcOJF6VRvc= github.com/traefik/paerser v0.2.0 h1:zqCLGSXoNlcBd+mzqSCLjon/I6phqIjeJL2xFB2ysgQ= github.com/traefik/paerser v0.2.0/go.mod h1:afzaVcgF8A+MpTnPG4wBr4whjanCSYA6vK5RwaYVtRc= -github.com/traefik/traefik/v2 v2.10.4 h1:0fIQTVHwciZ7lS1FsMFbkwgt2mlz9N3X1nLv6vl15bg= -github.com/traefik/traefik/v2 v2.10.4/go.mod h1:ovx/gjYqjcg81kwW8h8dfQ8xqPs1TmKayOqk2CJ7o1I= +github.com/traefik/traefik/v2 v2.10.5 h1:ZMzyEXOQLgOowKO5j2tDw8dsxJXwW9OXiDm0HUkrxWk= +github.com/traefik/traefik/v2 v2.10.5/go.mod h1:XvDvBoN9Yvh4ipWZX/ttjRGGRX440hJvvTCkSfcRxlo= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= @@ -822,18 +823,18 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.43.0 h1:7XZai4VhA473clBrOqqHdjHBImGfyEtv0qW4nnn/kAo= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.43.0/go.mod h1:1WpsUwjQrUJSNugfMlPn0rPRJ9Do7wwBgTBPK7MLiS4= -go.opentelemetry.io/otel v1.17.0 h1:MW+phZ6WZ5/uk2nd93ANk/6yJ+dVrvNWUjGhnnFU5jM= -go.opentelemetry.io/otel v1.17.0/go.mod h1:I2vmBGtFaODIVMBSTPVDlJSzBDNf93k60E6Ft0nyjo0= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.17.0 h1:U5GYackKpVKlPrd/5gKMlrTlP2dCESAAFU682VCpieY= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.17.0/go.mod h1:aFsJfCEnLzEu9vRRAcUiB/cpRTbVsNdF3OHSPpdjxZQ= -go.opentelemetry.io/otel/metric v1.17.0 h1:iG6LGVz5Gh+IuO0jmgvpTB6YVrCGngi8QGm+pMd8Pdc= -go.opentelemetry.io/otel/metric v1.17.0/go.mod h1:h4skoxdZI17AxwITdmdZjjYJQH5nzijUUjm+wtPph5o= -go.opentelemetry.io/otel/sdk v1.17.0 h1:FLN2X66Ke/k5Sg3V623Q7h7nt3cHXaW1FOvKKrW0IpE= -go.opentelemetry.io/otel/sdk v1.17.0/go.mod h1:U87sE0f5vQB7hwUoW98pW5Rz4ZDuCFBZFNUBlSgmDFQ= -go.opentelemetry.io/otel/trace v1.17.0 h1:/SWhSRHmDPOImIAetP1QAeMnZYiQXrTy4fMMYOdSKWQ= -go.opentelemetry.io/otel/trace v1.17.0/go.mod h1:I/4vKTgFclIsXRVucpH25X0mpFSczM7aHeaz0ZBLWjY= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.45.0 h1:RsQi0qJ2imFfCvZabqzM9cNXBG8k6gXMv1A0cXRmH6A= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.45.0/go.mod h1:vsh3ySueQCiKPxFLvjWC4Z135gIa34TQ/NSqkDTZYUM= +go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs= +go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 h1:Mne5On7VWdx7omSrSSZvM4Kw7cS7NQkOOmLcgscI51U= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0/go.mod h1:IPtUMKL4O3tH5y+iXVyAXqpAwMuzC1IrxVS81rummfE= +go.opentelemetry.io/otel/metric v1.19.0 h1:aTzpGtV0ar9wlV4Sna9sdJyII5jTVJEvKETPiOKwvpE= +go.opentelemetry.io/otel/metric v1.19.0/go.mod h1:L5rUsV9kM1IxCj1MmSdS+JQAcVm319EUrDVLrt7jqt8= +go.opentelemetry.io/otel/sdk v1.19.0 h1:6USY6zH+L8uMH8L3t1enZPR3WFEmSTADlqldyHtJi3o= +go.opentelemetry.io/otel/sdk v1.19.0/go.mod h1:NedEbbS4w3C6zElbLdPJKOpJQOrGUJ+GfzpjUvI0v1A= +go.opentelemetry.io/otel/trace v1.19.0 h1:DFVQmlVbfVeOuBRrwdtaehRrWiL1JoVs9CPIQ1Dzxpg= +go.opentelemetry.io/otel/trace v1.19.0/go.mod h1:mfaSyvGyEJEI0nyV2I4qhNQnbBOUUmYZpYojqMnX2vo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= @@ -867,8 +868,8 @@ golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -964,8 +965,8 @@ golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1097,8 +1098,8 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1106,8 +1107,8 @@ golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU= -golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= +golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= +golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1361,8 +1362,8 @@ google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ5 google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I= -google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= +google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1417,14 +1418,14 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -k8s.io/api v0.28.2 h1:9mpl5mOb6vXZvqbQmankOfPIGiudghwCoLl1EYfUZbw= -k8s.io/api v0.28.2/go.mod h1:RVnJBsjU8tcMq7C3iaRSGMeaKt2TWEUXcpIt/90fjEg= +k8s.io/api v0.28.3 h1:Gj1HtbSdB4P08C8rs9AR94MfSGpRhJgsS+GF9V26xMM= +k8s.io/api v0.28.3/go.mod h1:MRCV/jr1dW87/qJnZ57U5Pak65LGmQVkKTzf3AtKFHc= k8s.io/apiextensions-apiserver v0.28.1 h1:l2ThkBRjrWpw4f24uq0Da2HaEgqJZ7pcgiEUTKSmQZw= k8s.io/apiextensions-apiserver v0.28.1/go.mod h1:sVvrI+P4vxh2YBBcm8n2ThjNyzU4BQGilCQ/JAY5kGs= -k8s.io/apimachinery v0.28.2 h1:KCOJLrc6gu+wV1BYgwik4AF4vXOlVJPdiqn0yAWWwXQ= -k8s.io/apimachinery v0.28.2/go.mod h1:RdzF87y/ngqk9H4z3EL2Rppv5jj95vGS/HaFXrLDApU= -k8s.io/client-go v0.28.2 h1:DNoYI1vGq0slMBN/SWKMZMw0Rq+0EQW6/AK4v9+3VeY= -k8s.io/client-go v0.28.2/go.mod h1:sMkApowspLuc7omj1FOSUxSoqjr+d5Q0Yc0LOFnYFJY= +k8s.io/apimachinery v0.28.3 h1:B1wYx8txOaCQG0HmYF6nbpU8dg6HvA06x5tEffvOe7A= +k8s.io/apimachinery v0.28.3/go.mod h1:uQTKmIqs+rAYaq+DFaoD2X7pcjLOqbQX2AOiO0nIpb8= +k8s.io/client-go v0.28.3 h1:2OqNb72ZuTZPKCl+4gTKvqao0AMOl9f3o2ijbAj3LI4= +k8s.io/client-go v0.28.3/go.mod h1:LTykbBp9gsA7SwqirlCXBWtK0guzfhpoW4qSm7i9dxo= k8s.io/klog/v2 v2.100.1 h1:7WCHKK6K8fNhTqfBhISHQ97KrnJNFZMcQvKp7gP/tmg= k8s.io/klog/v2 v2.100.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/kube-openapi v0.0.0-20230905202853-d090da108d2f h1:eeEUOoGYWhOz7EyXqhlR2zHKNw2mNJ9vzJmub6YN6kk= From 1b4e53f93478e6bbe7d0bc72152b1b65c32e2746 Mon Sep 17 00:00:00 2001 From: motoki317 Date: Wed, 1 Nov 2023 22:12:45 +0900 Subject: [PATCH 37/42] Upgrade golang.org/x/ packages --- go.mod | 10 +++++----- go.sum | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index 927de3b48..80517aab0 100644 --- a/go.mod +++ b/go.mod @@ -44,9 +44,9 @@ require ( github.com/zeebo/xxh3 v1.0.2 go.mongodb.org/mongo-driver v1.12.1 golang.org/x/crypto v0.14.0 - golang.org/x/exp v0.0.0-20230905200255-921286631fa9 + golang.org/x/exp v0.0.0-20231006140011-7918f672742d golang.org/x/net v0.17.0 - golang.org/x/sync v0.3.0 + golang.org/x/sync v0.4.0 google.golang.org/grpc v1.58.3 google.golang.org/protobuf v1.31.0 gopkg.in/yaml.v2 v2.4.0 @@ -176,13 +176,13 @@ require ( go.opentelemetry.io/otel/trace v1.19.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/mod v0.12.0 // indirect - golang.org/x/oauth2 v0.12.0 // indirect + golang.org/x/mod v0.13.0 // indirect + golang.org/x/oauth2 v0.13.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/term v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect golang.org/x/time v0.3.0 // indirect - golang.org/x/tools v0.13.0 // indirect + golang.org/x/tools v0.14.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect diff --git a/go.sum b/go.sum index 1d667df39..7cf9207a1 100644 --- a/go.sum +++ b/go.sum @@ -880,8 +880,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= +golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= +golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -909,8 +909,8 @@ golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= +golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -987,8 +987,8 @@ golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.12.0 h1:smVPGxink+n1ZI5pkQa8y6fZT0RW0MgCO5bFpepy4B4= -golang.org/x/oauth2 v0.12.0/go.mod h1:A74bZ3aGXgCY0qaIC9Ahg6Lglin4AMAco8cIv9baba4= +golang.org/x/oauth2 v0.13.0 h1:jDDenyj+WgFtmV3zYVoi8aE2BwtXFLWOA67ZfNWftiY= +golang.org/x/oauth2 v0.13.0/go.mod h1:/JMhi4ZRXAf4HG9LiNmxvk+45+96RUlVThiH8FzNBn0= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1003,8 +1003,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220513210516-0976fa681c29/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= +golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1189,8 +1189,8 @@ golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= -golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= +golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From 333fa7dba79256b92c074fa1ffd4f4cc00101752 Mon Sep 17 00:00:00 2001 From: motoki317 Date: Wed, 1 Nov 2023 22:27:05 +0900 Subject: [PATCH 38/42] Upgrade grpc / connect --- .github/workflows/ci-protoc.yaml | 2 +- Makefile | 4 +-- dashboard/package.json | 6 ++-- .../neoshowcase/protobuf/gateway_connect.ts | 2 +- .../api/neoshowcase/protobuf/gateway_pb.ts | 2 +- .../src/api/neoshowcase/protobuf/null_pb.ts | 2 +- dashboard/src/components/BuildLog.tsx | 2 +- dashboard/src/components/ContainerLog.tsx | 2 +- dashboard/src/libs/api.ts | 4 +-- dashboard/yarn.lock | 30 +++++++++---------- go.mod | 4 +-- go.sum | 12 ++++---- pkg/infrastructure/grpc/pb/controller.pb.go | 2 +- pkg/infrastructure/grpc/pb/gateway.pb.go | 2 +- pkg/infrastructure/grpc/pb/null.pb.go | 2 +- 15 files changed, 38 insertions(+), 40 deletions(-) diff --git a/.github/workflows/ci-protoc.yaml b/.github/workflows/ci-protoc.yaml index d7be62047..53e08dd3b 100644 --- a/.github/workflows/ci-protoc.yaml +++ b/.github/workflows/ci-protoc.yaml @@ -21,7 +21,7 @@ jobs: go-version-file: ./go.mod - uses: arduino/setup-protoc@v2 with: - version: "24.2" + version: "24.4" - name: Install proto tools run: make init-protoc-tools - name: Generate code diff --git a/Makefile b/Makefile index 3582d5a9c..e461d760a 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PROTOC_VERSION := 24.2 +PROTOC_VERSION := 24.4 TBLS_VERSION := 1.65.3 SPECTRAL_VERSION := 6.4.0 @@ -26,7 +26,7 @@ init-protoc: init-protoc-tools: ## Install other protoc tools go install google.golang.org/protobuf/cmd/protoc-gen-go@latest go install connectrpc.com/connect/cmd/protoc-gen-connect-go@latest - yarn global add @bufbuild/protoc-gen-connect-es @bufbuild/protoc-gen-es + yarn global add @connectrpc/protoc-gen-connect-es @bufbuild/protoc-gen-es .PHONY: init init: init-protoc init-protoc-tools ## Install commands diff --git a/dashboard/package.json b/dashboard/package.json index bbf443c09..591a29bab 100644 --- a/dashboard/package.json +++ b/dashboard/package.json @@ -29,9 +29,9 @@ "vite-plugin-solid-svg": "0.6.1" }, "dependencies": { - "@bufbuild/connect": "0.13.0", - "@bufbuild/connect-web": "0.13.0", - "@bufbuild/protobuf": "1.3.1", + "@bufbuild/protobuf": "1.4.1", + "@connectrpc/connect": "1.1.2", + "@connectrpc/connect-web": "1.1.2", "@solid-primitives/refs": "1.0.5", "@solidjs/router": "0.8.3", "ansi-to-html": "0.7.2", diff --git a/dashboard/src/api/neoshowcase/protobuf/gateway_connect.ts b/dashboard/src/api/neoshowcase/protobuf/gateway_connect.ts index 5dc1cdbf0..6f3a2ed3a 100644 --- a/dashboard/src/api/neoshowcase/protobuf/gateway_connect.ts +++ b/dashboard/src/api/neoshowcase/protobuf/gateway_connect.ts @@ -1,4 +1,4 @@ -// @generated by protoc-gen-connect-es v0.13.0 with parameter "target=ts" +// @generated by protoc-gen-connect-es v1.1.3 with parameter "target=ts" // @generated from file neoshowcase/protobuf/gateway.proto (package neoshowcase.protobuf, syntax proto3) /* eslint-disable */ // @ts-nocheck diff --git a/dashboard/src/api/neoshowcase/protobuf/gateway_pb.ts b/dashboard/src/api/neoshowcase/protobuf/gateway_pb.ts index c0da0a015..3d27b7e5d 100644 --- a/dashboard/src/api/neoshowcase/protobuf/gateway_pb.ts +++ b/dashboard/src/api/neoshowcase/protobuf/gateway_pb.ts @@ -1,4 +1,4 @@ -// @generated by protoc-gen-es v1.3.1 with parameter "target=ts" +// @generated by protoc-gen-es v1.4.1 with parameter "target=ts" // @generated from file neoshowcase/protobuf/gateway.proto (package neoshowcase.protobuf, syntax proto3) /* eslint-disable */ // @ts-nocheck diff --git a/dashboard/src/api/neoshowcase/protobuf/null_pb.ts b/dashboard/src/api/neoshowcase/protobuf/null_pb.ts index 66dda084f..8d3690d9f 100644 --- a/dashboard/src/api/neoshowcase/protobuf/null_pb.ts +++ b/dashboard/src/api/neoshowcase/protobuf/null_pb.ts @@ -1,4 +1,4 @@ -// @generated by protoc-gen-es v1.3.1 with parameter "target=ts" +// @generated by protoc-gen-es v1.4.1 with parameter "target=ts" // @generated from file neoshowcase/protobuf/null.proto (package neoshowcase.protobuf, syntax proto3) /* eslint-disable */ // @ts-nocheck diff --git a/dashboard/src/components/BuildLog.tsx b/dashboard/src/components/BuildLog.tsx index 40cbad6ac..92beb4f83 100644 --- a/dashboard/src/components/BuildLog.tsx +++ b/dashboard/src/components/BuildLog.tsx @@ -3,7 +3,7 @@ import { client } from '/@/libs/api' import { concatBuffers, toUTF8WithAnsi } from '/@/libs/buffers' import { isScrolledToBottom } from '/@/libs/scroll' import { sleep } from '/@/libs/sleep' -import { Code, ConnectError } from '@bufbuild/connect' +import { Code, ConnectError } from '@connectrpc/connect' import { Component, Ref, Show, createEffect, createResource, createSignal, onCleanup } from 'solid-js' export interface BuildLogProps { diff --git a/dashboard/src/components/ContainerLog.tsx b/dashboard/src/components/ContainerLog.tsx index 3cb39451f..f11d28466 100644 --- a/dashboard/src/components/ContainerLog.tsx +++ b/dashboard/src/components/ContainerLog.tsx @@ -5,7 +5,7 @@ import { toWithAnsi } from '/@/libs/buffers' import { isScrolledToBottom } from '/@/libs/scroll' import { addTimestamp, lessTimestamp, minTimestamp } from '/@/libs/timestamp' import { vars } from '/@/theme' -import { Code, ConnectError } from '@bufbuild/connect' +import { Code, ConnectError } from '@connectrpc/connect' import { Timestamp } from '@bufbuild/protobuf' import { styled } from '@macaron-css/solid' import { Component, For, Ref, Show, createEffect, createMemo, createResource, createSignal, onCleanup } from 'solid-js' diff --git a/dashboard/src/libs/api.ts b/dashboard/src/libs/api.ts index 627304e1f..2124ef0fc 100644 --- a/dashboard/src/libs/api.ts +++ b/dashboard/src/libs/api.ts @@ -1,6 +1,6 @@ import { APIService } from '/@/api/neoshowcase/protobuf/gateway_connect' -import { createPromiseClient } from '@bufbuild/connect' -import { createConnectTransport } from '@bufbuild/connect-web' +import { createPromiseClient } from '@connectrpc/connect' +import { createConnectTransport } from '@connectrpc/connect-web' import { createResource } from 'solid-js' import toast from 'solid-toast' diff --git a/dashboard/yarn.lock b/dashboard/yarn.lock index 64c9820df..a875c6a7c 100644 --- a/dashboard/yarn.lock +++ b/dashboard/yarn.lock @@ -582,22 +582,20 @@ resolved "https://registry.yarnpkg.com/@biomejs/cli-win32-x64/-/cli-win32-x64-1.2.2.tgz#583e50d8a1a1cc81381200d3cb2f34669c6afd35" integrity sha512-bfaFJwqJ9ApFga2o88OaROSd3pasYRzRGXHJWAE9VUUKdSNSTYxHOqVrNvV54yYPtL6Kt9xkuZa4HNu9it3TaA== -"@bufbuild/connect-web@0.13.0": - version "0.13.0" - resolved "https://registry.yarnpkg.com/@bufbuild/connect-web/-/connect-web-0.13.0.tgz#87301c92d49d3c3f9acb99729c2f7505d739aa4a" - integrity sha512-Ys9VFDWYktD9yFQSLOlkpsD42LonDNMCysLCfjXFuxlupYuf4f7qg0zkT5bESyTfqk4xtRDSSGR3xygaj/ONIQ== - dependencies: - "@bufbuild/connect" "0.13.0" - -"@bufbuild/connect@0.13.0": - version "0.13.0" - resolved "https://registry.yarnpkg.com/@bufbuild/connect/-/connect-0.13.0.tgz#97a84a2cac747c7a52d4421a3382d8d165f61c99" - integrity sha512-eZSMbVLyUFtXiZNORgCEvv580xKZeYQdMOWj2i/nxOcpXQcrEzTMTA7SZzWv4k4gveWCOSRoWmYDeOhfWXJv0g== - -"@bufbuild/protobuf@1.3.1": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@bufbuild/protobuf/-/protobuf-1.3.1.tgz#c4de66bacbe7ac97fe054e68314aeba6f45177f9" - integrity sha512-BUyJWutgP2S8K/1NphOJokuwDckXS4qI2T1pGZAlkFdZchWae3jm6fCdkcGbLlM1QLOcNFFePd+7Feo4BYGrJQ== +"@bufbuild/protobuf@1.4.1": + version "1.4.1" + resolved "https://registry.yarnpkg.com/@bufbuild/protobuf/-/protobuf-1.4.1.tgz#2a827da66aebe904edca21f7085724154aa7868d" + integrity sha512-4dthhwBGD9nlpY35ic8dMQC5R0dsND2b2xyeVO3qf+hBk8m7Y9dUs+SmMh6rqO2pGLUTKHefGXLDW+z19hBPdQ== + +"@connectrpc/connect-web@1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@connectrpc/connect-web/-/connect-web-1.1.2.tgz#e862a4027406dc772ead3ae179f058c26b1fcf0f" + integrity sha512-6Osvp4d/5Qvf0dsbUmqgzCPFIong9KBm5G24g2gapPW2huAtyVj+KwdG6453EKCirPZ5qZHY0FywLef57op9YQ== + +"@connectrpc/connect@1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@connectrpc/connect/-/connect-1.1.2.tgz#d1b5fa1dcec310a8210c1523c99abdc227643f4b" + integrity sha512-oDuKJFRORtzyH4IhZyNgIQ5DKjlDnbP72AH55Aabpc0fwApyus/h4cmYU1KDvahVbqsvUOpd5qUTyMH8IhMmLA== "@emotion/hash@^0.8.0": version "0.8.0" diff --git a/go.mod b/go.mod index 80517aab0..64dc67b88 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ toolchain go1.21.0 require ( code.gitea.io/sdk/gitea v0.16.0 - connectrpc.com/connect v1.11.1 + connectrpc.com/connect v1.12.0 github.com/aws/aws-sdk-go v1.45.19 github.com/cert-manager/cert-manager v1.13.2 github.com/docker/cli v24.0.7+incompatible @@ -47,7 +47,7 @@ require ( golang.org/x/exp v0.0.0-20231006140011-7918f672742d golang.org/x/net v0.17.0 golang.org/x/sync v0.4.0 - google.golang.org/grpc v1.58.3 + google.golang.org/grpc v1.59.0 google.golang.org/protobuf v1.31.0 gopkg.in/yaml.v2 v2.4.0 k8s.io/api v0.28.3 diff --git a/go.sum b/go.sum index 7cf9207a1..ebe147496 100644 --- a/go.sum +++ b/go.sum @@ -60,8 +60,8 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= code.gitea.io/sdk/gitea v0.16.0 h1:gAfssETO1Hv9QbE+/nhWu7EjoFQYKt6kPoyDytQgw00= code.gitea.io/sdk/gitea v0.16.0/go.mod h1:ndkDk99BnfiUCCYEUhpNzi0lpmApXlwRFqClBlOlEBg= -connectrpc.com/connect v1.11.1 h1:dqRwblixqkVh+OFBOOL1yIf1jS/yP0MSJLijRj29bFg= -connectrpc.com/connect v1.11.1/go.mod h1:3AGaO6RRGMx5IKFfqbe3hvK1NqLosFNP2BxDYTPmNPo= +connectrpc.com/connect v1.12.0 h1:HwKdOY0lGhhoHdsza+hW55aqHEC64pYpObRNoAgn70g= +connectrpc.com/connect v1.12.0/go.mod h1:3AGaO6RRGMx5IKFfqbe3hvK1NqLosFNP2BxDYTPmNPo= dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= @@ -309,8 +309,8 @@ github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2V github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= -github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= +github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= +github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -1362,8 +1362,8 @@ google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ5 google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= -google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= diff --git a/pkg/infrastructure/grpc/pb/controller.pb.go b/pkg/infrastructure/grpc/pb/controller.pb.go index fd50907c7..84cb045f5 100644 --- a/pkg/infrastructure/grpc/pb/controller.pb.go +++ b/pkg/infrastructure/grpc/pb/controller.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.24.2 +// protoc v4.24.4 // source: neoshowcase/protobuf/controller.proto package pb diff --git a/pkg/infrastructure/grpc/pb/gateway.pb.go b/pkg/infrastructure/grpc/pb/gateway.pb.go index b8d7457a9..46ea00745 100644 --- a/pkg/infrastructure/grpc/pb/gateway.pb.go +++ b/pkg/infrastructure/grpc/pb/gateway.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.24.2 +// protoc v4.24.4 // source: neoshowcase/protobuf/gateway.proto package pb diff --git a/pkg/infrastructure/grpc/pb/null.pb.go b/pkg/infrastructure/grpc/pb/null.pb.go index bd9eccaa6..9aada78b3 100644 --- a/pkg/infrastructure/grpc/pb/null.pb.go +++ b/pkg/infrastructure/grpc/pb/null.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.24.2 +// protoc v4.24.4 // source: neoshowcase/protobuf/null.proto package pb From 4b755945245d51a6653e94bdbd061081b3c3e230 Mon Sep 17 00:00:00 2001 From: motoki317 Date: Wed, 1 Nov 2023 22:36:42 +0900 Subject: [PATCH 39/42] upgrade other minor packages --- go.mod | 21 +++++++++++---------- go.sum | 52 ++++++++++++++++++++++++++-------------------------- 2 files changed, 37 insertions(+), 36 deletions(-) diff --git a/go.mod b/go.mod index 64dc67b88..f49e339c7 100644 --- a/go.mod +++ b/go.mod @@ -7,14 +7,14 @@ toolchain go1.21.0 require ( code.gitea.io/sdk/gitea v0.16.0 connectrpc.com/connect v1.12.0 - github.com/aws/aws-sdk-go v1.45.19 + github.com/aws/aws-sdk-go v1.47.0 github.com/cert-manager/cert-manager v1.13.2 github.com/docker/cli v24.0.7+incompatible github.com/docker/docker v24.0.0-rc.2.0.20230905130451-032797ea4bcb+incompatible // v25 master@032797ea4bcb (2023-09-05), required by github.com/moby/buildkit@v0.12.3 github.com/docker/go-connections v0.4.0 github.com/friendsofgo/errors v0.9.2 github.com/gliderlabs/ssh v0.3.5 - github.com/go-git/go-git/v5 v5.9.0 + github.com/go-git/go-git/v5 v5.10.0 github.com/go-playground/webhooks/v6 v6.3.0 github.com/go-sql-driver/mysql v1.7.1 github.com/golang/mock v1.6.0 @@ -26,7 +26,7 @@ require ( github.com/motoki317/sc v1.6.0 github.com/ncw/swift v1.0.53 github.com/prometheus/client_golang v1.17.0 - github.com/prometheus/common v0.44.0 + github.com/prometheus/common v0.45.0 github.com/regclient/regclient v0.5.3 github.com/samber/lo v1.38.1 github.com/shiguredo/websocket v1.6.1 @@ -34,7 +34,7 @@ require ( github.com/sourcegraph/conc v0.3.0 github.com/spf13/cobra v1.7.0 github.com/spf13/pflag v1.0.5 - github.com/spf13/viper v1.16.0 + github.com/spf13/viper v1.17.0 github.com/stretchr/testify v1.8.4 github.com/traefik/traefik/v2 v2.10.5 github.com/volatiletech/null/v8 v8.1.2 @@ -120,7 +120,7 @@ require ( github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/kevinburke/ssh_config v1.2.0 // indirect - github.com/klauspost/compress v1.16.7 // indirect + github.com/klauspost/compress v1.17.0 // indirect github.com/klauspost/cpuid/v2 v2.2.5 // indirect github.com/labstack/gommon v0.4.0 // indirect github.com/magiconair/properties v1.8.7 // indirect @@ -146,13 +146,14 @@ require ( github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/sagikazarmark/locafero v0.3.0 // indirect + github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/secure-systems-lab/go-securesystemslib v0.7.0 // indirect github.com/sergi/go-diff v1.3.1 // indirect github.com/shopspring/decimal v1.3.1 // indirect github.com/skeema/knownhosts v1.2.0 // indirect - github.com/spf13/afero v1.9.5 // indirect + github.com/spf13/afero v1.10.0 // indirect github.com/spf13/cast v1.5.1 // indirect - github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/tonistiigi/fsutil v0.0.0-20230629203738-36ef4d8c0dbb // indirect github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea // indirect @@ -185,9 +186,9 @@ require ( golang.org/x/tools v0.14.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230911183012-2d3300fd4832 // indirect + google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect diff --git a/go.sum b/go.sum index ebe147496..3dc04e789 100644 --- a/go.sum +++ b/go.sum @@ -119,8 +119,8 @@ github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= -github.com/aws/aws-sdk-go v1.45.19 h1:+4yXWhldhCVXWFOQRF99ZTJ92t4DtoHROZIbN7Ujk/U= -github.com/aws/aws-sdk-go v1.45.19/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go v1.47.0 h1:/JUg9V1+xh+qBn8A6ec/l15ETPaMaBqxkjz+gg63dNk= +github.com/aws/aws-sdk-go v1.47.0/go.mod h1:DlEaEbWKZmsITVbqlSVvekPARM1HzeV9PMYg15ymSDA= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= @@ -251,10 +251,10 @@ github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66D github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow= -github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20230305113008-0c11038e723f h1:Pz0DHeFij3XFhoBRGUDPzSJ+w2UcK5/0JvF8DRI58r8= -github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20230305113008-0c11038e723f/go.mod h1:8LHG1a3SRW71ettAD/jW13h8c6AqjVSeL11RAdgaqpo= -github.com/go-git/go-git/v5 v5.9.0 h1:cD9SFA7sHVRdJ7AYck1ZaAa/yeuBvGPxwXDL8cxrObY= -github.com/go-git/go-git/v5 v5.9.0/go.mod h1:RKIqga24sWdMGZF+1Ekv9kylsDz6LzdTSI2s/OsZWE0= +github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4= +github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII= +github.com/go-git/go-git/v5 v5.10.0 h1:F0x3xXrAWmhwtzoCokU4IMPcBdncG+HAAqi9FcOOjbQ= +github.com/go-git/go-git/v5 v5.10.0/go.mod h1:1FOZ/pQnqw24ghP2n7cunVl0ON55BsjPYvhWHvZGhoo= 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= @@ -474,7 +474,6 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= -github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath v0.4.1-0.20220621161143-b0104c826a24 h1:liMMTbpW34dhU4az1GN0pTPADwNmvoRSeoZ6PItiqnY= github.com/jmespath/go-jmespath v0.4.1-0.20220621161143-b0104c826a24/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= @@ -499,8 +498,8 @@ github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I= -github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM= +github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -553,7 +552,8 @@ github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D github.com/mattn/go-sqlite3 v1.14.14/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= github.com/microsoft/go-mssqldb v0.17.0/go.mod h1:OkoNGhGEs8EZqchVTtochlXruEhEOaO4S0d2sB5aeGQ= github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= @@ -668,8 +668,8 @@ github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= -github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= +github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM= +github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= @@ -688,6 +688,10 @@ github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUz github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sagikazarmark/crypt v0.6.0/go.mod h1:U8+INwJo3nBv1m6A/8OBXAq7Jnpspk5AxSgDyEQcea8= +github.com/sagikazarmark/locafero v0.3.0 h1:zT7VEGWC2DTflmccN/5T1etyKvxSxpHsjb9cJvm4SvQ= +github.com/sagikazarmark/locafero v0.3.0/go.mod h1:w+v7UsPNFwzF1cHuOajOOzoq4U7v/ig1mpRjqV+Bu1U= +github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= +github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/samber/lo v1.38.1 h1:j2XEAqXKb09Am4ebOg31SpvzUTTs6EN3VfgeLUhPdXM= github.com/samber/lo v1.38.1/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= @@ -718,8 +722,8 @@ github.com/spdx/tools-golang v0.5.1 h1:fJg3SVOGG+eIva9ZUBm/hvyA7PIPVFjRxUKe6fdAg github.com/spdx/tools-golang v0.5.1/go.mod h1:/DRDQuBfB37HctM29YtrX1v+bXiVmT2OpQDalRmX9aU= github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= -github.com/spf13/afero v1.9.5 h1:stMpOSZFs//0Lv29HduCmli3GUfpFoF3Y1Q/aXj/wVM= -github.com/spf13/afero v1.9.5/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= +github.com/spf13/afero v1.10.0 h1:EaGW2JJh15aKOejeuJ+wpFSHnbd7GE6Wvp3TsNhb6LY= +github.com/spf13/afero v1.10.0/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= @@ -727,13 +731,12 @@ github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM= github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= -github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.12.0/go.mod h1:b6COn30jlNxbm/V2IqWiNWkJ+vZNiMNksliPCiuKtSI= -github.com/spf13/viper v1.16.0 h1:rGGH0XDZhdUOryiDWjmIvUSWpbNqisK8Wk0Vyefw8hc= -github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1FofRzQg= +github.com/spf13/viper v1.17.0 h1:I5txKw7MJasPL/BrfkbA0Jyo/oELqVmux4pR/UxOMfI= +github.com/spf13/viper v1.17.0/go.mod h1:BmMMMLQXSbcHK6KAOiFLz0l5JHrU89OdIRHvsk0+yVI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= @@ -961,7 +964,6 @@ golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= @@ -1093,7 +1095,6 @@ golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1103,7 +1104,6 @@ golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= @@ -1326,12 +1326,12 @@ google.golang.org/genproto v0.0.0-20220421151946-72621c1f0bd3/go.mod h1:8w6bsBMX google.golang.org/genproto v0.0.0-20220429170224-98d788798c3e/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= -google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= -google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230911183012-2d3300fd4832 h1:o4LtQxebKIJ4vkzyhtD2rfUNZ20Zf0ik5YVP5E7G7VE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230911183012-2d3300fd4832/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= +google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb h1:XFBgcDwm7irdHTbz4Zk2h7Mh+eis4nfJEFQFYzJzuIA= +google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= +google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb h1:lK0oleSc7IQsUxO3U5TjL9DWlsxpEBemh+zpB7IqhWI= +google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 h1:N3bU/SQDCDyD6R528GJ/PwW9KjYcJA3dgyH+MovAkIM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:KSqppvjFjtoCI+KGd4PELB0qLNxdJHRGqRI09mB6pQA= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= From 8a2a4d1a83113adb8e55851d8f08898da6dd00a5 Mon Sep 17 00:00:00 2001 From: motoki317 Date: Wed, 1 Nov 2023 22:40:23 +0900 Subject: [PATCH 40/42] Update tbls --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e461d760a..e9f94f0a6 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ PROTOC_VERSION := 24.4 -TBLS_VERSION := 1.65.3 +TBLS_VERSION := 1.70.2 SPECTRAL_VERSION := 6.4.0 GO_REPO_ROOT_PACKAGE := "github.com/traPtitech/neoshowcase" From 2139f312d06f7100ccfbb21c07ee6851e2d7b2f8 Mon Sep 17 00:00:00 2001 From: motoki317 Date: Wed, 1 Nov 2023 22:40:36 +0900 Subject: [PATCH 41/42] Remove unused spectral version --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index e9f94f0a6..8d6e5a6dd 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,5 @@ PROTOC_VERSION := 24.4 TBLS_VERSION := 1.70.2 -SPECTRAL_VERSION := 6.4.0 GO_REPO_ROOT_PACKAGE := "github.com/traPtitech/neoshowcase" PROTOC_OPTS := -I ./api/proto --go_out=. --go_opt=module=$(GO_REPO_ROOT_PACKAGE) --connect-go_out=. --connect-go_opt=module=$(GO_REPO_ROOT_PACKAGE) From b3aa2336f03a266b305f4deee9f84d294cc1b704 Mon Sep 17 00:00:00 2001 From: motoki317 Date: Wed, 1 Nov 2023 22:57:04 +0900 Subject: [PATCH 42/42] fmt --- dashboard/src/components/ContainerLog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dashboard/src/components/ContainerLog.tsx b/dashboard/src/components/ContainerLog.tsx index f11d28466..d6968eb14 100644 --- a/dashboard/src/components/ContainerLog.tsx +++ b/dashboard/src/components/ContainerLog.tsx @@ -5,8 +5,8 @@ import { toWithAnsi } from '/@/libs/buffers' import { isScrolledToBottom } from '/@/libs/scroll' import { addTimestamp, lessTimestamp, minTimestamp } from '/@/libs/timestamp' import { vars } from '/@/theme' -import { Code, ConnectError } from '@connectrpc/connect' import { Timestamp } from '@bufbuild/protobuf' +import { Code, ConnectError } from '@connectrpc/connect' import { styled } from '@macaron-css/solid' import { Component, For, Ref, Show, createEffect, createMemo, createResource, createSignal, onCleanup } from 'solid-js'