From f7ec91331639c4f9293bf71616bfde8fbaeee369 Mon Sep 17 00:00:00 2001 From: Alexander Lais Date: Fri, 23 Jun 2023 14:49:24 +0200 Subject: [PATCH 01/16] Add dependabot to pcap-release (#32) * feat(ci): add dependabot bumps for dependencies * fix(ci): Remove dependabot entry for acceptance tests They will be added with #29 --- .github/dependabot.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..438dcf6c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,16 @@ +version: 2 +updates: +- package-ecosystem: pip + directory: /ci/scripts + schedule: + interval: weekly + day: "monday" + time: "09:00" + timezone: "Europe/Berlin" +- package-ecosystem: gomod + directory: /src/pcap + schedule: + interval: weekly + day: "monday" + time: "09:00" + timezone: "Europe/Berlin" From 6c4b4156f05d90cae2f6687bbaadaa1d0c9d49d6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 23 Jun 2023 12:50:19 +0000 Subject: [PATCH 02/16] build(deps): bump github.com/onsi/ginkgo/v2 in /src/pcap Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.9.2 to 2.11.0. - [Release notes](https://github.com/onsi/ginkgo/releases) - [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md) - [Commits](https://github.com/onsi/ginkgo/compare/v2.9.2...v2.11.0) --- updated-dependencies: - dependency-name: github.com/onsi/ginkgo/v2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/pcap/go.mod | 14 +++++++------- src/pcap/go.sum | 29 +++++++++++++++-------------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/pcap/go.mod b/src/pcap/go.mod index e7834824..d0f7f40c 100644 --- a/src/pcap/go.mod +++ b/src/pcap/go.mod @@ -10,8 +10,8 @@ require ( github.com/google/uuid v1.1.2 github.com/gopacket/gopacket v1.1.0 github.com/jessevdk/go-flags v1.5.0 - github.com/onsi/ginkgo/v2 v2.9.2 - github.com/onsi/gomega v1.27.4 + github.com/onsi/ginkgo/v2 v2.11.0 + github.com/onsi/gomega v1.27.8 go.uber.org/zap v1.24.0 google.golang.org/grpc v1.51.0 google.golang.org/protobuf v1.28.1 @@ -20,7 +20,7 @@ require ( require ( github.com/fsnotify/fsnotify v1.5.4 // indirect - github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/logr v1.2.4 // indirect github.com/go-playground/locales v0.14.0 // indirect github.com/go-playground/universal-translator v0.18.0 // indirect github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect @@ -33,9 +33,9 @@ require ( go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 // indirect - golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.6.0 // indirect - golang.org/x/text v0.8.0 // indirect - golang.org/x/tools v0.7.0 // indirect + golang.org/x/net v0.10.0 // indirect + golang.org/x/sys v0.9.0 // indirect + golang.org/x/text v0.9.0 // indirect + golang.org/x/tools v0.9.3 // indirect google.golang.org/genproto v0.0.0-20221206210731-b1a01be3a5f6 // indirect ) diff --git a/src/pcap/go.sum b/src/pcap/go.sum index 8f47a2dd..b697eb5a 100644 --- a/src/pcap/go.sum +++ b/src/pcap/go.sum @@ -12,8 +12,8 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= @@ -72,13 +72,13 @@ github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108 github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/ginkgo/v2 v2.9.2 h1:BA2GMJOtfGAfagzYtrAlufIP0lq6QERkFmHLMLPwFSU= -github.com/onsi/ginkgo/v2 v2.9.2/go.mod h1:WHcJJG2dIlcCqVfBAwUCrJxSPFb6v4azBwgxeMeDuts= +github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU= +github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= -github.com/onsi/gomega v1.27.4 h1:Z2AnStgsdSayCMDiCU42qIz+HLqEPcgiOCXjAU/w+8E= -github.com/onsi/gomega v1.27.4/go.mod h1:riYq/GJKh8hhoM01HN6Vmuy93AarCXCBGpvFDK3q3fQ= +github.com/onsi/gomega v1.27.8 h1:gegWiwZjBsf2DgiSbf5hpokZ98JVDMcWkUiigk6/KXc= +github.com/onsi/gomega v1.27.8/go.mod h1:2J8vzI/s+2shY9XHRApDkdgPo1TKT7P2u6fXeJKFnNQ= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -110,6 +110,7 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 h1:0es+/5331RGQPcXlMfP+WrnIIS6dNnNRe0WB02W0F4M= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -117,8 +118,8 @@ golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -138,20 +139,20 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4= -golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= +golang.org/x/tools v0.9.3 h1:Gn1I8+64MsuTb/HpH+LmQtNas23LhUVr3rYZ0eKuaMM= +golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= 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 fce9b1d136bda63fee06eb405916933c38e98fe8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 24 Jun 2023 14:47:33 +0000 Subject: [PATCH 03/16] build(deps): bump github.com/google/uuid in /src/pcap Bumps [github.com/google/uuid](https://github.com/google/uuid) from 1.1.2 to 1.3.0. - [Release notes](https://github.com/google/uuid/releases) - [Commits](https://github.com/google/uuid/compare/v1.1.2...v1.3.0) --- updated-dependencies: - dependency-name: github.com/google/uuid dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/pcap/go.mod | 2 +- src/pcap/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pcap/go.mod b/src/pcap/go.mod index d0f7f40c..16987116 100644 --- a/src/pcap/go.mod +++ b/src/pcap/go.mod @@ -7,7 +7,7 @@ require ( github.com/go-playground/validator/v10 v10.11.1 github.com/golang-jwt/jwt/v4 v4.5.0 github.com/google/go-cmp v0.5.9 - github.com/google/uuid v1.1.2 + github.com/google/uuid v1.3.0 github.com/gopacket/gopacket v1.1.0 github.com/jessevdk/go-flags v1.5.0 github.com/onsi/ginkgo/v2 v2.11.0 diff --git a/src/pcap/go.sum b/src/pcap/go.sum index b697eb5a..ba2b8e6e 100644 --- a/src/pcap/go.sum +++ b/src/pcap/go.sum @@ -46,8 +46,8 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gopacket/gopacket v1.1.0 h1:zKPCsVPcVt1B2AJyzSM44iaFVuFFSIyu0imExpPmyAk= github.com/gopacket/gopacket v1.1.0/go.mod h1:HavMeONEl7W9036of9LbSWoonqhH7HA1+ZRO+rMIvFs= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= From 1afc2320f5e9c38e9ac86cf78d9d24f682dd530f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Jun 2023 06:23:42 +0000 Subject: [PATCH 04/16] build(deps): bump github.com/go-playground/validator/v10 in /src/pcap Bumps [github.com/go-playground/validator/v10](https://github.com/go-playground/validator) from 10.11.1 to 10.14.1. - [Release notes](https://github.com/go-playground/validator/releases) - [Commits](https://github.com/go-playground/validator/compare/v10.11.1...v10.14.1) --- updated-dependencies: - dependency-name: github.com/go-playground/validator/v10 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/pcap/go.mod | 12 +++++------ src/pcap/go.sum | 57 +++++++++++++++++-------------------------------- 2 files changed, 26 insertions(+), 43 deletions(-) diff --git a/src/pcap/go.mod b/src/pcap/go.mod index 16987116..70fd6e70 100644 --- a/src/pcap/go.mod +++ b/src/pcap/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( code.cloudfoundry.org/bytefmt v0.0.0-20211005130812-5bb3c17173e5 - github.com/go-playground/validator/v10 v10.11.1 + github.com/go-playground/validator/v10 v10.14.1 github.com/golang-jwt/jwt/v4 v4.5.0 github.com/google/go-cmp v0.5.9 github.com/google/uuid v1.3.0 @@ -20,19 +20,19 @@ require ( require ( github.com/fsnotify/fsnotify v1.5.4 // indirect + github.com/gabriel-vasile/mimetype v1.4.2 // indirect github.com/go-logr/logr v1.2.4 // indirect - github.com/go-playground/locales v0.14.0 // indirect - github.com/go-playground/universal-translator v0.18.0 // indirect + github.com/go-playground/locales v0.14.1 // indirect + github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect - github.com/leodido/go-urn v1.2.1 // indirect + github.com/leodido/go-urn v1.2.4 // indirect github.com/onsi/ginkgo v1.16.5 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/rogpeppe/go-internal v1.9.0 // indirect go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect - golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 // indirect + golang.org/x/crypto v0.7.0 // indirect golang.org/x/net v0.10.0 // indirect golang.org/x/sys v0.9.0 // indirect golang.org/x/text v0.9.0 // indirect diff --git a/src/pcap/go.sum b/src/pcap/go.sum index ba2b8e6e..3566d82d 100644 --- a/src/pcap/go.sum +++ b/src/pcap/go.sum @@ -4,7 +4,6 @@ github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLj github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -12,16 +11,17 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= +github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= +github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= -github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= -github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= -github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= -github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= -github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= -github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= -github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= +github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= +github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= +github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= +github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= +github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= +github.com/go-playground/validator/v10 v10.14.1 h1:9c50NUPC30zyuKprjL3vNZ0m5oG+jU0zvx4AqHGnv4k= +github.com/go-playground/validator/v10 v10.14.1/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= @@ -54,16 +54,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc= github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= -github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -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/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= -github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= +github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= +github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= @@ -79,21 +71,20 @@ github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1y github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/onsi/gomega v1.27.8 h1:gegWiwZjBsf2DgiSbf5hpokZ98JVDMcWkUiigk6/KXc= github.com/onsi/gomega v1.27.8/go.mod h1:2J8vzI/s+2shY9XHRApDkdgPo1TKT7P2u6fXeJKFnNQ= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/vishvananda/netlink v1.1.0 h1:1iyaYNBLmP6L0220aDnYQpo1QEV4t4hJ+xEEhhJH8j0= github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74 h1:gga7acRE695APm9hlsSMoOoE65U4/TcqNj90mc69Rlg= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -107,8 +98,8 @@ go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 h1:0es+/5331RGQPcXlMfP+WrnIIS6dNnNRe0WB02W0F4M= -golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -117,7 +108,6 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -136,8 +126,6 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -145,7 +133,6 @@ golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9sn golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -171,11 +158,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= @@ -184,6 +168,5 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From f1665798e13f39f86f5762add0e3d55c31906735 Mon Sep 17 00:00:00 2001 From: Tamara Boehm <34028368+b1tamara@users.noreply.github.com> Date: Mon, 26 Jun 2023 12:29:07 +0200 Subject: [PATCH 05/16] feat: autobump for libpcap (#38) * feat: autobump libpcap Implement autobump script and enhance concourse pipeline to run the check for the new updates daily --- ci/Dockerfile | 8 +- ci/pipeline.yml | 42 ++++ ci/scripts/autobump-dependencies.py | 351 ++++++++++++++++++++++++++++ ci/scripts/requirements.txt | 7 + packages/pcap-agent/packaging | 2 +- packages/pcap-agent/spec | 2 +- packages/pcap-api/packaging | 2 +- packages/pcap-api/spec | 2 +- 8 files changed, 409 insertions(+), 7 deletions(-) create mode 100644 ci/scripts/autobump-dependencies.py create mode 100644 ci/scripts/requirements.txt diff --git a/ci/Dockerfile b/ci/Dockerfile index 8e0b2d80..e8bf0c95 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -3,7 +3,7 @@ FROM bosh/integration:main ARG GINKGO_VERSION=latest ARG GOLANGCILINT_VERSION=latest -RUN apt-get update && apt-get install -y libpcap-dev && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y libpcap-dev python3-pip && rm -rf /var/lib/apt/lists/* RUN curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash - && \ apt-get install -y nodejs && rm -rf /var/lib/apt/lists/* @@ -11,8 +11,10 @@ RUN curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash - && \ RUN npm install -g semantic-release && \ npm install -g @semantic-release/exec -RUN rm -rf /usr/local/go -COPY --from=golang:1.20 /usr/local/go/ /usr/local/go/ +# Install Python libraries needed for scripts +COPY scripts/requirements.txt /requirements.txt +RUN /usr/bin/python3 -m pip install -r /requirements.txt + ENV GOPATH=/go PATH=${PATH}:/go/bin RUN go install "github.com/onsi/ginkgo/v2/ginkgo@${GINKGO_VERSION}" \ diff --git a/ci/pipeline.yml b/ci/pipeline.yml index 2f345b39..764e9868 100644 --- a/ci/pipeline.yml +++ b/ci/pipeline.yml @@ -6,6 +6,7 @@ groups: - unit-tests-pr - shipit - rc + - autobump-dependencies jobs: - name: unit-tests @@ -206,6 +207,39 @@ jobs: GITHUB_TOKEN: ((github.access_token)) GCP_SERVICE_KEY: ((gcp.service_key)) + - name: autobump-dependencies + public: true + serial: true + plan: + - do: + - get: daily + trigger: true + - get: git + - task: autobump-dependencies + config: + inputs: + - name: git + platform: linux + image_resource: + type: docker-image + source: + repository: cf-routing.common.repositories.cloud.sap/pcap-release-testflight + tag: latest + username: ((docker.username)) + password: ((docker.password)) + run: + dir: git + path: /usr/bin/python3 + args: [ "ci/scripts/autobump-dependencies.py" ] + params: + REPO_ROOT: git + PR_BASE: main + PR_ORG: cloudfoundry + PR_LABEL: run-ci + + GCP_SERVICE_KEY: ((gcp.service_key)) + GITHUB_COM_TOKEN: ((github.access_token)) + resource_types: - name: slack-notification type: docker-image @@ -250,3 +284,11 @@ resources: bucket: pcap-release json_key: ((gcp.service_key)) regexp: pcap-v[0-9a-z\.+-]+.tgz + + - name: daily + type: time + source: + start: 7:00 AM + stop: 8:00 AM + location: Europe/Berlin + interval: 24h diff --git a/ci/scripts/autobump-dependencies.py b/ci/scripts/autobump-dependencies.py new file mode 100644 index 00000000..f6f3393d --- /dev/null +++ b/ci/scripts/autobump-dependencies.py @@ -0,0 +1,351 @@ +#!/usr/bin/env python3 +import functools +import os +import re +import shutil +from dataclasses import dataclass +import subprocess +import sys +import textwrap +from typing import List, Optional, Tuple +import yaml + + +import github # PyGithub +import requests +from packaging import version +from bs4 import BeautifulSoup +from git import Repo + + +# Required Environment Vars +BLOBSTORE_SECRET_ACCESS_KEY = os.environ["GCP_SERVICE_KEY"] +gh = github.Github(login_or_token=os.environ["GITHUB_COM_TOKEN"]) +PR_ORG = os.environ["PR_ORG"] +PR_BASE = os.environ["PR_BASE"] +PR_LABEL = os.environ["PR_LABEL"] +# if DRY_RUN is set, blobs will not be uploaded and no PR created (downloads and local changes are still performed) +DRY_RUN = "DRY_RUN" in os.environ + +# Other Global Variables +BLOBS_PATH = "config/blobs.yml" +PACKAGING_PATH = "packages/{}/packaging" + + +class BoshHelper: + """ + Helper class to interface with the bosh-cli. + """ + + @classmethod + def add_blob(cls, path, blobs_path): + cls._run_bosh_cmd("add-blob", path, blobs_path) + + @classmethod + def remove_blob(cls, path): + cls._run_bosh_cmd("remove-blob", path) + + @classmethod + def upload_blobs(cls): + cls._run_bosh_cmd("upload-blobs") + + @classmethod + def _run_bosh_cmd(cls, cmd, *args): + cmd_params = ["bosh", cmd, *args] + print(f"Running '{' '.join(cmd_params)}' ...") + + # run as subprocess and handle errors + process = subprocess.Popen(cmd_params, stderr=subprocess.PIPE, stdout=subprocess.PIPE) + stdout, stderr = process.communicate() + if stdout: + print(stdout.decode("utf-8"), file=sys.stdout) # we don't expect any stdout under normal behaviour, might be useful for debugging though + if stderr: + print(stderr.decode("utf-8"), file=sys.stdout) + if process.returncode != 0: + raise Exception(f"Command {' '.join(cmd_params)} failed. Aborting.") + + +@dataclass +class Release: + """ + A specific release (i.e. version) of a dependency. + Currently, only the latest release of each dependency is fetched. + """ + + name: str + url: str + file: str + version: version.Version + + def download(self) -> None: + print(f"[{self.name}] download '{self.url}' to '{self.file}'") + wget(self.url, self.file) + + def add_blob(self, package): + target_path = f"{package}/{self.file}" + BoshHelper.add_blob(self.file, target_path) + +@dataclass(repr=False) +class Dependency: + """ + The base class that defines the interface of a dependency. + fetch_latest_release needs to be implemented by subclasses. + """ + + name: str + version_var_name: str + pinned_version: str + root_url: str + package: str + remote_repo = gh.get_repo(f"{PR_ORG}/pcap-release") + + _latest_release: Optional[Release] = None + _current_version: version.Version = None + + @property + def pr_branch(self): + return f"{self.name}-auto-bump-{PR_BASE}" + + @property + def current_version(self) -> version.Version: + """ + Fetches the current version of the release from the packaging file if not already known. + (Should always be identical to the version in blobs.yml) + """ + if self._current_version: + return self._current_version + with open(PACKAGING_PATH.format(self.package), "r") as packaging_file: + for line in packaging_file.readlines(): + if line.startswith(self.version_var_name): + # Regex: expecting e.g. "RELEASE_VERSION=1.2.3 # http://release.org/download". extracting Semver Group + rgx = rf"{self.version_var_name}=((?:[0-9]+\.){{1,3}}[0-9]+)\s+#.*$" + match = re.match(rgx, line) + if match: + current_version_str = match.groups()[0] + self._current_version = version.parse(current_version_str) + return self._current_version + raise Exception(f"Could not find current version of {self.name}") + + @property + def latest_release(self) -> Release: + if not self._latest_release: + self._latest_release = self.fetch_latest_release() + return self._latest_release + + # fetch_latest_release is implemented by subclasses + def fetch_latest_release(self) -> Release: + """ + Dependency release tarballs/downloads are available from various locations (Github or custom websites), + so fetching the latest release (incl. tarball download URL) has to be handled individually for every dependency. + Therefore, fetch_latest_release is implemented by subclasses. + """ + raise NotImplementedError + + def remove_current_blob(self): + current_blob_path = f"{self.package}/{self.name}-{self.current_version}.tar.gz" + if self._check_blob_exists(current_blob_path): + BoshHelper.remove_blob(current_blob_path) + else: + print(f"Current Blob not found: {current_blob_path}") + + def _check_blob_exists(self, blob_path) -> bool: + """ + Checks config/blobs.yml if blob exists + """ + with open(BLOBS_PATH, "r") as blobs_file: + yml = yaml.safe_load(blobs_file) + return blob_path in yml.keys() + + def update_packaging_file(self): + """ + Writes the new dependency version and download-url into packages/haproxy/packaging + """ + with open(PACKAGING_PATH.format(self.package), "r") as packaging_file: + replacement = "" + for line in packaging_file.readlines(): + if line.startswith(self.version_var_name): + line = f"{self.version_var_name}={self.latest_release.version} # {self.latest_release.url}\n" + replacement += line + + with open(PACKAGING_PATH.format(self.package), "w") as packaging_file_write: + packaging_file_write.write(replacement) + + def open_pr_exists(self) -> bool: + prs_exist = False + + for pr in self.remote_repo.get_pulls( + state="open", base=PR_BASE, head=f"{PR_ORG}:{self.pr_branch}" + ): # theoretically there shold never be more than one open PR, print them anyways + print(f"Open {self.pr_branch} PR exists: {pr.html_url}") + prs_exist = True + return prs_exist + + def create_pr(self): + print(f"[{self.name}] Creating bump branch {PR_ORG}:{self.pr_branch} and PR...") + pr_body = textwrap.dedent( + f""" + Automatic bump from version {self.current_version} to version {self.latest_release.version}, downloaded from {self.latest_release.url}. + + After merge, consider releasing a new version of haproxy-boshrelease. + """ + ) + if not DRY_RUN: + self._create_branch(self.remote_repo, self.pr_branch) + + self._update_file( + self.remote_repo, + PACKAGING_PATH.format(self.package), + self.pr_branch, + f"Bump {self.name} version to {self.latest_release.version}", + ) + self._update_file( + self.remote_repo, + BLOBS_PATH, + self.pr_branch, + f"Update blob reference for {self.name} to version {self.latest_release.version}", + ) + + pr = self.remote_repo.create_pull( + title=f"Bump {self.name} version to {self.latest_release.version}", + body=pr_body, + base=PR_BASE, + head=f"{PR_ORG}:{self.pr_branch}", + ) + pr.add_to_labels(PR_LABEL) + print(f"[{self.name}] Created Pull Request: {pr.html_url}") + + + def _create_branch(self, repo, branch): + """ + Creates the branch with the given name. + If it exists, deletes the existing branch and creates a new one. + """ + try: + ref = repo.get_git_ref(f"heads/{branch}") + ref.delete() + except github.UnknownObjectException: + print(f"Branch {branch} didn't exist. We'll create it.") + finally: + base_branch = repo.get_git_ref(f"heads/{PR_BASE}") + repo.create_git_ref(f"refs/heads/{branch}", base_branch.object.sha) + + def _update_file(self, repo, path, branch, message): + with open(path, "rb") as f: + content = f.read() + github_file = repo.get_contents(path, ref=branch) + repo.update_file(path=path, message=message, content=content, sha=github_file.sha, branch=branch) + +@dataclass +class WebLinkDependency(Dependency): + + selector: str = "a" + pattern: str = "({name}-({pinned_version}" + r"(?:\.[0-9])+))\.tar\.gz" + + def fetch_latest_release(self) -> Release: + data = requests.get(self.root_url) + html = BeautifulSoup(data.text, "html.parser") + + versions = [] + links = [link for link in html.select(self.selector) if "href" in link.attrs] + + for link in links: + match = re.search( + self.pattern.format(name=self.name, pinned_version=self.pinned_version), + link.attrs["href"], + ) + if match: + versions.append( + Release( + match.group(1), # full name without extension + requests.compat.urljoin(self.root_url, link.attrs["href"]), # absolute URL based on relative link href + match.group(0), # full file name with extension + version.parse(match.group(2)), # version + ) + ) + + if versions: + # sort found versions with highest first, return first entry, i.e. highest applicable version number. + return sorted(versions, key=lambda r: r.version, reverse=True)[0] + + raise Exception(f"Failed to get latest {self.name} version from {self.root_url}") + +def wget(url: str, path: str, auth: Optional[Tuple[str, str]] = None): + """ + downloads a file, optionally decoding any compression applied on HTTP level + """ + with requests.get(url, stream=True, allow_redirects=True, auth=auth) as resp: + if resp.status_code != 200: + raise Exception(f"request failed {resp.status_code}") + # see https://github.com/psf/requests/issues/2155#issuecomment-50771010 + resp.raw.read = functools.partial(resp.raw.read, decode_content=True) + with open(path, "wb") as file: + shutil.copyfileobj(resp.raw, file) + +def write_private_yaml(): + """ + Writes private.yml to config subdirectory (used for blobstore/s3 authentication) + """ + private_yml = { + "blobstore": { + "options": { + "credentials_source": "static", + "json_key": BLOBSTORE_SECRET_ACCESS_KEY, + } + } + } + with open("config/private.yml", "w") as file: + yaml.dump(private_yml, file, default_flow_style=False) + + +def cleanup_local_changes(): + local_git = Repo(os.curdir).git + local_git.reset("--hard") + local_git.clean("-fx") + +def main() -> None: + dependencies: List[Dependency] = [ + WebLinkDependency( + "libpcap", + "LIBPCAP_VERSION", + "1.10", + "https://www.tcpdump.org/release/", + package="pcap-api", + ), + WebLinkDependency( + "libpcap", + "LIBPCAP_VERSION", + "1.10", + "https://www.tcpdump.org/release/", + package="pcap-agent", + ), + ] + + write_private_yaml() + + for dependency in dependencies: + current_version = dependency.current_version + latest_release = dependency.latest_release + latest_version = latest_release.version + + if latest_version <= current_version: + print(f"[{dependency.name}] already on the latest version: {latest_version} " f"(pinned: {dependency.pinned_version}.*)") + continue + + if dependency.open_pr_exists(): + print(f"[{dependency.name}] Open bump PR exists (for branch: {dependency.pr_branch})") + continue + print(f"[{dependency.name}] Version-Bump required: {current_version} --> {latest_version}") + latest_release.download() + dependency.remove_current_blob() + latest_release.add_blob(dependency.package) + dependency.update_packaging_file() + if not DRY_RUN: + BoshHelper.upload_blobs() + dependency.create_pr() + + # clear the working directory for the next dependency bump. + cleanup_local_changes() + + +if __name__ == "__main__": + main() diff --git a/ci/scripts/requirements.txt b/ci/scripts/requirements.txt new file mode 100644 index 00000000..6356c9b8 --- /dev/null +++ b/ci/scripts/requirements.txt @@ -0,0 +1,7 @@ +beautifulsoup4==4.12.2 +gitpython==3.1.31 +packaging==23.1 +pyyaml==6.0 +requests==2.31.0 +PyGithub==1.59.0 +ruamel.yaml==0.17.32 diff --git a/packages/pcap-agent/packaging b/packages/pcap-agent/packaging index f4bf8c99..63d4b8b2 100644 --- a/packages/pcap-agent/packaging +++ b/packages/pcap-agent/packaging @@ -18,7 +18,7 @@ export GOPATH=$BOSH_COMPILE_TARGET/gopath export GOCACHE=$BOSH_COMPILE_TARGET/gocache echo "Build libpcap" -LIBPCAP_VERSION="1.10.1" +LIBPCAP_VERSION=1.10.1 # https://www.tcpdump.org/release/ mkdir "${BOSH_COMPILE_TARGET}/libpcap" tar xzf libpcap-${LIBPCAP_VERSION}.tgz --strip-components 1 -C "${BOSH_COMPILE_TARGET}/libpcap" diff --git a/packages/pcap-agent/spec b/packages/pcap-agent/spec index 778991e1..e0439db6 100644 --- a/packages/pcap-agent/spec +++ b/packages/pcap-agent/spec @@ -6,4 +6,4 @@ dependencies: [] files: - golang/go1.20.3.linux-amd64.tar.gz - pcap/**/* -- libpcap-1.10.1.tgz +- libpcap-*.tgz diff --git a/packages/pcap-api/packaging b/packages/pcap-api/packaging index 0f6c0acd..8d23314c 100644 --- a/packages/pcap-api/packaging +++ b/packages/pcap-api/packaging @@ -19,7 +19,7 @@ export GOPATH=$BOSH_COMPILE_TARGET/gopath export GOCACHE=$BOSH_COMPILE_TARGET/gocache echo "Build libpcap" -LIBPCAP_VERSION="1.10.1" +LIBPCAP_VERSION=1.10.1 # https://www.tcpdump.org/release/ mkdir "${BOSH_COMPILE_TARGET}/libpcap" tar xzf libpcap-${LIBPCAP_VERSION}.tgz --strip-components 1 -C "${BOSH_COMPILE_TARGET}/libpcap" diff --git a/packages/pcap-api/spec b/packages/pcap-api/spec index aaf09d2f..adfd9d27 100644 --- a/packages/pcap-api/spec +++ b/packages/pcap-api/spec @@ -6,4 +6,4 @@ dependencies: [] files: - golang/go1.20.3.linux-amd64.tar.gz - pcap/**/* -- libpcap-1.10.1.tgz +- libpcap-*.tgz From 20e8e9312d2cd7414861541f6aaa99b025490c0e Mon Sep 17 00:00:00 2001 From: Tamara Boehm <34028368+b1tamara@users.noreply.github.com> Date: Tue, 27 Jun 2023 08:10:01 +0200 Subject: [PATCH 06/16] fix: autobump script creates a PR according to conventional commits (#44) --- ci/scripts/autobump-dependencies.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ci/scripts/autobump-dependencies.py b/ci/scripts/autobump-dependencies.py index f6f3393d..0b5e9f2e 100644 --- a/ci/scripts/autobump-dependencies.py +++ b/ci/scripts/autobump-dependencies.py @@ -104,7 +104,7 @@ class Dependency: @property def pr_branch(self): - return f"{self.name}-auto-bump-{PR_BASE}" + return f"{self.package}-{self.name}-auto-bump-{PR_BASE}" @property def current_version(self) -> version.Version: @@ -158,7 +158,7 @@ def _check_blob_exists(self, blob_path) -> bool: def update_packaging_file(self): """ - Writes the new dependency version and download-url into packages/haproxy/packaging + Writes the new dependency version and download-url into packages//packaging """ with open(PACKAGING_PATH.format(self.package), "r") as packaging_file: replacement = "" @@ -186,7 +186,7 @@ def create_pr(self): f""" Automatic bump from version {self.current_version} to version {self.latest_release.version}, downloaded from {self.latest_release.url}. - After merge, consider releasing a new version of haproxy-boshrelease. + After merge, consider releasing a new version of pcap-release. """ ) if not DRY_RUN: @@ -196,7 +196,7 @@ def create_pr(self): self.remote_repo, PACKAGING_PATH.format(self.package), self.pr_branch, - f"Bump {self.name} version to {self.latest_release.version}", + f"dep: Bump {self.name} version to {self.latest_release.version}", ) self._update_file( self.remote_repo, @@ -206,7 +206,7 @@ def create_pr(self): ) pr = self.remote_repo.create_pull( - title=f"Bump {self.name} version to {self.latest_release.version}", + title=f"dep: Bump {self.name} version to {self.latest_release.version}", body=pr_body, base=PR_BASE, head=f"{PR_ORG}:{self.pr_branch}", From 296af9f4b98b35160ed23a804d807d2f506dd6d8 Mon Sep 17 00:00:00 2001 From: Tamara Boehm <34028368+b1tamara@users.noreply.github.com> Date: Tue, 27 Jun 2023 09:52:08 +0200 Subject: [PATCH 07/16] fix: Remove package name from new blob (#47) --- ci/scripts/autobump-dependencies.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ci/scripts/autobump-dependencies.py b/ci/scripts/autobump-dependencies.py index 0b5e9f2e..516c0109 100644 --- a/ci/scripts/autobump-dependencies.py +++ b/ci/scripts/autobump-dependencies.py @@ -81,8 +81,8 @@ def download(self) -> None: print(f"[{self.name}] download '{self.url}' to '{self.file}'") wget(self.url, self.file) - def add_blob(self, package): - target_path = f"{package}/{self.file}" + def add_blob(self): + target_path = f"{self.file}" BoshHelper.add_blob(self.file, target_path) @dataclass(repr=False) @@ -320,8 +320,6 @@ def main() -> None: ), ] - write_private_yaml() - for dependency in dependencies: current_version = dependency.current_version latest_release = dependency.latest_release @@ -337,9 +335,10 @@ def main() -> None: print(f"[{dependency.name}] Version-Bump required: {current_version} --> {latest_version}") latest_release.download() dependency.remove_current_blob() - latest_release.add_blob(dependency.package) + latest_release.add_blob() dependency.update_packaging_file() if not DRY_RUN: + write_private_yaml() BoshHelper.upload_blobs() dependency.create_pr() From c4ac4ab79e12e463320e4c364f8b2cba4bd42e71 Mon Sep 17 00:00:00 2001 From: Alexander Lais Date: Tue, 27 Jun 2023 07:02:18 +0200 Subject: [PATCH 08/16] ci(dependabot): support our convention for commit messages Uses the `ci` prefix for CI scripts and `dep` for actual dependency updates that are shipped and lead to a new release. --- .github/dependabot.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 438dcf6c..ef5319e0 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,6 +7,10 @@ updates: day: "monday" time: "09:00" timezone: "Europe/Berlin" + commit-message: + prefix: "ci" + labels: + - run-ci - package-ecosystem: gomod directory: /src/pcap schedule: @@ -14,3 +18,7 @@ updates: day: "monday" time: "09:00" timezone: "Europe/Berlin" + commit-message: + prefix: "dep" + labels: + - run-ci From bff037e4cc4315bd9206edd60880a2e94361960a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 27 Jun 2023 09:09:04 +0000 Subject: [PATCH 09/16] dep: bump google.golang.org/protobuf from 1.28.1 to 1.31.0 in /src/pcap Bumps google.golang.org/protobuf from 1.28.1 to 1.31.0. --- updated-dependencies: - dependency-name: google.golang.org/protobuf dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/pcap/go.mod | 2 +- src/pcap/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pcap/go.mod b/src/pcap/go.mod index 70fd6e70..6dc5134a 100644 --- a/src/pcap/go.mod +++ b/src/pcap/go.mod @@ -14,7 +14,7 @@ require ( github.com/onsi/gomega v1.27.8 go.uber.org/zap v1.24.0 google.golang.org/grpc v1.51.0 - google.golang.org/protobuf v1.28.1 + google.golang.org/protobuf v1.31.0 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/src/pcap/go.sum b/src/pcap/go.sum index 3566d82d..ac780371 100644 --- a/src/pcap/go.sum +++ b/src/pcap/go.sum @@ -156,8 +156,8 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= From 5bb214c0af4a3fba84f70d8963f8009ec2c67322 Mon Sep 17 00:00:00 2001 From: Tamara Boehm <34028368+b1tamara@users.noreply.github.com> Date: Wed, 28 Jun 2023 08:02:48 +0200 Subject: [PATCH 10/16] fix: Create only one PR for one dependency update (#51) --- ci/scripts/autobump-dependencies.py | 120 +++++++++++++++------------- 1 file changed, 64 insertions(+), 56 deletions(-) diff --git a/ci/scripts/autobump-dependencies.py b/ci/scripts/autobump-dependencies.py index 516c0109..25fa5d75 100644 --- a/ci/scripts/autobump-dependencies.py +++ b/ci/scripts/autobump-dependencies.py @@ -10,7 +10,6 @@ from typing import List, Optional, Tuple import yaml - import github # PyGithub import requests from packaging import version @@ -78,6 +77,10 @@ class Release: version: version.Version def download(self) -> None: + if os.path.isfile(self.file): + print(f"[{self.name}] already exists") + return + print(f"[{self.name}] download '{self.url}' to '{self.file}'") wget(self.url, self.file) @@ -96,15 +99,16 @@ class Dependency: version_var_name: str pinned_version: str root_url: str - package: str + packages: List[str] remote_repo = gh.get_repo(f"{PR_ORG}/pcap-release") _latest_release: Optional[Release] = None _current_version: version.Version = None + _current_package: str = None @property def pr_branch(self): - return f"{self.package}-{self.name}-auto-bump-{PR_BASE}" + return f"{self.name}-auto-bump-{PR_BASE}" @property def current_version(self) -> version.Version: @@ -112,9 +116,7 @@ def current_version(self) -> version.Version: Fetches the current version of the release from the packaging file if not already known. (Should always be identical to the version in blobs.yml) """ - if self._current_version: - return self._current_version - with open(PACKAGING_PATH.format(self.package), "r") as packaging_file: + with open(PACKAGING_PATH.format(self._current_package), "r") as packaging_file: for line in packaging_file.readlines(): if line.startswith(self.version_var_name): # Regex: expecting e.g. "RELEASE_VERSION=1.2.3 # http://release.org/download". extracting Semver Group @@ -132,6 +134,10 @@ def latest_release(self) -> Release: self._latest_release = self.fetch_latest_release() return self._latest_release + def check_current_version(self, package) -> version.Version: + self._current_package = package + return self.current_version + # fetch_latest_release is implemented by subclasses def fetch_latest_release(self) -> Release: """ @@ -141,8 +147,9 @@ def fetch_latest_release(self) -> Release: """ raise NotImplementedError - def remove_current_blob(self): - current_blob_path = f"{self.package}/{self.name}-{self.current_version}.tar.gz" + def remove_current_blob(self, package): + blob_current_version = self.check_current_version(package) + current_blob_path = f"{self.name}-{blob_current_version}.tar.gz" if self._check_blob_exists(current_blob_path): BoshHelper.remove_blob(current_blob_path) else: @@ -156,18 +163,18 @@ def _check_blob_exists(self, blob_path) -> bool: yml = yaml.safe_load(blobs_file) return blob_path in yml.keys() - def update_packaging_file(self): + def update_packaging_file(self, package): """ Writes the new dependency version and download-url into packages//packaging """ - with open(PACKAGING_PATH.format(self.package), "r") as packaging_file: + with open(PACKAGING_PATH.format(package), "r") as packaging_file: replacement = "" for line in packaging_file.readlines(): if line.startswith(self.version_var_name): line = f"{self.version_var_name}={self.latest_release.version} # {self.latest_release.url}\n" replacement += line - with open(PACKAGING_PATH.format(self.package), "w") as packaging_file_write: + with open(PACKAGING_PATH.format(package), "w") as packaging_file_write: packaging_file_write.write(replacement) def open_pr_exists(self) -> bool: @@ -184,35 +191,39 @@ def create_pr(self): print(f"[{self.name}] Creating bump branch {PR_ORG}:{self.pr_branch} and PR...") pr_body = textwrap.dedent( f""" - Automatic bump from version {self.current_version} to version {self.latest_release.version}, downloaded from {self.latest_release.url}. + Automatic bump to version {self.latest_release.version}, downloaded from {self.latest_release.url}. After merge, consider releasing a new version of pcap-release. """ ) - if not DRY_RUN: - self._create_branch(self.remote_repo, self.pr_branch) + if DRY_RUN: + return + self._create_branch(self.remote_repo, self.pr_branch) + + for package in self.packages: self._update_file( self.remote_repo, - PACKAGING_PATH.format(self.package), + PACKAGING_PATH.format(package), self.pr_branch, f"dep: Bump {self.name} version to {self.latest_release.version}", ) - self._update_file( - self.remote_repo, - BLOBS_PATH, - self.pr_branch, - f"Update blob reference for {self.name} to version {self.latest_release.version}", - ) - pr = self.remote_repo.create_pull( - title=f"dep: Bump {self.name} version to {self.latest_release.version}", - body=pr_body, - base=PR_BASE, - head=f"{PR_ORG}:{self.pr_branch}", - ) - pr.add_to_labels(PR_LABEL) - print(f"[{self.name}] Created Pull Request: {pr.html_url}") + self._update_file( + self.remote_repo, + BLOBS_PATH, + self.pr_branch, + f"dep: Update blob reference for {self.name} to version {self.latest_release.version}", + ) + + pr = self.remote_repo.create_pull( + title=f"dep: Bump {self.name} version to {self.latest_release.version}", + body=pr_body, + base=PR_BASE, + head=f"{PR_ORG}:{self.pr_branch}", + ) + pr.add_to_labels(PR_LABEL) + print(f"[{self.name}] Created Pull Request: {pr.html_url}") def _create_branch(self, repo, branch): @@ -309,37 +320,34 @@ def main() -> None: "LIBPCAP_VERSION", "1.10", "https://www.tcpdump.org/release/", - package="pcap-api", - ), - WebLinkDependency( - "libpcap", - "LIBPCAP_VERSION", - "1.10", - "https://www.tcpdump.org/release/", - package="pcap-agent", + packages=["pcap-api", "pcap-agent"], ), ] for dependency in dependencies: - current_version = dependency.current_version - latest_release = dependency.latest_release - latest_version = latest_release.version - - if latest_version <= current_version: - print(f"[{dependency.name}] already on the latest version: {latest_version} " f"(pinned: {dependency.pinned_version}.*)") - continue - - if dependency.open_pr_exists(): - print(f"[{dependency.name}] Open bump PR exists (for branch: {dependency.pr_branch})") - continue - print(f"[{dependency.name}] Version-Bump required: {current_version} --> {latest_version}") - latest_release.download() - dependency.remove_current_blob() - latest_release.add_blob() - dependency.update_packaging_file() - if not DRY_RUN: - write_private_yaml() - BoshHelper.upload_blobs() + for package in dependency.packages: + current_version = dependency.check_current_version(package) + latest_release = dependency.latest_release + latest_version = latest_release.version + + if latest_version <= current_version: + print(f"[{dependency.name}] in {package} already on the latest version: {latest_version} " f"(pinned: {dependency.pinned_version}.*)") + continue + + if dependency.open_pr_exists(): + print(f"[{dependency.name}] Open bump PR exists (for branch: {dependency.pr_branch})") + continue + print(f"[{dependency.name}] Version-Bump required for package {package}: {current_version} --> {latest_version}") + latest_release.download() + # update blobs in specific package + dependency.remove_current_blob(package) + latest_release.add_blob() + dependency.update_packaging_file(package) + if not DRY_RUN: + write_private_yaml() + BoshHelper.upload_blobs() + + # create only one PR per dependency dependency.create_pr() # clear the working directory for the next dependency bump. From 3a002399341153fe851865b2b73feedc7062de73 Mon Sep 17 00:00:00 2001 From: Alexander Lais Date: Mon, 26 Jun 2023 12:10:24 +0200 Subject: [PATCH 11/16] dep(go): add golang-1-release with go 1.20.4 This is deliberately outdated so the autobumper can be tested. --- .final_builds/packages/golang-1-linux/index.yml | 6 ++++++ config/blobs.yml | 4 ---- jobs/pcap-agent/templates/ctl.erb | 2 ++ jobs/pcap-api/templates/ctl.erb | 2 ++ packages/golang-1-linux/spec.lock | 2 ++ packages/golang-1-linux/version | 1 + packages/pcap-agent/packaging | 4 ++-- packages/pcap-agent/spec | 4 ++-- packages/pcap-api/packaging | 9 ++++----- packages/pcap-api/spec | 4 ++-- 10 files changed, 23 insertions(+), 15 deletions(-) create mode 100644 .final_builds/packages/golang-1-linux/index.yml create mode 100644 packages/golang-1-linux/spec.lock create mode 100644 packages/golang-1-linux/version diff --git a/.final_builds/packages/golang-1-linux/index.yml b/.final_builds/packages/golang-1-linux/index.yml new file mode 100644 index 00000000..6c7d65bd --- /dev/null +++ b/.final_builds/packages/golang-1-linux/index.yml @@ -0,0 +1,6 @@ +builds: + 126fca7399cba5bc8c1b02e392441f1688daf1586d57d1b3614e314b893a6cc4: + version: 126fca7399cba5bc8c1b02e392441f1688daf1586d57d1b3614e314b893a6cc4 + blobstore_id: 3be90446-c0f6-4aed-5b1b-da96e7d1814b + sha1: sha256:70c3918c28cd74a0a9be561b5eac8b85e8e7de4a72bc66cd321288974937e0be +format-version: "2" diff --git a/config/blobs.yml b/config/blobs.yml index 300e5b7b..aab980f7 100644 --- a/config/blobs.yml +++ b/config/blobs.yml @@ -1,7 +1,3 @@ -golang/go1.20.3.linux-amd64.tar.gz: - size: 100142274 - object_id: 174649c4-e2e3-4628-6a2c-662beef751af - sha: sha256:979694c2c25c735755bf26f4f45e19e64e4811d661dd07b8c010f7a8e18adfca libpcap-1.10.1.tgz: size: 935221 object_id: 71073646-0c7a-4aba-5c05-19f5330adb7a diff --git a/jobs/pcap-agent/templates/ctl.erb b/jobs/pcap-agent/templates/ctl.erb index 77bd764f..8b24ee31 100644 --- a/jobs/pcap-agent/templates/ctl.erb +++ b/jobs/pcap-agent/templates/ctl.erb @@ -5,6 +5,8 @@ LOG_DIR=/var/vcap/sys/log/pcap-agent PACKAGE_DIR=/var/vcap/packages/pcap-agent PIDFILE=${RUN_DIR}/pid +source /var/vcap/packages/golang-1-linux/bosh/runtime.env + case $1 in start) diff --git a/jobs/pcap-api/templates/ctl.erb b/jobs/pcap-api/templates/ctl.erb index 77816302..7a154ca7 100644 --- a/jobs/pcap-api/templates/ctl.erb +++ b/jobs/pcap-api/templates/ctl.erb @@ -5,6 +5,8 @@ LOG_DIR=/var/vcap/sys/log/pcap-api PACKAGE_DIR=/var/vcap/packages/pcap-api PIDFILE=${RUN_DIR}/pid +source /var/vcap/packages/golang-1-linux/bosh/runtime.env + case $1 in start) diff --git a/packages/golang-1-linux/spec.lock b/packages/golang-1-linux/spec.lock new file mode 100644 index 00000000..f02637fd --- /dev/null +++ b/packages/golang-1-linux/spec.lock @@ -0,0 +1,2 @@ +name: golang-1-linux +fingerprint: 126fca7399cba5bc8c1b02e392441f1688daf1586d57d1b3614e314b893a6cc4 diff --git a/packages/golang-1-linux/version b/packages/golang-1-linux/version new file mode 100644 index 00000000..1b9335f1 --- /dev/null +++ b/packages/golang-1-linux/version @@ -0,0 +1 @@ +1.20.4 \ No newline at end of file diff --git a/packages/pcap-agent/packaging b/packages/pcap-agent/packaging index 63d4b8b2..cdb5c0e4 100644 --- a/packages/pcap-agent/packaging +++ b/packages/pcap-agent/packaging @@ -8,8 +8,8 @@ set -e # $BOSH_COMPILE_TARGET - where this package & spec'd source files are available # $BOSH_INSTALL_TARGET - where you copy/install files to be included in package -tar xzf golang/go1.20.3.linux-amd64.tar.gz -export GOROOT="${BOSH_COMPILE_TARGET}/go" +source /var/vcap/packages/golang-1-linux/bosh/compile.env + export PATH="${PATH}:${GOROOT}/bin" mkdir $BOSH_COMPILE_TARGET/gopath diff --git a/packages/pcap-agent/spec b/packages/pcap-agent/spec index e0439db6..ccf3bcd8 100644 --- a/packages/pcap-agent/spec +++ b/packages/pcap-agent/spec @@ -1,9 +1,9 @@ --- name: pcap-agent -dependencies: [] +dependencies: +- golang-1-linux files: -- golang/go1.20.3.linux-amd64.tar.gz - pcap/**/* - libpcap-*.tgz diff --git a/packages/pcap-api/packaging b/packages/pcap-api/packaging index 8d23314c..55dfaf77 100644 --- a/packages/pcap-api/packaging +++ b/packages/pcap-api/packaging @@ -4,9 +4,8 @@ set -e # $BOSH_COMPILE_TARGET - where this package & spec'd source files are available # $BOSH_INSTALL_TARGET - where you copy/install files to be included in package -# FIXME: Adjust to vendored BOSH package -tar xzf golang/go1.20.3.linux-amd64.tar.gz -export GOROOT=$BOSH_COMPILE_TARGET/go +source /var/vcap/packages/golang-1-linux/bosh/compile.env + # TODO: maybe these are not needed? Where does this get executed? # if this is executed on some VM we don't care about we could just use the @@ -36,7 +35,7 @@ pushd pcap # -extldflags -static: pass -static to ld, see man 1 ld (https://linux.die.net/man/1/ld) for details export CGO_LDFLAGS="-L${BOSH_COMPILE_TARGET}/libpcap -static" - $GOROOT/bin/go build -ldflags '-linkmode external' -o "${BOSH_INSTALL_TARGET}/bin/pcap-api" github.com/cloudfoundry/pcap-release/src/pcap/cmd/pcap-api + go build -ldflags '-linkmode external' -o "${BOSH_INSTALL_TARGET}/bin/pcap-api" github.com/cloudfoundry/pcap-release/src/pcap/cmd/pcap-api - GOOS=linux GOARCH=amd64 $GOROOT/bin/go build -o "${BOSH_INSTALL_TARGET}/bin/cli/build/pcap-bosh-cli-linux-amd64" github.com/cloudfoundry/pcap-release/src/pcap/cmd/pcap-bosh-cli + GOOS=linux GOARCH=amd64 go build -o "${BOSH_INSTALL_TARGET}/bin/cli/build/pcap-bosh-cli-linux-amd64" github.com/cloudfoundry/pcap-release/src/pcap/cmd/pcap-bosh-cli popd diff --git a/packages/pcap-api/spec b/packages/pcap-api/spec index adfd9d27..c213155d 100644 --- a/packages/pcap-api/spec +++ b/packages/pcap-api/spec @@ -1,9 +1,9 @@ --- name: pcap-api -dependencies: [] +dependencies: +- golang-1-linux files: -- golang/go1.20.3.linux-amd64.tar.gz - pcap/**/* - libpcap-*.tgz From 5c0d4dad7f8c396a3133e09ee4f95012eb1ddeab Mon Sep 17 00:00:00 2001 From: Tamara Boehm <34028368+b1tamara@users.noreply.github.com> Date: Wed, 28 Jun 2023 15:01:17 +0200 Subject: [PATCH 12/16] fix(autobump): Create PR only if bump is required (#55) --- ci/scripts/autobump-dependencies.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ci/scripts/autobump-dependencies.py b/ci/scripts/autobump-dependencies.py index 25fa5d75..0e32be1f 100644 --- a/ci/scripts/autobump-dependencies.py +++ b/ci/scripts/autobump-dependencies.py @@ -182,7 +182,7 @@ def open_pr_exists(self) -> bool: for pr in self.remote_repo.get_pulls( state="open", base=PR_BASE, head=f"{PR_ORG}:{self.pr_branch}" - ): # theoretically there shold never be more than one open PR, print them anyways + ): # theoretically there should never be more than one open PR, print them anyways print(f"Open {self.pr_branch} PR exists: {pr.html_url}") prs_exist = True return prs_exist @@ -325,6 +325,9 @@ def main() -> None: ] for dependency in dependencies: + + should_be_bumped = False + for package in dependency.packages: current_version = dependency.check_current_version(package) latest_release = dependency.latest_release @@ -337,7 +340,9 @@ def main() -> None: if dependency.open_pr_exists(): print(f"[{dependency.name}] Open bump PR exists (for branch: {dependency.pr_branch})") continue + print(f"[{dependency.name}] Version-Bump required for package {package}: {current_version} --> {latest_version}") + should_be_bumped = True latest_release.download() # update blobs in specific package dependency.remove_current_blob(package) @@ -347,6 +352,9 @@ def main() -> None: write_private_yaml() BoshHelper.upload_blobs() + if not should_be_bumped: + continue + # create only one PR per dependency dependency.create_pr() From a405ba704cf169ba620762656e052010ee5e74c4 Mon Sep 17 00:00:00 2001 From: Alexander Lais Date: Fri, 23 Jun 2023 16:54:55 +0200 Subject: [PATCH 13/16] ci: add golang-release autobumper Autobumper code based on @a18n's code. co-authored-by: Alexander Nicke --- .gitignore | 1 - ci/pipeline.yml | 84 ++++++--- ci/scripts/bump_golang_vendored.py | 284 +++++++++++++++++++++++++++++ 3 files changed, 344 insertions(+), 25 deletions(-) create mode 100755 ci/scripts/bump_golang_vendored.py diff --git a/.gitignore b/.gitignore index b46eab98..74d94387 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,6 @@ # Dependency directories & default folders/files .bundle .dev_builds -.final_builds pcap-release.tgz config/private.yml blobs diff --git a/ci/pipeline.yml b/ci/pipeline.yml index 764e9868..cc8a673e 100644 --- a/ci/pipeline.yml +++ b/ci/pipeline.yml @@ -206,7 +206,6 @@ jobs: GITHUB_OWNER: cloudfoundry GITHUB_TOKEN: ((github.access_token)) GCP_SERVICE_KEY: ((gcp.service_key)) - - name: autobump-dependencies public: true serial: true @@ -215,30 +214,61 @@ jobs: - get: daily trigger: true - get: git - - task: autobump-dependencies - config: - inputs: - - name: git - platform: linux - image_resource: - type: docker-image - source: - repository: cf-routing.common.repositories.cloud.sap/pcap-release-testflight - tag: latest - username: ((docker.username)) - password: ((docker.password)) - run: - dir: git - path: /usr/bin/python3 - args: [ "ci/scripts/autobump-dependencies.py" ] - params: - REPO_ROOT: git - PR_BASE: main - PR_ORG: cloudfoundry - PR_LABEL: run-ci + - get: golang-release + - in_parallel: + steps: + - task: autobump-dependencies + config: + inputs: + - name: git + platform: linux + image_resource: + type: docker-image + source: + repository: cf-routing.common.repositories.cloud.sap/pcap-release-testflight + tag: latest + username: ((docker.username)) + password: ((docker.password)) + run: + dir: git + path: /usr/bin/python3 + args: [ "ci/scripts/autobump-dependencies.py" ] + params: + REPO_ROOT: git + PR_BASE: main + PR_ORG: cloudfoundry + PR_LABEL: run-ci - GCP_SERVICE_KEY: ((gcp.service_key)) - GITHUB_COM_TOKEN: ((github.access_token)) + GCP_SERVICE_KEY: ((gcp.service_key)) + GITHUB_COM_TOKEN: ((github.access_token)) + - task: autobump-golang-release + config: + inputs: + - name: git + - name: golang-release + platform: linux + image_resource: + type: docker-image + source: + repository: cf-routing.common.repositories.cloud.sap/pcap-release-testflight + tag: latest + username: ((docker.username)) + password: ((docker.password)) + run: + dir: git + path: /usr/bin/python3 + args: [ "ci/scripts/bump_golang_vendored.py" ] + params: + GO_PACKAGE_REPO_ROOT: ../golang-release + REPO_ROOT: git + PR_BASE: main + PR_ORG: cloudfoundry + PR_LABEL: run-ci + GIT_AUTHOR_NAME: ((github.bot_user)) + GIT_AUTHOR_EMAIL: ((github.bot_email)) + + GCP_SERVICE_KEY: ((gcp.service_key)) + GITHUB_COM_TOKEN: ((github.access_token)) resource_types: - name: slack-notification @@ -263,6 +293,12 @@ resources: uri: https://github.com/cloudfoundry/pcap-release.git branch: main password: ((github.access_token)) + - name: golang-release + type: git + source: + uri: https://github.com/bosh-packages/golang-release.git + branch: master + password: ((github.access_token)) - name: git-pull-requests type: pull-request diff --git a/ci/scripts/bump_golang_vendored.py b/ci/scripts/bump_golang_vendored.py new file mode 100755 index 00000000..2579abed --- /dev/null +++ b/ci/scripts/bump_golang_vendored.py @@ -0,0 +1,284 @@ +#!/usr/bin/env python + +import datetime +import os +import re +import subprocess +import sys +import textwrap +from github import Github, GithubException, UnknownObjectException +from git import Repo, GitCommandError +import yaml +from ruamel.yaml import YAML + +# Required env vars +GH_TOKEN = os.environ["GITHUB_COM_TOKEN"] +PR_BASE = os.environ["PR_BASE"] +PR_ORG = os.environ["PR_ORG"] +PR_LABEL = os.environ["PR_LABEL"] +GO_PACKAGE_REPO_ROOT = os.environ["GO_PACKAGE_REPO_ROOT"] +GIT_AUTHOR_NAME = os.environ["GIT_AUTHOR_NAME"] +GIT_AUTHOR_EMAIL = os.environ["GIT_AUTHOR_EMAIL"] + +GCP_SERVICE_KEY = os.environ["GCP_SERVICE_KEY"] + +# Github.com +GH = Github(GH_TOKEN) + +# Current Git Repository (pcap-release) +ORIGIN_PATH = f"{PR_ORG}/pcap-release" +REMOTE_REPO = GH.get_repo(ORIGIN_PATH) +LOCAL_REPO = Repo(os.curdir) +LOCAL_GIT = LOCAL_REPO.git + +with LOCAL_REPO.config_writer() as config: + config.add_section("user") + config.set("user", "name", GIT_AUTHOR_NAME) + config.set("user", "email", GIT_AUTHOR_EMAIL) + + gh_url = f"url \"https://{GH_TOKEN}@github.com/\"" + config.add_section(gh_url) + config.set(gh_url, "insteadOf", "https://github.com/") + +# golang-release repo (github.com & local path) +GOLANG_RELEASE_REPO = GH.get_repo("bosh-packages/golang-release") +GOLANG_RELEASE_REPO_LOCAL = Repo(GO_PACKAGE_REPO_ROOT) + +# Paths in this Repository +PRIVATE_YAML_PATH = "config/private.yml" +PACKAGE_NAME = "golang-1-linux" +PACKAGE_PATH = f"packages/{PACKAGE_NAME}" +VERSION_PATH = PACKAGE_PATH + "/version" +DOCS_VERSION_PATH = "docs/go.version" +VENDORED_COMMIT_PATH = PACKAGE_PATH + "/vendored-commit" +SPEC_LOCK_PATH = PACKAGE_PATH + "/spec.lock" +GOLANG_RELEASE_INDEX_YML_PATH = f".final_builds/{PACKAGE_PATH}/index.yml" + +# Bump Branch Name +PR_BRANCH = "golang-auto-bump" +BRANCH_FULLNAME = f"{PR_ORG}:{PR_BRANCH}" + + +def main(): + # get the latest version via PyGithub (without cloning repository) for performance/traffic reasons + latest_version = get_latest_version() + + # if re.match(r"^\d+\.\d+$", latest_version): + # print(f"Skipping unpatched version {latest_version}.") + # + # sys.exit(0) + + current_version = get_current_version() + + if latest_version != current_version: + print(f"A new version exists: {current_version} --> {latest_version}") + if open_pr_exists(REMOTE_REPO): + print("A PR for a go version bump already exists. Exiting.") + else: + # Setup private.yml with Blobstore Credentials (for 'bosh vendor-package' later) + write_private_yaml() + + try: + check_for_conflicting_bump_branch(REMOTE_REPO) + except Exception: + print("An golang-bump PR exists, skipping. Merge or delete the other branch to bump dependencies.") + return + + print("No open golang-bump PR exists, bump required.") + test_local_golang_release_clone(latest_version) + blob_link = run_vendor_package() + + checkout_bump_branch() + update_versioning_files(latest_version) + create_pr(current_version, latest_version, blob_link) + + else: + print(f"Already on latest version {current_version}, exiting.") + + +def get_current_version(): + with open(VERSION_PATH, "r") as version_file: + return version_file.read() + + +def get_latest_version(): + version_file = GOLANG_RELEASE_REPO.get_contents(VERSION_PATH) + return version_file.decoded_content.decode() + + +def test_local_golang_release_clone(latest_version_remote): + # get actual latest version from local repository, compare against remote + golang_release_version_file_path = os.path.join(GO_PACKAGE_REPO_ROOT, VERSION_PATH) + with open(golang_release_version_file_path, "r") as file: + latest_version_local = file.read() + if latest_version_remote != latest_version_local: # these should never differ, unless there was an error in cloning golang-release + raise Exception( + f"golang_release versions differ between github.com remote ({latest_version_remote}) and local clone in {GO_PACKAGE_REPO_ROOT} ({latest_version_local})" + ) + + +def run_vendor_package(): + # Documentation for bosh vendor-package: https://bosh.io/docs/package-vendoring/#vendor + cmd_params = ["bosh", "vendor-package", PACKAGE_NAME, GO_PACKAGE_REPO_ROOT] + print(f"Running '{' '.join(cmd_params)}' ...") + + # run as subprocess and handle errors + process = subprocess.Popen(cmd_params, stderr=subprocess.PIPE, stdout=subprocess.PIPE) + stdout, stderr = process.communicate() + if stdout: + # we don't expect any stdout under normal behaviour, might be useful for debugging though + print(stdout.decode("utf-8"), file=sys.stdout) + response = stderr.decode("utf-8") # bosh vendor-package writes success info to stderr for some reason + print(response, file=sys.stdout) + if process.returncode != 0: + raise Exception(f"bosh vendor-package failed. Aborting: {response}") + + if response == "": + print("bosh vendor-package succeeded but provided no output. " + "The golang-package-blob for this version has been uploaded previously. Continuing.") + # extract blobstore URL + rgx = r".*? Successfully uploaded file to (.*?)$" + match = re.match(rgx, response) + if match: + groups = match.groups() + if groups and len(groups) == 1: + blob_link = groups[0] + print(f"bosh vendor-package successful. Link to new blob: {blob_link}") + return blob_link + + print("No new blob was uploaded. See messages above.") + + +def open_pr_exists(repo) -> bool: + prs_exist = False + for pr in repo.get_pulls( + state="open", base="master", head=BRANCH_FULLNAME + ): # theoretically there should never be more than one open PR, print them anyway + print(f"{repo.name}: Open {PR_BRANCH} PR: {pr.html_url}") + prs_exist = True + + # print statement for Jenkins Job build description + pr_version = pr.title.split(" ")[-1] + print(f"PR_URL={pr.html_url} VERSION={pr_version} ACTION=ALREADY_EXISTS") + return prs_exist + + +def check_for_conflicting_bump_branch(repo): + # the bump branch should not exist after a successful previous run/merge. If there is an existing branch, + # we risk including other changes in PR, so we abort instead. + # We're checking on the remote repo since we just cloned it and don't expect any local changes yet. + try: + repo.get_branch(PR_BRANCH) + raise Exception( + f"{repo.name}: The branch {PR_BRANCH} already exists in the remote repository. It might be a stale branch. Aborting.") + except GithubException: + print(f"No conflicting {PR_BRANCH} branch exists on remote repository. Continuing.") + + +def update_versioning_files(latest_version): + # write current golang-release commit hash to vendored-commit file + repo = Repo(GO_PACKAGE_REPO_ROOT) + current_sha = repo.head.object.hexsha + with open(VENDORED_COMMIT_PATH, "w") as vendored_commit_file: + vendored_commit_file.write(current_sha) + + # set versions file + with open(VERSION_PATH, "w") as version_file: + version_file.write(latest_version) + + with open(DOCS_VERSION_PATH, "w") as docs_version_file: + modified_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + docs_version_file.write(f"This file was updated by CI on {modified_time}\n") + docs_version_file.write(f"go{latest_version}") + + +def write_private_yaml(): + private_yml = { + "blobstore": { + "options": { + "credentials_source": "static", + "json_key": GCP_SERVICE_KEY, + } + } + } + + with open(PRIVATE_YAML_PATH, "w") as file: + yaml.dump(private_yml, file, default_flow_style=False) + + +def checkout_bump_branch(): + print(f"Checking out branch {PR_BRANCH}") + try: + LOCAL_GIT.checkout("-b", PR_BRANCH) + except GitCommandError as exception: + print(f"Encountered exception while checking out {PR_BRANCH}: {exception}") + + +def create_pr(current_version, new_version, blob_link): + # create commit + print("Creating git commit...") + # add changed files + LOCAL_GIT.add(GOLANG_RELEASE_INDEX_YML_PATH, "-f") + LOCAL_GIT.add(VERSION_PATH) + LOCAL_GIT.add(DOCS_VERSION_PATH) + LOCAL_GIT.add(VENDORED_COMMIT_PATH) + LOCAL_GIT.add(SPEC_LOCK_PATH) + # create and push commit + LOCAL_GIT.commit("-m", f"dep(go): bump golang to {new_version}") + LOCAL_GIT.push("origin", PR_BRANCH) + + # create PR + print("Creating pull request...") + pr_body = textwrap.dedent( + f""" + Automatic bump of golang-1-release from go version {current_version} to version {new_version}. + + Link to golang blobstore package: {blob_link} + + After merge, consider making a new release. + """ + ) + pr = REMOTE_REPO.create_pull( + title=f"dep(go): Bump golang version to {new_version}", + body=pr_body, + base=PR_BASE, + head=BRANCH_FULLNAME, + ) + + pr.add_to_labels(PR_LABEL) + + +def update_git_content(file_path, file_content, latest_version): + # latest_version may contain a patch version which we need to strip + latest_major_minor = ".".join(latest_version.split(".")[0:2]) + + if file_path == "go.mod": + new_file_content = re.sub(r"^(go [0-9](.[0-9]+)+)$", "go " + latest_major_minor, file_content, 1, re.MULTILINE) + elif file_path == "Jenkinsfile": + # Should consider if we always have sometimes version with only major.minor pattern (no patch). + new_file_content = re.sub(r"go 'Go [0-9](.[0-9]+)+'", "go 'Go " + latest_major_minor + "'", file_content) + elif file_path == ".github/workflows/golint.yml": + # Regex substitution for version number in Yaml File, e.g. + # env: + # GOLANG_VERSION: 1.20 + regex_pattern = r"^(env:\n\s+GOLANG_VERSION: )\d+(.\d+)+$" + new_file_content = re.sub(regex_pattern, rf"\g<1>{latest_version}", file_content, 1, re.MULTILINE) + else: + print("This filename is not in the list of to be processed files.") + return file_content + return new_file_content + + +def cleanup(): + # make sure no credentials remain + try: + os.remove(PRIVATE_YAML_PATH) + except Exception as e: + print(f"Could not clean up: {e}") + + +if __name__ == "__main__": + try: + main() + finally: + cleanup() From 5750ab0522751a70e98d0e37de163515e9e06577 Mon Sep 17 00:00:00 2001 From: CFN-CI <102803133+CFN-CI@users.noreply.github.com> Date: Wed, 28 Jun 2023 13:01:42 +0000 Subject: [PATCH 14/16] dep(go): bump golang to 1.20.5 --- .final_builds/packages/golang-1-linux/index.yml | 4 ++++ docs/go.version | 2 ++ packages/golang-1-linux/spec.lock | 2 +- packages/golang-1-linux/vendored-commit | 1 + packages/golang-1-linux/version | 2 +- 5 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 docs/go.version create mode 100644 packages/golang-1-linux/vendored-commit diff --git a/.final_builds/packages/golang-1-linux/index.yml b/.final_builds/packages/golang-1-linux/index.yml index 6c7d65bd..4c62c715 100644 --- a/.final_builds/packages/golang-1-linux/index.yml +++ b/.final_builds/packages/golang-1-linux/index.yml @@ -3,4 +3,8 @@ builds: version: 126fca7399cba5bc8c1b02e392441f1688daf1586d57d1b3614e314b893a6cc4 blobstore_id: 3be90446-c0f6-4aed-5b1b-da96e7d1814b sha1: sha256:70c3918c28cd74a0a9be561b5eac8b85e8e7de4a72bc66cd321288974937e0be + 8c04109541f4d504f5be559da433998bd459b0f45cd3654557cc3642cc4d2f60: + version: 8c04109541f4d504f5be559da433998bd459b0f45cd3654557cc3642cc4d2f60 + blobstore_id: 07b1c4f5-6c91-4ef2-583b-f0ebf2b94b27 + sha1: sha256:efdf65bca81264d9110ec764be7edea1de341781a1ffe59c219db064d71d9fc3 format-version: "2" diff --git a/docs/go.version b/docs/go.version new file mode 100644 index 00000000..2cce3b2f --- /dev/null +++ b/docs/go.version @@ -0,0 +1,2 @@ +This file was updated by CI on 2023-06-28 13:01:42 +go1.20.5 \ No newline at end of file diff --git a/packages/golang-1-linux/spec.lock b/packages/golang-1-linux/spec.lock index f02637fd..840ab8b4 100644 --- a/packages/golang-1-linux/spec.lock +++ b/packages/golang-1-linux/spec.lock @@ -1,2 +1,2 @@ name: golang-1-linux -fingerprint: 126fca7399cba5bc8c1b02e392441f1688daf1586d57d1b3614e314b893a6cc4 +fingerprint: 8c04109541f4d504f5be559da433998bd459b0f45cd3654557cc3642cc4d2f60 diff --git a/packages/golang-1-linux/vendored-commit b/packages/golang-1-linux/vendored-commit new file mode 100644 index 00000000..72a54241 --- /dev/null +++ b/packages/golang-1-linux/vendored-commit @@ -0,0 +1 @@ +9c5df920e6a8ce6c3ef336dbfd4b165a9df80d11 \ No newline at end of file diff --git a/packages/golang-1-linux/version b/packages/golang-1-linux/version index 1b9335f1..ae45fe86 100644 --- a/packages/golang-1-linux/version +++ b/packages/golang-1-linux/version @@ -1 +1 @@ -1.20.4 \ No newline at end of file +1.20.5 \ No newline at end of file From 5321f7ec5b924563d98f86e951ecb09507b5a355 Mon Sep 17 00:00:00 2001 From: Alexander Lais Date: Wed, 28 Jun 2023 17:46:20 +0200 Subject: [PATCH 15/16] ci: display the currently bundle golang-release in the release note --- ci/scripts/notes.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ci/scripts/notes.sh b/ci/scripts/notes.sh index 8ccbd21b..3bed1450 100755 --- a/ci/scripts/notes.sh +++ b/ci/scripts/notes.sh @@ -25,4 +25,10 @@ releases: \`\`\` EOF +cat >> "${CONCOURSE_ROOT}/${RELEASE_ROOT}/notes.md" < Date: Fri, 30 Jun 2023 08:37:50 +0200 Subject: [PATCH 16/16] dep: Bump libpcap version to 1.10.4 (#68) --- config/blobs.yml | 4 ++++ packages/pcap-agent/packaging | 2 +- packages/pcap-api/packaging | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config/blobs.yml b/config/blobs.yml index aab980f7..11f403d2 100644 --- a/config/blobs.yml +++ b/config/blobs.yml @@ -2,3 +2,7 @@ libpcap-1.10.1.tgz: size: 935221 object_id: 71073646-0c7a-4aba-5c05-19f5330adb7a sha: sha256:ed285f4accaf05344f90975757b3dbfe772ba41d1c401c2648b7fa45b711bdd4 +libpcap-1.10.4.tar.gz: + size: 952153 + object_id: 5bbd1529-9b3f-4bba-4e82-53d6070b5b52 + sha: sha256:ed19a0383fad72e3ad435fd239d7cd80d64916b87269550159d20e47160ebe5f diff --git a/packages/pcap-agent/packaging b/packages/pcap-agent/packaging index cdb5c0e4..82862ff7 100644 --- a/packages/pcap-agent/packaging +++ b/packages/pcap-agent/packaging @@ -18,7 +18,7 @@ export GOPATH=$BOSH_COMPILE_TARGET/gopath export GOCACHE=$BOSH_COMPILE_TARGET/gocache echo "Build libpcap" -LIBPCAP_VERSION=1.10.1 # https://www.tcpdump.org/release/ +LIBPCAP_VERSION=1.10.4 # https://www.tcpdump.org/release/libpcap-1.10.4.tar.gz mkdir "${BOSH_COMPILE_TARGET}/libpcap" tar xzf libpcap-${LIBPCAP_VERSION}.tgz --strip-components 1 -C "${BOSH_COMPILE_TARGET}/libpcap" diff --git a/packages/pcap-api/packaging b/packages/pcap-api/packaging index 55dfaf77..7c009c03 100644 --- a/packages/pcap-api/packaging +++ b/packages/pcap-api/packaging @@ -18,7 +18,7 @@ export GOPATH=$BOSH_COMPILE_TARGET/gopath export GOCACHE=$BOSH_COMPILE_TARGET/gocache echo "Build libpcap" -LIBPCAP_VERSION=1.10.1 # https://www.tcpdump.org/release/ +LIBPCAP_VERSION=1.10.4 # https://www.tcpdump.org/release/libpcap-1.10.4.tar.gz mkdir "${BOSH_COMPILE_TARGET}/libpcap" tar xzf libpcap-${LIBPCAP_VERSION}.tgz --strip-components 1 -C "${BOSH_COMPILE_TARGET}/libpcap"