From db82d5ddad234de39bb8805165b99ca1d4e1ac2e Mon Sep 17 00:00:00 2001 From: wuhuizuo Date: Fri, 26 Jan 2024 00:52:51 +0800 Subject: [PATCH] feat(cloudevents-server): render lark message with template (#70) Signed-off-by: wuhuizuo Signed-off-by: wuhuizuo --- cloudevents-server/go.mod | 12 +- cloudevents-server/go.sum | 33 + .../pkg/events/custom/tekton/lark.go | 137 +- .../pipelinerun-notify.yaml.tmpl | 47 - .../tekton-run-notify.yaml.tmpl | 53 + .../event-pipelinerun.successful.json | 2534 ++++++++--------- .../testdata/event-taskrun.successful.json | 407 +-- .../pkg/events/custom/tekton/types.go | 11 + 8 files changed, 1624 insertions(+), 1610 deletions(-) delete mode 100644 cloudevents-server/pkg/events/custom/tekton/lark_templates/pipelinerun-notify.yaml.tmpl create mode 100644 cloudevents-server/pkg/events/custom/tekton/lark_templates/tekton-run-notify.yaml.tmpl diff --git a/cloudevents-server/go.mod b/cloudevents-server/go.mod index 01eee79..e52f9c2 100644 --- a/cloudevents-server/go.mod +++ b/cloudevents-server/go.mod @@ -13,12 +13,16 @@ require ( github.com/rs/zerolog v1.31.0 github.com/tektoncd/pipeline v0.37.2 gopkg.in/yaml.v3 v3.0.1 + k8s.io/apimachinery v0.23.5 ) require ( ariga.io/atlas v0.14.1-0.20230918065911-83ad451a4935 // indirect contrib.go.opencensus.io/exporter/ocagent v0.7.1-0.20200907061046-05415f1de66d // indirect contrib.go.opencensus.io/exporter/prometheus v0.4.0 // indirect + github.com/Masterminds/goutils v1.1.1 // indirect + github.com/Masterminds/semver/v3 v3.2.0 // indirect + github.com/Masterminds/sprig/v3 v3.2.3 github.com/agext/levenshtein v1.2.1 // indirect github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect github.com/beorn7/perks v1.0.1 // indirect @@ -57,6 +61,7 @@ require ( github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/golang-lru v0.5.4 // indirect github.com/hashicorp/hcl/v2 v2.13.0 // indirect + github.com/huandu/xstrings v1.3.3 // indirect github.com/imdario/mergo v0.3.12 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect @@ -68,7 +73,9 @@ require ( github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.19 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect + github.com/mitchellh/copystructure v1.0.0 // indirect github.com/mitchellh/go-wordwrap v1.0.0 // indirect + github.com/mitchellh/reflectwalk v1.0.1 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect @@ -79,6 +86,8 @@ require ( github.com/prometheus/procfs v0.6.0 // indirect github.com/prometheus/statsd_exporter v0.21.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect + github.com/shopspring/decimal v1.2.0 // indirect + github.com/spf13/cast v1.3.1 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.11 // indirect @@ -110,12 +119,11 @@ require ( gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect k8s.io/api v0.23.5 // indirect - k8s.io/apimachinery v0.23.5 // indirect k8s.io/client-go v0.23.5 // indirect k8s.io/klog/v2 v2.60.1-0.20220317184644-43cc75f9ae89 // indirect k8s.io/kube-openapi v0.0.0-20220124234850-424119656bbf // indirect k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 // indirect - knative.dev/pkg v0.0.0-20220329144915-0a1ec2e0d46c // indirect + knative.dev/pkg v0.0.0-20220329144915-0a1ec2e0d46c sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect sigs.k8s.io/yaml v1.3.0 // indirect diff --git a/cloudevents-server/go.sum b/cloudevents-server/go.sum index 3c803fa..1b3d9de 100644 --- a/cloudevents-server/go.sum +++ b/cloudevents-server/go.sum @@ -55,6 +55,12 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= +github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= +github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= +github.com/Masterminds/semver/v3 v3.2.0 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7YgDP83g= +github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= +github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA= +github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= @@ -254,6 +260,7 @@ github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -280,9 +287,12 @@ github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uG github.com/hashicorp/hcl/v2 v2.13.0 h1:0Apadu1w6M11dyGFxWnmhhcMjkbAiKCv7G1r/2QgCNc= github.com/hashicorp/hcl/v2 v2.13.0/go.mod h1:e4z5nxYlWNPdDSNYX+ph14EvWYMFm3eP0zIUqPc2jr0= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/huandu/xstrings v1.3.3 h1:/Gcsuc1x8JVbJ9/rlye4xZnVAbEkGauT8lbebqcQws4= +github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= @@ -337,9 +347,14 @@ github.com/mattn/go-sqlite3 v1.14.18/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/mitchellh/copystructure v1.0.0 h1:Laisrj+bAB6b/yJwB5Bt3ITZhGJdqmxquMKeZ+mmkFQ= +github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4= github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/mitchellh/reflectwalk v1.0.1 h1:FVzMWA5RllMAKIdUSC8mdWo3XtwoecrH79BY70sEEpE= +github.com/mitchellh/reflectwalk v1.0.1/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= @@ -410,10 +425,14 @@ github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A= github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= +github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= 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/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= +github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng= +github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= 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/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= @@ -448,6 +467,7 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zclconf/go-cty v1.8.0 h1:s4AvqaeQzJIu3ndv4gVIhplVD0krU+bgrcLSVUnaWuA= github.com/zclconf/go-cty v1.8.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= @@ -484,6 +504,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -520,6 +542,7 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 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.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -564,6 +587,8 @@ golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLd golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -592,6 +617,7 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/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.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -647,14 +673,19 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.2.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/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -666,6 +697,7 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/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.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -724,6 +756,7 @@ golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= 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.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/cloudevents-server/pkg/events/custom/tekton/lark.go b/cloudevents-server/pkg/events/custom/tekton/lark.go index 75a8a13..abe6a22 100644 --- a/cloudevents-server/pkg/events/custom/tekton/lark.go +++ b/cloudevents-server/pkg/events/custom/tekton/lark.go @@ -6,15 +6,16 @@ import ( "crypto/tls" "encoding/json" "fmt" - "html/template" "net/http" "regexp" "strings" + "text/template" + "time" + "github.com/Masterminds/sprig/v3" cloudevents "github.com/cloudevents/sdk-go/v2" "github.com/cloudevents/sdk-go/v2/protocol" lark "github.com/larksuite/oapi-sdk-go/v3" - larkcard "github.com/larksuite/oapi-sdk-go/v3/card" larkim "github.com/larksuite/oapi-sdk-go/v3/service/im/v1" "github.com/rs/zerolog/log" tektoncloudevent "github.com/tektoncd/pipeline/pkg/reconciler/events/cloudevent" @@ -27,7 +28,7 @@ import ( _ "embed" ) -//go:embed lark_templates/pipelinerun-notify.yaml.tmpl +//go:embed lark_templates/tekton-run-notify.yaml.tmpl var larkTemplateBytes string // receiver formats: @@ -100,6 +101,7 @@ func sendLarkMessages(client *lark.Client, receivers []string, event cloudevents } if !resp.Success() { + log.Error().Msg(string(resp.RawBody)) return cloudevents.ResultNACK } @@ -113,13 +115,7 @@ func sendLarkMessages(client *lark.Client, receivers []string, event cloudevents } func newLarkMessages(receivers []string, event cloudevents.Event, detailBaseUrl string) ([]*larkim.CreateMessageReq, error) { - var eventData tektoncloudevent.TektonCloudEventData - if err := event.DataAs(&eventData); err != nil { - return nil, err - } - - messageCard := newLarkCard(event.Type(), event.Subject(), event.Source(), detailBaseUrl, &eventData) - messageRawStr, err := messageCard.String() + messageRawStr, err := newLarkCardWithGoTemplate(event, detailBaseUrl) if err != nil { return nil, err } @@ -132,115 +128,104 @@ func newLarkMessages(receivers []string, event cloudevents.Event, detailBaseUrl return reqs, nil } -func newLarkCard(etype, subject, source, baseURL string, data *tektoncloudevent.TektonCloudEventData) *larkcard.MessageCard { - title := newLarkTitle(etype, subject) - header := larkcard.NewMessageCardHeader(). - Template(larkCardHeaderTemplates[tektoncloudevent.TektonEventType(etype)]). - Title(larkcard.NewMessageCardPlainText().Content(title)) - - return larkcard.NewMessageCard(). - Config(larkcard.NewMessageCardConfig().WideScreenMode(true)). - Header(header). - Elements(append(newMessageCardFieldFromTektonCloudEventData(data), - // detail link - larkcard.NewMessageCardAction().Actions([]larkcard.MessageCardActionElement{ - larkcard.NewMessageCardEmbedButton(). - Type(larkcard.MessageCardButtonTypeDefault). - Text(larkcard.NewMessageCardPlainText().Content("View")). - Url(newDetailURL(etype, source, baseURL)), - })), - ) -} +func extractLarkInfosFromEvent(event cloudevents.Event, baseURL string) (*cardMessageInfos, error) { + var data tektoncloudevent.TektonCloudEventData + if err := event.DataAs(&data); err != nil { + return nil, err + } + + ret := cardMessageInfos{ + Title: newLarkTitle(event.Type(), event.Subject()), + TitleTemplate: larkCardHeaderTemplates[tektoncloudevent.TektonEventType(event.Type())], + ViewURL: newDetailURL(event.Type(), event.Source(), baseURL), + } -func newMessageCardFieldFromTektonCloudEventData(data *tektoncloudevent.TektonCloudEventData) []larkcard.MessageCardElement { var startTime, endTime *metav1.Time - var rerunCmd string switch { case data.PipelineRun != nil: startTime = data.PipelineRun.Status.StartTime endTime = data.PipelineRun.Status.CompletionTime if data.PipelineRun.Status.GetCondition(apis.ConditionSucceeded).IsFalse() { - rerunCmd = fmt.Sprintf("tkn -n %s pipeline start %s --use-pipelinerun %s", + ret.RerunURL = fmt.Sprintf("tkn -n %s pipeline start %s --use-pipelinerun %s", data.PipelineRun.Namespace, data.PipelineRun.Spec.PipelineRef.Name, data.PipelineRun.Name) } + + if results := data.PipelineRun.Status.PipelineResults; len(results) > 0 { + var parts []string + for _, r := range results { + parts = append(parts, fmt.Sprintf("**%s**:", r.Name), r.Value, "---") + } + ret.Results = strings.Join(parts, "\n") + } case data.TaskRun != nil: startTime = data.TaskRun.Status.StartTime endTime = data.TaskRun.Status.CompletionTime if data.TaskRun.Status.GetCondition(apis.ConditionSucceeded).IsFalse() { - rerunCmd = fmt.Sprintf("tkn -n %s task start %s --use-taskrun %s", + ret.RerunURL = fmt.Sprintf("tkn -n %s task start %s --use-taskrun %s", data.TaskRun.Namespace, data.TaskRun.Spec.TaskRef.Name, data.TaskRun.Name) } + + if results := data.TaskRun.Status.TaskRunResults; len(results) > 0 { + var parts []string + for _, r := range results { + v, _ := r.Value.MarshalJSON() + parts = append(parts, fmt.Sprintf("**%s**:", r.Name), string(v), "---") + } + ret.Results = strings.Join(parts, "\n") + } case data.Run != nil: startTime = data.Run.Status.StartTime endTime = data.Run.Status.CompletionTime + + if results := data.Run.Status.Results; len(results) > 0 { + var parts []string + for _, r := range results { + parts = append(parts, fmt.Sprintf("**%s**:", r.Name), r.Value, "---") + } + ret.Results = strings.Join(parts, "\n") + } } - var ret []larkcard.MessageCardElement - var infoFileds []*larkcard.MessageCardField if startTime != nil { - content := fmt.Sprintf(`**Start time:** %s`, startTime.GoString()) - infoFileds = append(infoFileds, - larkcard.NewMessageCardField().IsShort(true).Text(larkcard.NewMessageCardLarkMd().Content(content))) + ret.StartTime = startTime.Format(time.RFC3339) } if endTime != nil { - content := fmt.Sprintf(`**End time:** %s`, endTime.GoString()) - infoFileds = append(infoFileds, - larkcard.NewMessageCardField().IsShort(true).Text(larkcard.NewMessageCardLarkMd().Content(content))) + ret.EndTime = endTime.Format(time.RFC3339) } if startTime != nil && endTime != nil { - content := fmt.Sprintf(`**Time cost:** %ds`, endTime.Unix()-startTime.Unix()) - infoFileds = append(infoFileds, - larkcard.NewMessageCardField().IsShort(true).Text(larkcard.NewMessageCardLarkMd().Content(content))) + ret.TimeCost = time.Duration(endTime.UnixNano() - startTime.UnixNano()).String() } - ret = append(ret, larkcard.NewMessageCardDiv().Fields(infoFileds)) - - if rerunCmd != "" { - content := fmt.Sprintf(`**Rerun command:** %s`, rerunCmd) - runRunFileds := []*larkcard.MessageCardField{ - larkcard.NewMessageCardField().Text(larkcard.NewMessageCardLarkMd().Content(content)), - } + return &ret, nil +} - ret = append(ret, larkcard.NewMessageCardHr(), larkcard.NewMessageCardDiv().Fields(runRunFileds)) +func newLarkCardWithGoTemplate(event cloudevents.Event, baseURL string) (string, error) { + infos, err := extractLarkInfosFromEvent(event, baseURL) + if err != nil { + return "", err } - return ret -} - -func newLarkCardWithGoTemplate(etype, subject, source, baseURL string) *larkcard.MessageCard { - // todo: replace with go template - tmpl, err := template.New("lark").Parse(larkTemplateBytes) + tmpl, err := template.New("lark").Funcs(sprig.FuncMap()).Parse(larkTemplateBytes) if err != nil { - return nil + return "", err } tmplResult := new(bytes.Buffer) - if err := tmpl.Execute(tmplResult, nil); err != nil { - return nil + if err := tmpl.Execute(tmplResult, infos); err != nil { + return "", err } values := make(map[string]interface{}) if err := yaml.Unmarshal(tmplResult.Bytes(), &values); err != nil { - return nil - } - - var yamlBytes []byte - data := make(map[string]interface{}) - if err := yaml.Unmarshal(yamlBytes, data); err != nil { - return nil + return "", err } - jsonBytes, err := json.Marshal(data) + jsonBytes, err := json.Marshal(values) if err != nil { - return nil - } - - ret := larkcard.NewMessageCard() - if err := json.Unmarshal(jsonBytes, ret); err != nil { - return nil + return "", err } - return ret + return string(jsonBytes), nil } func newLarkTitle(etype, subject string) string { diff --git a/cloudevents-server/pkg/events/custom/tekton/lark_templates/pipelinerun-notify.yaml.tmpl b/cloudevents-server/pkg/events/custom/tekton/lark_templates/pipelinerun-notify.yaml.tmpl deleted file mode 100644 index f739de6..0000000 --- a/cloudevents-server/pkg/events/custom/tekton/lark_templates/pipelinerun-notify.yaml.tmpl +++ /dev/null @@ -1,47 +0,0 @@ -config: - wide_screen_mode: true -elements: - - tag: div - fields: - - is_short: true - text: - tag: lark_md - content: >- - **Start time:** {{ .StartTime }} - - is_short: true - text: - tag: lark_md - content: >- - **End time:** {{ .EndTime }} - - is_short: true - text: - tag: lark_md - content: >- - **Time cost: {{ .TimeCost }} - - tag: hr - - tag: markdown - content: |- - **Results:** - - abc: true - - sdfasf: true - - actions: - - tag: button - text: - content: View - tag: plain_text - type: primary - multi_url: - url: "{{ .ViewURL }}" - - tag: button - text: - content: Rerun - tag: plain_text - type: danger - multi_url: - url: "{{ .RerunURL }}" - tag: action -header: - template: {{ .TitleTemplate }} - title: - content: {{ .Title }} - tag: plain_text diff --git a/cloudevents-server/pkg/events/custom/tekton/lark_templates/tekton-run-notify.yaml.tmpl b/cloudevents-server/pkg/events/custom/tekton/lark_templates/tekton-run-notify.yaml.tmpl new file mode 100644 index 0000000..fe827ec --- /dev/null +++ b/cloudevents-server/pkg/events/custom/tekton/lark_templates/tekton-run-notify.yaml.tmpl @@ -0,0 +1,53 @@ +config: + wide_screen_mode: true +elements: + - tag: div + fields: + {{- with .StartTime }} + - is_short: false + text: + tag: lark_md + content: "🛫 **Start time:**\t{{ . }}" + {{- end }} + {{- with .EndTime }} + - is_short: false + text: + tag: lark_md + content: "🛬 **End time:**\t{{ . }}" + {{- end }} + {{- with .TimeCost }} + - is_short: false + text: + tag: lark_md + content: "⏱️ **Time cost:**\t{{ . }}" + {{- end }} + {{- with .Results }} + - tag: hr + - tag: markdown + content: |- + **Results:** + +{{ indent 6 . }} + {{- end }} + {{- with .RerunURL }} + - tag: hr + - tag: markdown + content: |- + 🔧 **Rerun:** + + {{ . }}" + {{- end }} + - tag: action + actions: + - tag: button + text: + content: View + tag: plain_text + type: primary + multi_url: + url: "{{ .ViewURL }}" +header: + template: {{ .TitleTemplate }} + title: + content: {{ .Title }} + tag: plain_text diff --git a/cloudevents-server/pkg/events/custom/tekton/testdata/event-pipelinerun.successful.json b/cloudevents-server/pkg/events/custom/tekton/testdata/event-pipelinerun.successful.json index f031a1f..783e3b4 100644 --- a/cloudevents-server/pkg/events/custom/tekton/testdata/event-pipelinerun.successful.json +++ b/cloudevents-server/pkg/events/custom/tekton/testdata/event-pipelinerun.successful.json @@ -1,1332 +1,1242 @@ { - "specversion": "1.0", - "id": "f813f928-adea-4653-a523-dee1a81dab7e", - "source": "/apis///namespaces/ee-cd//build-package-pingcap-tidb-darwin-g9k4f", - "type": "dev.tekton.event.pipelinerun.successful.v1", - "subject": "build-package-pingcap-tidb-darwin-g9k4f", - "datacontenttype": "application/json", - "time": "2023-12-07T06:30:55.539307083Z", - "data": { - "pipelineRun": { - "metadata": { - "name": "build-package-pingcap-tidb-darwin-g9k4f", - "generateName": "build-package-pingcap-tidb-darwin-", - "namespace": "ee-cd", - "uid": "c011780a-1947-4262-9b1f-4cc9fc78428b", - "resourceVersion": "2432962226", - "generation": 1, - "creationTimestamp": "2023-12-07T06:25:27Z", - "labels": { - "kustomize.toolkit.fluxcd.io/name": "tekton-configs", - "kustomize.toolkit.fluxcd.io/namespace": "apps", - "tekton.dev/pipeline": "pingcap-build-package-darwin", - "triggers.tekton.dev/eventlistener": "trigger-groups-listener", - "triggers.tekton.dev/trigger": "git-push-pingcap-tidb", - "triggers.tekton.dev/triggers-eventid": "225a7ca4-9355-4dd4-8efc-55f26d155954" + "specversion": "1.0", + "id": "f813f928-adea-4653-a523-dee1a81dab7e", + "source": "/apis///namespaces/ee-cd//build-package-pingcap-tidb-darwin-g9k4f", + "type": "dev.tekton.event.pipelinerun.successful.v1", + "subject": "build-package-pingcap-tidb-darwin-g9k4f", + "datacontenttype": "application/json", + "time": "2023-12-07T06:30:55.539307083Z", + "data": { + "pipelineRun": { + "metadata": { + "annotations": { + "tekton.dev/ce-context": "{}", + "tekton.dev/git-repo": "https://github.com/pingcap/tidb.git", + "tekton.dev/git-revision": "799a46107ec9fb7dd19c0734f9a4e8da2a3d29ff", + "tekton.dev/git-status": "true", + "tekton.dev/status-target-url": "https://do.pingcap.net/tekton/#/namespaces/{{ .Namespace }}/pipelineruns/{{ .Name }}" + }, + "creationTimestamp": "2024-01-25T15:09:29Z", + "generateName": "build-package-tidb-linux-amd64-", + "generation": 1, + "labels": { + "kustomize.toolkit.fluxcd.io/name": "tekton-configs", + "kustomize.toolkit.fluxcd.io/namespace": "apps", + "tekton.dev/pipeline": "pingcap-build-package", + "triggers.tekton.dev/eventlistener": "public", + "triggers.tekton.dev/trigger": "git-push-pingcap-tidb", + "triggers.tekton.dev/triggers-eventid": "8cc589a5-2236-464f-90e4-5b8ac26e68c8" + }, + "name": "build-package-tidb-linux-amd64-nmjrj", + "namespace": "ee-cd", + "resourceVersion": "2676170386", + "uid": "7e938f27-895c-46a3-b682-e1e6ae2cb131" + }, + "spec": { + "params": [ + { + "name": "git-url", + "value": "https://github.com/pingcap/tidb.git" + }, + { + "name": "git-revision", + "value": "799a46107ec9fb7dd19c0734f9a4e8da2a3d29ff" + }, + { + "name": "git-ref", + "value": "master" + }, + { + "name": "component", + "value": "tidb" + }, + { + "name": "profile", + "value": "release" + }, + { + "name": "os", + "value": "linux" + }, + { + "name": "arch", + "value": "amd64" + } + ], + "pipelineRef": { + "name": "pingcap-build-package" + }, + "podTemplate": { + "nodeSelector": { + "enable-ci": "true" + }, + "tolerations": [ + { + "effect": "NoSchedule", + "key": "dedicated", + "operator": "Equal", + "value": "test-infra" + } + ] + }, + "serviceAccountName": "default", + "taskRunSpecs": [ + { + "pipelineTaskName": "build-binaries", + "stepOverrides": [ + { + "name": "build", + "resources": { + "requests": { + "cpu": "8", + "memory": "32Gi" + } + } + } + ], + "taskPodTemplate": { + "nodeSelector": { + "kubernetes.io/arch": "amd64" + } + } + }, + { + "pipelineTaskName": "build-images", + "taskPodTemplate": { + "nodeSelector": { + "kubernetes.io/arch": "amd64" + } + } + } + ], + "timeouts": { + "pipeline": "30m0s" + }, + "workspaces": [ + { + "name": "dockerconfig", + "secret": { + "secretName": "hub-pingcap-net-ee" + } + }, + { + "name": "source", + "volumeClaimTemplate": { + "metadata": { + "creationTimestamp": null + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "50Gi" + } + }, + "storageClassName": "ceph-block" + }, + "status": {} + } + }, + { + "name": "git-basic-auth", + "secret": { + "secretName": "git-credentials-basic" + } + }, + { + "name": "cargo-home", + "persistentVolumeClaim": { + "claimName": "cargo-home" + } + } + ] + }, + "status": { + "completionTime": "2024-01-25T15:18:47Z", + "conditions": [ + { + "lastTransitionTime": "2024-01-25T15:18:47Z", + "message": "Tasks Completed: 5 (Failed: 0, Cancelled 0), Skipped: 0", + "reason": "Succeeded", + "status": "True", + "type": "Succeeded" + } + ], + "pipelineResults": [ + { + "name": "pushed-binaries", + "value": "oci:\n repo: hub.pingcap.net/pingcap/tidb/package\n tag: \"master-799a461_linux_amd64\"\n digest: \"sha256:51299c4c53e252e0e5d4c67cbf1eccdcce21dfb7a719a5dd44c0114592e7eb40\"\nfiles:\n - tidb-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz\n - tidb-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz.sha256\n - br-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz\n - br-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz.sha256\n - dumpling-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz\n - dumpling-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz.sha256\n - tidb-lightning-ctl-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz\n - tidb-lightning-ctl-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz.sha256\n - tidb-lightning-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz\n - tidb-lightning-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz.sha256\n" + }, + { + "name": "pushed-images", + "value": "images:\n- repo: hub.pingcap.net/pingcap/tidb/images/tidb-server\n url: \"hub.pingcap.net/pingcap/tidb/images/tidb-server:master-799a461_linux_amd64\"\n tag: \"master-799a461_linux_amd64\"\n digest: 'sha256:27c3360d6d4997622ace495dc846bcc409e817ba3cf2e64215b5627cdb2ba323sha256:ed38c95735c25503babb774e9446472f52299bb1717e0e7a67e676917b98adc8sha256:cadc63573a084a2890b74da27bf51cca21e88ee7321cc2e6e5e62728d0e85387sha256:66bd4b3db82a9ff3ac1fca173e1b86cccb79465fde19defaaea2198495b54739'\n- repo: hub.pingcap.net/pingcap/tidb/images/br\n url: \"hub.pingcap.net/pingcap/tidb/images/br:master-799a461_linux_amd64\"\n tag: \"master-799a461_linux_amd64\"\n digest: 'sha256:27c3360d6d4997622ace495dc846bcc409e817ba3cf2e64215b5627cdb2ba323sha256:ed38c95735c25503babb774e9446472f52299bb1717e0e7a67e676917b98adc8sha256:cadc63573a084a2890b74da27bf51cca21e88ee7321cc2e6e5e62728d0e85387sha256:66bd4b3db82a9ff3ac1fca173e1b86cccb79465fde19defaaea2198495b54739'\n- repo: hub.pingcap.net/pingcap/tidb/images/dumpling\n url: \"hub.pingcap.net/pingcap/tidb/images/dumpling:master-799a461_linux_amd64\"\n tag: \"master-799a461_linux_amd64\"\n digest: 'sha256:27c3360d6d4997622ace495dc846bcc409e817ba3cf2e64215b5627cdb2ba323sha256:ed38c95735c25503babb774e9446472f52299bb1717e0e7a67e676917b98adc8sha256:cadc63573a084a2890b74da27bf51cca21e88ee7321cc2e6e5e62728d0e85387sha256:66bd4b3db82a9ff3ac1fca173e1b86cccb79465fde19defaaea2198495b54739'\n- repo: hub.pingcap.net/pingcap/tidb/images/tidb-lightning\n url: \"hub.pingcap.net/pingcap/tidb/images/tidb-lightning:master-799a461_linux_amd64\"\n tag: \"master-799a461_linux_amd64\"\n digest: 'sha256:27c3360d6d4997622ace495dc846bcc409e817ba3cf2e64215b5627cdb2ba323sha256:ed38c95735c25503babb774e9446472f52299bb1717e0e7a67e676917b98adc8sha256:cadc63573a084a2890b74da27bf51cca21e88ee7321cc2e6e5e62728d0e85387sha256:66bd4b3db82a9ff3ac1fca173e1b86cccb79465fde19defaaea2198495b54739'\n" + } + ], + "pipelineSpec": { + "params": [ + { + "name": "git-url", + "type": "string" + }, + { + "default": "master", + "name": "git-ref", + "type": "string" + }, + { + "default": "master", + "name": "git-revision", + "type": "string" + }, + { + "description": "compoent name, supports:\n- tidb\n- tikv\n- pd\n- tiflash\n- tiflow\n- advanced-statefulset\n\nMay be it is an idea to judge it by git-url, but it maybe\nnot a generic way for forked repositories with custom names.\n", + "name": "component", + "type": "string" + }, + { + "default": "linux", + "name": "os", + "type": "string" + }, + { + "default": "amd64", + "name": "arch", + "type": "string" + }, + { + "default": "release", + "name": "profile", + "type": "string" + }, + { + "default": "true", + "name": "push", + "type": "string" + } + ], + "results": [ + { + "description": "pushed binaries.", + "name": "pushed-binaries", + "value": "$(tasks.build-binaries.results.pushed)" + }, + { + "description": "pushed images.", + "name": "pushed-images", + "value": "$(tasks.build-images.results.pushed)" + } + ], + "tasks": [ + { + "name": "checkout", + "params": [ + { + "name": "url", + "value": "https://github.com/pingcap/tidb.git" }, - "annotations": { - "results.tekton.dev/record": "ee-cd/results/225a7ca4-9355-4dd4-8efc-55f26d155954/records/c011780a-1947-4262-9b1f-4cc9fc78428b", - "results.tekton.dev/result": "ee-cd/results/225a7ca4-9355-4dd4-8efc-55f26d155954", - "tekton.dev/git-repo": "https://github.com/pingcap/tidb.git", - "tekton.dev/git-revision": "be62f754fb4182a544b52b2f58a5f867136e7695", - "tekton.dev/git-status": "true", - "tekton.dev/status-target-url": "https://tekton.abc.com/#/namespaces/{{ .Namespace }}/pipelineruns/{{ .Name }}" + { + "name": "revision", + "value": "799a46107ec9fb7dd19c0734f9a4e8da2a3d29ff" }, - "managedFields": [ - { - "manager": "eventlistenersink", - "operation": "Update", - "apiVersion": "tekton.dev/v1beta1", - "time": "2023-12-07T06:25:27Z", - "fieldsType": "FieldsV1", - "fieldsV1": { - "f:metadata": { - "f:annotations": { - ".": {}, - "f:tekton.dev/git-repo": {}, - "f:tekton.dev/git-revision": {}, - "f:tekton.dev/git-status": {}, - "f:tekton.dev/status-target-url": {} - }, - "f:generateName": {}, - "f:labels": { - ".": {}, - "f:triggers.tekton.dev/eventlistener": {}, - "f:triggers.tekton.dev/trigger": {}, - "f:triggers.tekton.dev/triggers-eventid": {} - } - }, - "f:spec": { - ".": {}, - "f:params": {}, - "f:pipelineRef": { - ".": {}, - "f:name": {} - }, - "f:taskRunSpecs": {}, - "f:timeouts": { - ".": {}, - "f:pipeline": {} - }, - "f:workspaces": {} - } - } - }, - { - "manager": "watcher", - "operation": "Update", - "apiVersion": "tekton.dev/v1beta1", - "time": "2023-12-07T06:25:31Z", - "fieldsType": "FieldsV1", - "fieldsV1": { - "f:metadata": { - "f:annotations": { - "f:results.tekton.dev/record": {}, - "f:results.tekton.dev/result": {} - } - } - } - }, - { - "manager": "Go-http-client", - "operation": "Update", - "apiVersion": "tekton.dev/v1beta1", - "time": "2023-12-07T06:30:25Z", - "fieldsType": "FieldsV1", - "fieldsV1": { - "f:metadata": { - "f:labels": { - "f:kustomize.toolkit.fluxcd.io/name": {}, - "f:kustomize.toolkit.fluxcd.io/namespace": {}, - "f:tekton.dev/pipeline": {} - } - }, - "f:status": { - ".": {}, - "f:conditions": {}, - "f:pipelineSpec": { - ".": {}, - "f:finally": {}, - "f:params": {}, - "f:tasks": {}, - "f:workspaces": {} - }, - "f:startTime": {}, - "f:taskRuns": { - ".": {}, - "f:build-package-pingcap-tidb-darwin-g9k4f-acquire-mac-machine": { - ".": {}, - "f:pipelineTaskName": {}, - "f:status": { - ".": {}, - "f:completionTime": {}, - "f:conditions": {}, - "f:podName": {}, - "f:startTime": {}, - "f:steps": {}, - "f:taskResults": {}, - "f:taskSpec": { - ".": {}, - "f:description": {}, - "f:params": {}, - "f:results": {}, - "f:steps": {} - } - } - }, - "f:build-package-pingcap-tidb-darwin-g9k4f-build-binaries": { - ".": {}, - "f:pipelineTaskName": {}, - "f:status": { - ".": {}, - "f:completionTime": {}, - "f:conditions": {}, - "f:podName": {}, - "f:startTime": {}, - "f:steps": {}, - "f:taskSpec": { - ".": {}, - "f:description": {}, - "f:params": {}, - "f:results": {}, - "f:steps": {}, - "f:workspaces": {} - } - } - }, - "f:build-package-pingcap-tidb-darwin-g9k4f-checkout": { - ".": {}, - "f:pipelineTaskName": {}, - "f:status": { - ".": {}, - "f:completionTime": {}, - "f:conditions": {}, - "f:podName": {}, - "f:startTime": {}, - "f:steps": {}, - "f:taskResults": {}, - "f:taskSpec": { - ".": {}, - "f:description": {}, - "f:params": {}, - "f:results": {}, - "f:steps": {}, - "f:workspaces": {} - } - } - }, - "f:build-package-pingcap-tidb-darwin-g9k4f-get-release-ver": { - ".": {}, - "f:pipelineTaskName": {}, - "f:status": { - ".": {}, - "f:completionTime": {}, - "f:conditions": {}, - "f:podName": {}, - "f:startTime": {}, - "f:steps": {}, - "f:taskResults": {}, - "f:taskSpec": { - ".": {}, - "f:results": {}, - "f:steps": {}, - "f:workspaces": {} - } - } - }, - "f:build-package-pingcap-tidb-darwin-g9k4f-release-mac-machine": { - ".": {}, - "f:pipelineTaskName": {}, - "f:status": { - ".": {}, - "f:conditions": {}, - "f:podName": {}, - "f:startTime": {}, - "f:steps": {}, - "f:taskSpec": { - ".": {}, - "f:description": {}, - "f:params": {}, - "f:steps": {} - } - } - } - } - } - } - } - ] + { + "name": "depth", + "value": "0" + }, + { + "name": "refspec", + "value": "+refs/heads/*:refs/remotes/origin/*" + } + ], + "taskRef": { + "kind": "Task", + "name": "git-clone" + }, + "workspaces": [ + { + "name": "output", + "workspace": "source" + }, + { + "name": "basic-auth", + "workspace": "git-basic-auth" + } + ] + }, + { + "name": "get-release-ver", + "runAfter": [ + "checkout" + ], + "taskRef": { + "kind": "Task", + "name": "pingcap-get-release-version" + }, + "workspaces": [ + { + "name": "source", + "workspace": "source" + } + ] + }, + { + "name": "get-binaries-builder", + "params": [ + { + "name": "component", + "value": "tidb" + }, + { + "name": "os", + "value": "linux" + }, + { + "name": "arch", + "value": "amd64" + }, + { + "name": "profile", + "value": "release" + }, + { + "name": "version", + "value": "$(tasks.get-release-ver.results.version)" + } + ], + "taskRef": { + "kind": "Task", + "name": "pingcap-get-builder-image" + } }, - "spec": { - "pipelineRef": { - "name": "pingcap-build-package-darwin" + { + "name": "build-binaries", + "params": [ + { + "name": "os", + "value": "linux" + }, + { + "name": "arch", + "value": "amd64" + }, + { + "name": "profile", + "value": "release" + }, + { + "name": "component", + "value": "tidb" + }, + { + "name": "version", + "value": "$(tasks.get-release-ver.results.version)" + }, + { + "name": "git-ref", + "value": "master" + }, + { + "name": "git-sha", + "value": "799a46107ec9fb7dd19c0734f9a4e8da2a3d29ff" + }, + { + "name": "builder-image", + "value": "$(tasks.get-binaries-builder.results.image-url)" + }, + { + "name": "release-dir", + "value": "build" + }, + { + "name": "push", + "value": "true" + } + ], + "taskRef": { + "kind": "Task", + "name": "pingcap-build-binaries" + }, + "workspaces": [ + { + "name": "source", + "workspace": "source" + }, + { + "name": "dockerconfig", + "workspace": "dockerconfig" + }, + { + "name": "cargo-home", + "workspace": "cargo-home" + } + ] + }, + { + "name": "build-images", + "params": [ + { + "name": "os", + "value": "linux" + }, + { + "name": "arch", + "value": "amd64" + }, + { + "name": "profile", + "value": "release" }, + { + "name": "component", + "value": "tidb" + }, + { + "name": "version", + "value": "$(tasks.get-release-ver.results.version)" + }, + { + "name": "git-ref", + "value": "master" + }, + { + "name": "git-sha", + "value": "799a46107ec9fb7dd19c0734f9a4e8da2a3d29ff" + }, + { + "name": "release-dir", + "value": "build" + }, + { + "name": "build", + "value": "false" + } + ], + "runAfter": [ + "build-binaries" + ], + "taskRef": { + "kind": "Task", + "name": "pingcap-build-images" + }, + "when": [ + { + "input": "linux", + "operator": "in", + "values": [ + "linux" + ] + }, + { + "input": "true", + "operator": "in", + "values": [ + "true" + ] + } + ], + "workspaces": [ + { + "name": "source", + "workspace": "source" + }, + { + "name": "dockerconfig", + "workspace": "dockerconfig" + } + ] + } + ], + "workspaces": [ + { + "description": "The workspace where the git repo will be cloned.", + "name": "source" + }, + { + "description": "Includes a docker `config.json`", + "name": "dockerconfig" + }, + { + "description": "secret containing a .gitconfig and .git-credentials file.", + "name": "git-basic-auth", + "optional": true + }, + { + "description": "cache for cargo pacakges when build binaries", + "name": "cargo-home", + "optional": true + } + ] + }, + "startTime": "2024-01-25T15:09:29Z", + "taskRuns": { + "build-package-tidb-linux-amd64-nmjrj-build-binaries": { + "pipelineTaskName": "build-binaries", + "status": { + "completionTime": "2024-01-25T15:16:58Z", + "conditions": [ + { + "lastTransitionTime": "2024-01-25T15:16:58Z", + "message": "All Steps have completed executing", + "reason": "Succeeded", + "status": "True", + "type": "Succeeded" + } + ], + "podName": "build-package-tidb-linux-amd64-nmjrj-build-binaries-pod", + "startTime": "2024-01-25T15:11:41Z", + "steps": [ + { + "container": "step-generate-build-script", + "imageID": "ghcr.io/pingcap-qe/cd/utils/release@sha256:eb2fa80b95d41fd1ed7e7de5bb482d33e38b89e968993f39150e1f3cf71d9d14", + "name": "generate-build-script", + "terminated": { + "containerID": "containerd://e06fa4bdceca4cc0aff66a31fe3b21c7e67888b391e5876903e3d39030bac693", + "exitCode": 0, + "finishedAt": "2024-01-25T15:12:10Z", + "reason": "Completed", + "startedAt": "2024-01-25T15:12:08Z" + } + }, + { + "container": "step-build", + "imageID": "ghcr.io/pingcap-qe/cd/builders/tidb@sha256:328d64b5c5ec48676c32d0a5ce5fed43007cee076181e41fd22760c7c321dc17", + "name": "build", + "terminated": { + "containerID": "containerd://09aa6613be28e25d0a542f187ff9bb4a65f06c6246ddb4df2d1def17d69f4df6", + "exitCode": 0, + "finishedAt": "2024-01-25T15:16:43Z", + "reason": "Completed", + "startedAt": "2024-01-25T15:12:10Z" + } + }, + { + "container": "step-publish", + "imageID": "ghcr.io/pingcap-qe/cd/utils/release@sha256:eb2fa80b95d41fd1ed7e7de5bb482d33e38b89e968993f39150e1f3cf71d9d14", + "name": "publish", + "terminated": { + "containerID": "containerd://8c4eb08e40a7f6baf4ab74f9a8f44188d84fe27f4270d81ccc1a130a26987963", + "exitCode": 0, + "finishedAt": "2024-01-25T15:16:57Z", + "message": "[{\"key\":\"pushed\",\"value\":\"oci:\\n repo: hub.pingcap.net/pingcap/tidb/package\\n tag: \\\"master-799a461_linux_amd64\\\"\\n digest: \\\"sha256:51299c4c53e252e0e5d4c67cbf1eccdcce21dfb7a719a5dd44c0114592e7eb40\\\"\\nfiles:\\n - tidb-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz\\n - tidb-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz.sha256\\n - br-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz\\n - br-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz.sha256\\n - dumpling-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz\\n - dumpling-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz.sha256\\n - tidb-lightning-ctl-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz\\n - tidb-lightning-ctl-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz.sha256\\n - tidb-lightning-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz\\n - tidb-lightning-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz.sha256\\n\",\"type\":1}]", + "reason": "Completed", + "startedAt": "2024-01-25T15:16:44Z" + } + } + ], + "taskResults": [ + { + "name": "pushed", + "type": "string", + "value": "oci:\n repo: hub.pingcap.net/pingcap/tidb/package\n tag: \"master-799a461_linux_amd64\"\n digest: \"sha256:51299c4c53e252e0e5d4c67cbf1eccdcce21dfb7a719a5dd44c0114592e7eb40\"\nfiles:\n - tidb-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz\n - tidb-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz.sha256\n - br-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz\n - br-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz.sha256\n - dumpling-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz\n - dumpling-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz.sha256\n - tidb-lightning-ctl-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz\n - tidb-lightning-ctl-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz.sha256\n - tidb-lightning-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz\n - tidb-lightning-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz.sha256\n" + } + ], + "taskSpec": { + "description": "Build binaries for the component.", "params": [ - { - "name": "git-url", - "value": "https://github.com/pingcap/tidb.git" - }, - { - "name": "git-revision", - "value": "be62f754fb4182a544b52b2f58a5f867136e7695" - }, - { - "name": "git-ref", - "value": "master" - }, - { - "name": "component", - "value": "tidb" - }, - { - "name": "arch", - "value": "arm64" - }, - { - "name": "binary-builder-iamge", - "value": "ghcr.io/pingcap-qe/cd/builders/tidb:v20231115-e1c4b43-go1.21" - } + { + "name": "component", + "type": "string" + }, + { + "default": "linux", + "name": "os", + "type": "string" + }, + { + "default": "amd64", + "name": "arch", + "type": "string" + }, + { + "description": "the version to releasing.", + "name": "version", + "type": "string" + }, + { + "default": "release", + "description": "supports: 'release' or 'debug'.\n", + "name": "profile", + "type": "string" + }, + { + "name": "git-ref", + "type": "string" + }, + { + "name": "git-sha", + "type": "string" + }, + { + "default": "ghcr.io/pingcap-qe/cd/utils/release:v20231216-37-g8e0ca7e", + "name": "builder-image", + "type": "string" + }, + { + "default": "build", + "name": "release-dir", + "type": "string" + }, + { + "default": "false", + "name": "push", + "type": "string" + }, + { + "default": "", + "name": "mac-builder-resource", + "type": "string" + } + ], + "results": [ + { + "description": "Just built and pushed artifacts, it will be a yaml content.", + "name": "pushed", + "type": "string" + } + ], + "steps": [ + { + "image": "ghcr.io/pingcap-qe/cd/utils/release:v20231216-37-g8e0ca7e", + "name": "generate-build-script", + "resources": {}, + "script": "git clone --depth=1 --branch=main https://github.com/PingCAP-QE/artifacts.git /workspace/artifacts\n\ngit_ref=\"master\"\ngit_sha=\"799a46107ec9fb7dd19c0734f9a4e8da2a3d29ff\"\nif [ \"$git_sha\" == \"$git_ref\" ]; then\n git_sha=\"\"\nfi\n\nout_script=\"/workspace/build-package-artifacts.sh\"\n/workspace/artifacts/packages/scripts/gen-package-artifacts-with-config.sh \\\n tidb \\\n linux \\\n amd64 \\\n v8.0.0-alpha-120-g799a46107e \\\n release \\\n $git_ref \\\n \"$git_sha\" \\\n /workspace/artifacts/packages/packages.yaml.tmpl \\\n \"$out_script\"\n\nif [ -f \"$out_script\" ]; then\n cat \"$out_script\"\nelse\n echo \"🤷 no output script generated!\"\nfi\n" + }, + { + "env": [ + { + "name": "CARGO_NET_GIT_FETCH_WITH_CLI", + "value": "true" + }, + { + "name": "GOPROXY", + "value": "http://goproxy.apps.svc,direct" + }, + { + "name": "CARGO_HOME", + "value": "/workspace/.cargo" + } + ], + "image": "ghcr.io/pingcap-qe/cd/builders/tidb:v20231115-e1c4b43-go1.21", + "name": "build", + "resources": {}, + "script": "script=\"/workspace/build-package-artifacts.sh\"\nif [ ! -f \"$script\" ]; then\n echo \"No build script, skip it.\"\n exit 0\nfi\n\n\"$script\" -b -a -w \"build\"\n", + "workingDir": "$(workspaces.source.path)" + }, + { + "image": "ghcr.io/pingcap-qe/cd/utils/release:v20231216-37-g8e0ca7e", + "name": "publish", + "resources": {}, + "script": "script=\"/workspace/build-package-artifacts.sh\"\nif [ ! -f \"$script\" ]; then\n echo \"No build script, skip it.\"\n printf '\"{}\"' > /tekton/results/pushed\n exit 0\nfi\n\noras version\n\"$script\" -p -w \"build\" -o /tekton/results/pushed\n", + "workingDir": "$(workspaces.source.path)" + } ], - "serviceAccountName": "default", - "timeouts": { - "pipeline": "1h0m0s" + "workspaces": [ + { + "description": "source code.", + "name": "source" + }, + { + "description": "Cache for cargo packages.", + "mountPath": "/workspace/.cargo", + "name": "cargo-home", + "optional": true + }, + { + "description": "Includes a docker `config.json`", + "mountPath": "/root/.docker", + "name": "dockerconfig", + "optional": true + } + ] + } + } + }, + "build-package-tidb-linux-amd64-nmjrj-build-images": { + "pipelineTaskName": "build-images", + "status": { + "completionTime": "2024-01-25T15:18:46Z", + "conditions": [ + { + "lastTransitionTime": "2024-01-25T15:18:46Z", + "message": "All Steps have completed executing", + "reason": "Succeeded", + "status": "True", + "type": "Succeeded" + } + ], + "podName": "build-package-tidb-linux-amd64-nmjrj-build-images-pod", + "startTime": "2024-01-25T15:16:58Z", + "steps": [ + { + "container": "step-generate", + "imageID": "ghcr.io/pingcap-qe/cd/utils/release@sha256:eb2fa80b95d41fd1ed7e7de5bb482d33e38b89e968993f39150e1f3cf71d9d14", + "name": "generate", + "terminated": { + "containerID": "containerd://78ba56b2000598709de91dedc6ad48d2d643a36ac228e9a34f9fdbc7dbac399e", + "exitCode": 0, + "finishedAt": "2024-01-25T15:17:15Z", + "reason": "Completed", + "startedAt": "2024-01-25T15:17:13Z" + } }, - "podTemplate": { - "nodeSelector": { - "enable-ci": "true" + { + "container": "step-build-and-publish", + "imageID": "gcr.io/kaniko-project/executor@sha256:899886a2db1c127ff1565d5c7b1e574af1810bbdad048e9850e4f40b5848d79c", + "name": "build-and-publish", + "terminated": { + "containerID": "containerd://9b118163e14f035e9261b0062ba91a8e43dfcf0fc87f52b6d7aba8dc8843065b", + "exitCode": 0, + "finishedAt": "2024-01-25T15:18:46Z", + "message": "[{\"key\":\"pushed\",\"value\":\"images:\\n- repo: hub.pingcap.net/pingcap/tidb/images/tidb-server\\n url: \\\"hub.pingcap.net/pingcap/tidb/images/tidb-server:master-799a461_linux_amd64\\\"\\n tag: \\\"master-799a461_linux_amd64\\\"\\n digest: 'sha256:27c3360d6d4997622ace495dc846bcc409e817ba3cf2e64215b5627cdb2ba323sha256:ed38c95735c25503babb774e9446472f52299bb1717e0e7a67e676917b98adc8sha256:cadc63573a084a2890b74da27bf51cca21e88ee7321cc2e6e5e62728d0e85387sha256:66bd4b3db82a9ff3ac1fca173e1b86cccb79465fde19defaaea2198495b54739'\\n- repo: hub.pingcap.net/pingcap/tidb/images/br\\n url: \\\"hub.pingcap.net/pingcap/tidb/images/br:master-799a461_linux_amd64\\\"\\n tag: \\\"master-799a461_linux_amd64\\\"\\n digest: 'sha256:27c3360d6d4997622ace495dc846bcc409e817ba3cf2e64215b5627cdb2ba323sha256:ed38c95735c25503babb774e9446472f52299bb1717e0e7a67e676917b98adc8sha256:cadc63573a084a2890b74da27bf51cca21e88ee7321cc2e6e5e62728d0e85387sha256:66bd4b3db82a9ff3ac1fca173e1b86cccb79465fde19defaaea2198495b54739'\\n- repo: hub.pingcap.net/pingcap/tidb/images/dumpling\\n url: \\\"hub.pingcap.net/pingcap/tidb/images/dumpling:master-799a461_linux_amd64\\\"\\n tag: \\\"master-799a461_linux_amd64\\\"\\n digest: 'sha256:27c3360d6d4997622ace495dc846bcc409e817ba3cf2e64215b5627cdb2ba323sha256:ed38c95735c25503babb774e9446472f52299bb1717e0e7a67e676917b98adc8sha256:cadc63573a084a2890b74da27bf51cca21e88ee7321cc2e6e5e62728d0e85387sha256:66bd4b3db82a9ff3ac1fca173e1b86cccb79465fde19defaaea2198495b54739'\\n- repo: hub.pingcap.net/pingcap/tidb/images/tidb-lightning\\n url: \\\"hub.pingcap.net/pingcap/tidb/images/tidb-lightning:master-799a461_linux_amd64\\\"\\n tag: \\\"master-799a461_linux_amd64\\\"\\n digest: 'sha256:27c3360d6d4997622ace495dc846bcc409e817ba3cf2e64215b5627cdb2ba323sha256:ed38c95735c25503babb774e9446472f52299bb1717e0e7a67e676917b98adc8sha256:cadc63573a084a2890b74da27bf51cca21e88ee7321cc2e6e5e62728d0e85387sha256:66bd4b3db82a9ff3ac1fca173e1b86cccb79465fde19defaaea2198495b54739'\\n\",\"type\":1}]", + "reason": "Completed", + "startedAt": "2024-01-25T15:17:16Z" + } + } + ], + "taskResults": [ + { + "name": "pushed", + "type": "string", + "value": "images:\n- repo: hub.pingcap.net/pingcap/tidb/images/tidb-server\n url: \"hub.pingcap.net/pingcap/tidb/images/tidb-server:master-799a461_linux_amd64\"\n tag: \"master-799a461_linux_amd64\"\n digest: 'sha256:27c3360d6d4997622ace495dc846bcc409e817ba3cf2e64215b5627cdb2ba323sha256:ed38c95735c25503babb774e9446472f52299bb1717e0e7a67e676917b98adc8sha256:cadc63573a084a2890b74da27bf51cca21e88ee7321cc2e6e5e62728d0e85387sha256:66bd4b3db82a9ff3ac1fca173e1b86cccb79465fde19defaaea2198495b54739'\n- repo: hub.pingcap.net/pingcap/tidb/images/br\n url: \"hub.pingcap.net/pingcap/tidb/images/br:master-799a461_linux_amd64\"\n tag: \"master-799a461_linux_amd64\"\n digest: 'sha256:27c3360d6d4997622ace495dc846bcc409e817ba3cf2e64215b5627cdb2ba323sha256:ed38c95735c25503babb774e9446472f52299bb1717e0e7a67e676917b98adc8sha256:cadc63573a084a2890b74da27bf51cca21e88ee7321cc2e6e5e62728d0e85387sha256:66bd4b3db82a9ff3ac1fca173e1b86cccb79465fde19defaaea2198495b54739'\n- repo: hub.pingcap.net/pingcap/tidb/images/dumpling\n url: \"hub.pingcap.net/pingcap/tidb/images/dumpling:master-799a461_linux_amd64\"\n tag: \"master-799a461_linux_amd64\"\n digest: 'sha256:27c3360d6d4997622ace495dc846bcc409e817ba3cf2e64215b5627cdb2ba323sha256:ed38c95735c25503babb774e9446472f52299bb1717e0e7a67e676917b98adc8sha256:cadc63573a084a2890b74da27bf51cca21e88ee7321cc2e6e5e62728d0e85387sha256:66bd4b3db82a9ff3ac1fca173e1b86cccb79465fde19defaaea2198495b54739'\n- repo: hub.pingcap.net/pingcap/tidb/images/tidb-lightning\n url: \"hub.pingcap.net/pingcap/tidb/images/tidb-lightning:master-799a461_linux_amd64\"\n tag: \"master-799a461_linux_amd64\"\n digest: 'sha256:27c3360d6d4997622ace495dc846bcc409e817ba3cf2e64215b5627cdb2ba323sha256:ed38c95735c25503babb774e9446472f52299bb1717e0e7a67e676917b98adc8sha256:cadc63573a084a2890b74da27bf51cca21e88ee7321cc2e6e5e62728d0e85387sha256:66bd4b3db82a9ff3ac1fca173e1b86cccb79465fde19defaaea2198495b54739'\n" + } + ], + "taskSpec": { + "description": "This task builds images for pingcap components.", + "params": [ + { + "name": "component", + "type": "string" + }, + { + "default": "linux", + "name": "os", + "type": "string" + }, + { + "default": "amd64", + "name": "arch", + "type": "string" + }, + { + "description": "the version to releasing.", + "name": "version", + "type": "string" + }, + { + "default": "release", + "description": "supports: 'release' or 'debug'.\n", + "name": "profile", + "type": "string" + }, + { + "name": "git-ref", + "type": "string" + }, + { + "name": "git-sha", + "type": "string" + }, + { + "default": "build", + "name": "release-dir", + "type": "string" + }, + { + "default": "false", + "description": "Does it need to build the binaries before packing the images?", + "name": "build", + "type": "string" + } + ], + "results": [ + { + "description": "Just built and pushed images, it will be a yaml content.", + "name": "pushed", + "type": "string" + } + ], + "steps": [ + { + "image": "ghcr.io/pingcap-qe/cd/utils/release:v20231216-37-g8e0ca7e", + "name": "generate", + "resources": {}, + "script": "git clone --depth=1 --branch=main https://github.com/PingCAP-QE/artifacts.git /workspace/artifacts\n\ngit_ref=\"master\"\ngit_sha=\"799a46107ec9fb7dd19c0734f9a4e8da2a3d29ff\"\nif [ \"$git_sha\" == \"$git_ref\" ]; then\n git_sha=\"\"\nfi\n\nout_script=\"/workspace/build-package-images.sh\"\n/workspace/artifacts/packages/scripts/gen-package-images-with-config.sh \\\n tidb \\\n linux \\\n amd64 \\\n v8.0.0-alpha-120-g799a46107e \\\n release \\\n $git_ref \\\n \"$git_sha\" \\\n /workspace/artifacts/packages/packages.yaml.tmpl \\\n \"$out_script\"\n\nif [ -f \"$out_script\" ]; then\n cat \"$out_script\"\nelse\n echo \"🤷 no output script generated!\"\nfi\n" + }, + { + "env": [ + { + "name": "KANIKO_EXECUTOR", + "value": "/kaniko/executor" + } + ], + "image": "gcr.io/kaniko-project/executor:debug", + "name": "build-and-publish", + "resources": { + "requests": { + "cpu": "4", + "memory": "8Gi" + } }, - "tolerations": [ - { - "key": "dedicated", - "operator": "Equal", - "value": "test-infra", - "effect": "NoSchedule" - } - ] + "script": "script=\"/workspace/build-package-images.sh\"\nif [ ! -f \"$script\" ]; then\n echo \"No build script, skip it.\"\n printf '\"{}\"' > /tekton/results/pushed\n exit 0\nfi\n\nif [ \"false\" = \"true\" ]; then\n \"$script\" -w \"build\" -k ${KANIKO_EXECUTOR} -o /tekton/results/pushed -b\nelse\n \"$script\" -w \"build\" -k ${KANIKO_EXECUTOR} -o /tekton/results/pushed\nfi\n", + "workingDir": "$(workspaces.source.path)" + } + ], + "workspaces": [ + { + "name": "source" + }, + { + "description": "Includes a docker `config.json`", + "mountPath": "/kaniko/.docker", + "name": "dockerconfig", + "optional": true + } + ] + } + } + }, + "build-package-tidb-linux-amd64-nmjrj-checkout": { + "pipelineTaskName": "checkout", + "status": { + "completionTime": "2024-01-25T15:11:16Z", + "conditions": [ + { + "lastTransitionTime": "2024-01-25T15:11:16Z", + "message": "All Steps have completed executing", + "reason": "Succeeded", + "status": "True", + "type": "Succeeded" + } + ], + "podName": "build-package-tidb-linux-amd64-nmjrj-checkout-pod", + "startTime": "2024-01-25T15:09:29Z", + "steps": [ + { + "container": "step-clone", + "imageID": "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init@sha256:c0b0ed1cd81090ce8eecf60b936e9345089d9dfdb6ebdd2fd7b4a0341ef4f2b9", + "name": "clone", + "terminated": { + "containerID": "containerd://5ecc10ba014f790b23bd6cbd06177fbefa0b8c46fa95c2f917ceae202c815acd", + "exitCode": 0, + "finishedAt": "2024-01-25T15:11:12Z", + "message": "[{\"key\":\"commit\",\"value\":\"799a46107ec9fb7dd19c0734f9a4e8da2a3d29ff\",\"type\":1},{\"key\":\"committer-date\",\"value\":\"1706195361\",\"type\":1},{\"key\":\"url\",\"value\":\"https://github.com/pingcap/tidb.git\",\"type\":1}]", + "reason": "Completed", + "startedAt": "2024-01-25T15:09:49Z" + } + } + ], + "taskResults": [ + { + "name": "commit", + "type": "string", + "value": "799a46107ec9fb7dd19c0734f9a4e8da2a3d29ff" + }, + { + "name": "committer-date", + "type": "string", + "value": "1706195361" }, + { + "name": "url", + "type": "string", + "value": "https://github.com/pingcap/tidb.git" + } + ], + "taskSpec": { + "description": "These Tasks are Git tasks to work with repositories used by other tasks in your Pipeline.\nThe git-clone Task will clone a repo from the provided url into the output Workspace. By default the repo will be cloned into the root of your Workspace. You can clone into a subdirectory by setting this Task's subdirectory param. This Task also supports sparse checkouts. To perform a sparse checkout, pass a list of comma separated directory patterns to this Task's sparseCheckoutDirectories param.", + "params": [ + { + "description": "Repository URL to clone from.", + "name": "url", + "type": "string" + }, + { + "default": "", + "description": "Revision to checkout. (branch, tag, sha, ref, etc...)", + "name": "revision", + "type": "string" + }, + { + "default": "", + "description": "Refspec to fetch before checking out revision.", + "name": "refspec", + "type": "string" + }, + { + "default": "true", + "description": "Initialize and fetch git submodules.", + "name": "submodules", + "type": "string" + }, + { + "default": "1", + "description": "Perform a shallow clone, fetching only the most recent N commits.", + "name": "depth", + "type": "string" + }, + { + "default": "true", + "description": "Set the `http.sslVerify` global git config. Setting this to `false` is not advised unless you are sure that you trust your git remote.", + "name": "sslVerify", + "type": "string" + }, + { + "default": "ca-bundle.crt", + "description": "file name of mounted crt using ssl-ca-directory workspace. default value is ca-bundle.crt.", + "name": "crtFileName", + "type": "string" + }, + { + "default": "", + "description": "Subdirectory inside the `output` Workspace to clone the repo into.", + "name": "subdirectory", + "type": "string" + }, + { + "default": "", + "description": "Define the directory patterns to match or exclude when performing a sparse checkout.", + "name": "sparseCheckoutDirectories", + "type": "string" + }, + { + "default": "true", + "description": "Clean out the contents of the destination directory if it already exists before cloning.", + "name": "deleteExisting", + "type": "string" + }, + { + "default": "", + "description": "HTTP proxy server for non-SSL requests.", + "name": "httpProxy", + "type": "string" + }, + { + "default": "", + "description": "HTTPS proxy server for SSL requests.", + "name": "httpsProxy", + "type": "string" + }, + { + "default": "", + "description": "Opt out of proxying HTTP/HTTPS requests.", + "name": "noProxy", + "type": "string" + }, + { + "default": "true", + "description": "Log the commands that are executed during `git-clone`'s operation.", + "name": "verbose", + "type": "string" + }, + { + "default": "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init:v0.29.0", + "description": "The image providing the git-init binary that this Task runs.", + "name": "gitInitImage", + "type": "string" + }, + { + "default": "/tekton/home", + "description": "Absolute path to the user's home directory. Set this explicitly if you are running the image as a non-root user or have overridden\nthe gitInitImage param with an image containing custom user configuration.\n", + "name": "userHome", + "type": "string" + } + ], + "results": [ + { + "description": "The precise commit SHA that was fetched by this Task.", + "name": "commit", + "type": "string" + }, + { + "description": "The precise URL that was fetched by this Task.", + "name": "url", + "type": "string" + }, + { + "description": "The epoch timestamp of the commit that was fetched by this Task.", + "name": "committer-date", + "type": "string" + } + ], + "steps": [ + { + "env": [ + { + "name": "HOME", + "value": "/tekton/home" + }, + { + "name": "PARAM_URL", + "value": "https://github.com/pingcap/tidb.git" + }, + { + "name": "PARAM_REVISION", + "value": "799a46107ec9fb7dd19c0734f9a4e8da2a3d29ff" + }, + { + "name": "PARAM_REFSPEC", + "value": "+refs/heads/*:refs/remotes/origin/*" + }, + { + "name": "PARAM_SUBMODULES", + "value": "true" + }, + { + "name": "PARAM_DEPTH", + "value": "0" + }, + { + "name": "PARAM_SSL_VERIFY", + "value": "true" + }, + { + "name": "PARAM_CRT_FILENAME", + "value": "ca-bundle.crt" + }, + { + "name": "PARAM_SUBDIRECTORY" + }, + { + "name": "PARAM_DELETE_EXISTING", + "value": "true" + }, + { + "name": "PARAM_HTTP_PROXY" + }, + { + "name": "PARAM_HTTPS_PROXY" + }, + { + "name": "PARAM_NO_PROXY" + }, + { + "name": "PARAM_VERBOSE", + "value": "true" + }, + { + "name": "PARAM_SPARSE_CHECKOUT_DIRECTORIES" + }, + { + "name": "PARAM_USER_HOME", + "value": "/tekton/home" + }, + { + "name": "WORKSPACE_OUTPUT_PATH", + "value": "$(workspaces.output.path)" + }, + { + "name": "WORKSPACE_SSH_DIRECTORY_BOUND", + "value": "$(workspaces.ssh-directory.bound)" + }, + { + "name": "WORKSPACE_SSH_DIRECTORY_PATH", + "value": "$(workspaces.ssh-directory.path)" + }, + { + "name": "WORKSPACE_BASIC_AUTH_DIRECTORY_BOUND", + "value": "$(workspaces.basic-auth.bound)" + }, + { + "name": "WORKSPACE_BASIC_AUTH_DIRECTORY_PATH", + "value": "$(workspaces.basic-auth.path)" + }, + { + "name": "WORKSPACE_SSL_CA_DIRECTORY_BOUND", + "value": "$(workspaces.ssl-ca-directory.bound)" + }, + { + "name": "WORKSPACE_SSL_CA_DIRECTORY_PATH", + "value": "$(workspaces.ssl-ca-directory.path)" + }, + { + "name": "GIT_SSH_COMMAND", + "value": "ssh -o StrictHostKeyChecking=accept-new" + } + ], + "image": "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init:v0.29.0", + "name": "clone", + "resources": {}, + "script": "#!/usr/bin/env sh\nset -eu\n\nif [ \"${PARAM_VERBOSE}\" = \"true\" ] ; then\n set -x\nfi\n\nif [ \"${WORKSPACE_BASIC_AUTH_DIRECTORY_BOUND}\" = \"true\" ] ; then\n cp \"${WORKSPACE_BASIC_AUTH_DIRECTORY_PATH}/.git-credentials\" \"${PARAM_USER_HOME}/.git-credentials\"\n cp \"${WORKSPACE_BASIC_AUTH_DIRECTORY_PATH}/.gitconfig\" \"${PARAM_USER_HOME}/.gitconfig\"\n chmod 400 \"${PARAM_USER_HOME}/.git-credentials\"\n chmod 400 \"${PARAM_USER_HOME}/.gitconfig\"\nfi\n\nif [ \"${WORKSPACE_SSH_DIRECTORY_BOUND}\" = \"true\" ] ; then\n cp -R \"${WORKSPACE_SSH_DIRECTORY_PATH}\" \"${PARAM_USER_HOME}\"/.ssh\n chmod 700 \"${PARAM_USER_HOME}\"/.ssh\n chmod -R 400 \"${PARAM_USER_HOME}\"/.ssh/*\nfi\n\nif [ \"${WORKSPACE_SSL_CA_DIRECTORY_BOUND}\" = \"true\" ] ; then\n export GIT_SSL_CAPATH=\"${WORKSPACE_SSL_CA_DIRECTORY_PATH}\"\n if [ \"${PARAM_CRT_FILENAME}\" != \"\" ] ; then\n export GIT_SSL_CAINFO=\"${WORKSPACE_SSL_CA_DIRECTORY_PATH}/${PARAM_CRT_FILENAME}\"\n fi\nfi\nCHECKOUT_DIR=\"${WORKSPACE_OUTPUT_PATH}/${PARAM_SUBDIRECTORY}\"\n\ncleandir() {\n # Delete any existing contents of the repo directory if it exists.\n #\n # We don't just \"rm -rf ${CHECKOUT_DIR}\" because ${CHECKOUT_DIR} might be \"/\"\n # or the root of a mounted volume.\n if [ -d \"${CHECKOUT_DIR}\" ] ; then\n # Delete non-hidden files and directories\n rm -rf \"${CHECKOUT_DIR:?}\"/*\n # Delete files and directories starting with . but excluding ..\n rm -rf \"${CHECKOUT_DIR}\"/.[!.]*\n # Delete files and directories starting with .. plus any other character\n rm -rf \"${CHECKOUT_DIR}\"/..?*\n fi\n}\n\nif [ \"${PARAM_DELETE_EXISTING}\" = \"true\" ] ; then\n cleandir || true\nfi\n\ntest -z \"${PARAM_HTTP_PROXY}\" || export HTTP_PROXY=\"${PARAM_HTTP_PROXY}\"\ntest -z \"${PARAM_HTTPS_PROXY}\" || export HTTPS_PROXY=\"${PARAM_HTTPS_PROXY}\"\ntest -z \"${PARAM_NO_PROXY}\" || export NO_PROXY=\"${PARAM_NO_PROXY}\"\n\ngit config --global --add safe.directory \"${WORKSPACE_OUTPUT_PATH}\"\n/ko-app/git-init \\\n -url=\"${PARAM_URL}\" \\\n -revision=\"${PARAM_REVISION}\" \\\n -refspec=\"${PARAM_REFSPEC}\" \\\n -path=\"${CHECKOUT_DIR}\" \\\n -sslVerify=\"${PARAM_SSL_VERIFY}\" \\\n -submodules=\"${PARAM_SUBMODULES}\" \\\n -depth=\"${PARAM_DEPTH}\" \\\n -sparseCheckoutDirectories=\"${PARAM_SPARSE_CHECKOUT_DIRECTORIES}\"\ncd \"${CHECKOUT_DIR}\"\nRESULT_SHA=\"$(git rev-parse HEAD)\"\nEXIT_CODE=\"$?\"\nif [ \"${EXIT_CODE}\" != 0 ] ; then\n exit \"${EXIT_CODE}\"\nfi\nRESULT_COMMITTER_DATE=\"$(git log -1 --pretty=%ct)\"\nprintf \"%s\" \"${RESULT_COMMITTER_DATE}\" > \"/tekton/results/committer-date\"\nprintf \"%s\" \"${RESULT_SHA}\" > \"/tekton/results/commit\"\nprintf \"%s\" \"${PARAM_URL}\" > \"/tekton/results/url\"\n" + } + ], "workspaces": [ - { - "name": "dockerconfig", - "secret": { - "secretName": "hub-pingcap-net-ee" - } - }, - { - "name": "mac-ssh-credentials", - "secret": { - "secretName": "mac-ssh-credentials" - } - }, - { - "name": "source", - "volumeClaimTemplate": { - "metadata": { - "creationTimestamp": null - }, - "spec": { - "accessModes": [ - "ReadWriteOnce" - ], - "resources": { - "requests": { - "storage": "10Gi" - } - }, - "storageClassName": "ceph-block" - }, - "status": {} - } - }, - { - "name": "git-basic-auth", - "secret": { - "secretName": "git-credentials-basic" - } - } + { + "description": "The git repo will be cloned onto the volume backing this Workspace.", + "name": "output" + }, + { + "description": "A .ssh directory with private key, known_hosts, config, etc. Copied to\nthe user's home before git commands are executed. Used to authenticate\nwith the git remote when performing the clone. Binding a Secret to this\nWorkspace is strongly recommended over other volume types.\n", + "name": "ssh-directory", + "optional": true + }, + { + "description": "A Workspace containing a .gitconfig and .git-credentials file. These\nwill be copied to the user's home before any git commands are run. Any\nother files in this Workspace are ignored. It is strongly recommended\nto use ssh-directory over basic-auth whenever possible and to bind a\nSecret to this Workspace over other volume types.\n", + "name": "basic-auth", + "optional": true + }, + { + "description": "A workspace containing CA certificates, this will be used by Git to\nverify the peer with when fetching or pushing over HTTPS.\n", + "name": "ssl-ca-directory", + "optional": true + } + ] + } + } + }, + "build-package-tidb-linux-amd64-nmjrj-get-binaries-builder": { + "pipelineTaskName": "get-binaries-builder", + "status": { + "completionTime": "2024-01-25T15:11:41Z", + "conditions": [ + { + "lastTransitionTime": "2024-01-25T15:11:41Z", + "message": "All Steps have completed executing", + "reason": "Succeeded", + "status": "True", + "type": "Succeeded" + } + ], + "podName": "build-package-tidb-linux-amd64-nmjrj-get-binaries-builder-pod", + "startTime": "2024-01-25T15:11:33Z", + "steps": [ + { + "container": "step-get", + "imageID": "ghcr.io/pingcap-qe/cd/utils/release@sha256:eb2fa80b95d41fd1ed7e7de5bb482d33e38b89e968993f39150e1f3cf71d9d14", + "name": "get", + "terminated": { + "containerID": "containerd://5390ac1b0072f052e1e52bdb2f2b39819f902bdbd79ec2dbb914547fed7ec19b", + "exitCode": 0, + "finishedAt": "2024-01-25T15:11:40Z", + "message": "[{\"key\":\"image-url\",\"value\":\"ghcr.io/pingcap-qe/cd/builders/tidb:v20231115-e1c4b43-go1.21\",\"type\":1}]", + "reason": "Completed", + "startedAt": "2024-01-25T15:11:39Z" + } + } + ], + "taskResults": [ + { + "name": "image-url", + "type": "string", + "value": "ghcr.io/pingcap-qe/cd/builders/tidb:v20231115-e1c4b43-go1.21" + } + ], + "taskSpec": { + "description": "Build binaries for the component.", + "params": [ + { + "name": "component", + "type": "string" + }, + { + "default": "linux", + "name": "os", + "type": "string" + }, + { + "default": "amd64", + "name": "arch", + "type": "string" + }, + { + "description": "the version to releasing.", + "name": "version", + "type": "string" + }, + { + "default": "release", + "description": "supports: 'release' or 'debug' or others.\n", + "name": "profile", + "type": "string" + } ], - "taskRunSpecs": [ - { - "pipelineTaskName": "acquire-mac-machine", - "taskPodTemplate": { - "nodeSelector": { - "kubernetes.io/arch": "amd64" - } - } - }, - { - "pipelineTaskName": "release-mac-machine", - "taskPodTemplate": { - "nodeSelector": { - "kubernetes.io/arch": "amd64" - } - } - } + "results": [ + { + "description": "The builder image url", + "name": "image-url", + "type": "string" + } + ], + "steps": [ + { + "image": "ghcr.io/pingcap-qe/cd/utils/release:v20231216-37-g8e0ca7e", + "name": "get", + "resources": {}, + "script": "git clone --depth=1 --branch=main https://github.com/PingCAP-QE/artifacts.git /workspace/artifacts\n\nout=\"/workspace/builder-package-artifacts.txt\"\n/workspace/artifacts/packages/scripts/get-package-builder-with-config.sh \\\n tidb \\\n linux \\\n amd64 \\\n v8.0.0-alpha-120-g799a46107e \\\n release \\\n /workspace/artifacts/packages/packages.yaml.tmpl \\\n $out\n\nprintf \"%s\" \"$(cat $out)\" > /tekton/results/image-url\n" + } ] - }, + } + } + }, + "build-package-tidb-linux-amd64-nmjrj-get-release-ver": { + "pipelineTaskName": "get-release-ver", "status": { - "conditions": [ - { - "type": "Succeeded", - "status": "True", - "lastTransitionTime": "2023-12-07T06:30:55Z", - "reason": "Succeeded", - "message": "Tasks Completed: 5 (Failed: 0, Cancelled 0), Skipped: 0" - } + "completionTime": "2024-01-25T15:11:33Z", + "conditions": [ + { + "lastTransitionTime": "2024-01-25T15:11:33Z", + "message": "All Steps have completed executing", + "reason": "Succeeded", + "status": "True", + "type": "Succeeded" + } + ], + "podName": "build-package-tidb-linux-amd64-nmjrj-get-release-ver-pod", + "startTime": "2024-01-25T15:11:17Z", + "steps": [ + { + "container": "step-git-describe", + "imageID": "docker.io/alpine/git@sha256:1134fdfca49677f3c33445ede74cd64b55f524ad3cb215fa464492ad281eafc0", + "name": "git-describe", + "terminated": { + "containerID": "containerd://e10eeb2d7380d9f83d60d6f78e1be903a10544a5af0ed1630f4f58150d4b8b8b", + "exitCode": 0, + "finishedAt": "2024-01-25T15:11:32Z", + "message": "[{\"key\":\"version\",\"value\":\"v8.0.0-alpha-120-g799a46107e\",\"type\":1}]", + "reason": "Completed", + "startedAt": "2024-01-25T15:11:28Z" + } + } + ], + "taskResults": [ + { + "name": "version", + "type": "string", + "value": "v8.0.0-alpha-120-g799a46107e" + } + ], + "taskSpec": { + "results": [ + { + "description": "The release version of the git repo", + "name": "version", + "type": "string" + } ], - "startTime": "2023-12-07T06:25:29Z", - "completionTime": "2023-12-07T06:30:55Z", - "taskRuns": { - "build-package-pingcap-tidb-darwin-g9k4f-acquire-mac-machine": { - "pipelineTaskName": "acquire-mac-machine", - "status": { - "conditions": [ - { - "type": "Succeeded", - "status": "True", - "lastTransitionTime": "2023-12-07T06:25:48Z", - "reason": "Succeeded", - "message": "All Steps have completed executing" - } - ], - "podName": "build-package-pingcap-tidb-darwin-g9k4f-acquire-mac-machine-pod", - "startTime": "2023-12-07T06:25:30Z", - "completionTime": "2023-12-07T06:25:48Z", - "steps": [ - { - "terminated": { - "exitCode": 0, - "reason": "Completed", - "message": "[{\"key\":\"leased-resource\",\"value\":\"darwin-arm64-1\",\"type\":1}]", - "startedAt": "2023-12-07T06:25:37Z", - "finishedAt": "2023-12-07T06:25:37Z", - "containerID": "containerd://6f5e41e495555c20c2ae80194100a4d1cf032e5dbf7c9c42cffa07d3884994fa" - }, - "name": "boskosctl-acquire", - "container": "step-boskosctl-acquire", - "imageID": "gcr.io/k8s-staging-boskos/boskosctl@sha256:a7fc984732c5dd0b4e0fe0a92e2730fa4b6bddecd0f6f6c7c6b5501abe4ab105" - }, - { - "terminated": { - "exitCode": 0, - "reason": "Completed", - "message": "[{\"key\":\"leased-resource\",\"value\":\"darwin-arm64-1\",\"type\":1}]", - "startedAt": "2023-12-07T06:25:37Z", - "finishedAt": "2023-12-07T06:25:38Z", - "containerID": "containerd://a4c26a35381fc513541f6d9e7be2fbe6a26b79fdaad80c59a80c12ec0af7b566" - }, - "name": "create-heartbeat-pod-yaml", - "container": "step-create-heartbeat-pod-yaml", - "imageID": "docker.io/lachlanevenson/k8s-kubectl@sha256:3a5e22a406a109f4f26ec06b5f1f6a66ae0cd0e185bc28499eb7b7a3bbf1fe09" - } - ], - "taskResults": [ - { - "name": "leased-resource", - "type": "string", - "value": "darwin-arm64-1" - } - ], - "taskSpec": { - "params": [ - { - "name": "server-url", - "type": "string", - "description": "The URL of the running boskos server", - "default": "http://boskos.test-pods.svc.cluster.local" - }, - { - "name": "type", - "type": "string", - "description": "The type of resource to request. Resource types are specified in the resource\nConfigMap provided to the Boskos server.\n", - "default": "gke-project" - }, - { - "name": "owner-name", - "type": "string", - "description": "A string that identifies the owner of the leased resource to request." - } - ], - "description": "Acquire a project using Boskos.\n\nThe boskos-acquire Task will request a resource of the specified type from the\nserver-url. If successful, it will start a pod that will run the boskosctl heartbeat\ncommand. When you are done with the resource, release it with boskos-release.\n", - "steps": [ - { - "name": "boskosctl-acquire", - "image": "gcr.io/k8s-staging-boskos/boskosctl@sha256:a7fc984732c5dd0b4e0fe0a92e2730fa4b6bddecd0f6f6c7c6b5501abe4ab105", - "resources": {}, - "script": "RESOURCE=$(boskosctl acquire \\\n --server-url=http://boskos.apps.svc \\\n --owner-name=build-package-pingcap-tidb-darwin-g9k4f \\\n --type=mac-machine-arm64 \\\n --state=free \\\n --target-state=busy)\necho $RESOURCE \u003e /workspace/full-resource-output.json\necho $RESOURCE | jq -rj \".name\" \u003e /tekton/results/leased-resource\n" - }, - { - "name": "create-heartbeat-pod-yaml", - "image": "docker.io/lachlanevenson/k8s-kubectl@sha256:3a5e22a406a109f4f26ec06b5f1f6a66ae0cd0e185bc28499eb7b7a3bbf1fe09", - "resources": {}, - "script": "FULL_RESOURCE_OUTPUT=$(cat /workspace/full-resource-output.json)\nLEASED_RESOURCE=$(cat /tekton/results/leased-resource)\ncat \u003c\u003cEOF | kubectl apply -f -\napiVersion: v1\nkind: Pod\nmetadata:\n name: boskos-heartbeat-$LEASED_RESOURCE\nspec:\n nodeSelector:\n kubernetes.io/arch: amd64\n containers:\n - name: heartbeat\n image: gcr.io/k8s-staging-boskos/boskosctl@sha256:a7fc984732c5dd0b4e0fe0a92e2730fa4b6bddecd0f6f6c7c6b5501abe4ab105\n args:\n - heartbeat\n - --server-url=http://boskos.apps.svc\n - --owner-name=build-package-pingcap-tidb-darwin-g9k4f\n - --resource=$FULL_RESOURCE_OUTPUT\n - --period=5m\nEOF\n" - } - ], - "results": [ - { - "name": "leased-resource", - "type": "string", - "description": "The name of the leased resource" - } - ] - } - } - }, - "build-package-pingcap-tidb-darwin-g9k4f-build-binaries": { - "pipelineTaskName": "build-binaries", - "status": { - "conditions": [ - { - "type": "Succeeded", - "status": "True", - "lastTransitionTime": "2023-12-07T06:30:11Z", - "reason": "Succeeded", - "message": "All Steps have completed executing" - } - ], - "podName": "build-package-pingcap-tidb-darwin-g9k4f-build-binaries-pod", - "startTime": "2023-12-07T06:27:03Z", - "completionTime": "2023-12-07T06:30:11Z", - "steps": [ - { - "terminated": { - "exitCode": 0, - "reason": "Completed", - "startedAt": "2023-12-07T06:27:27Z", - "finishedAt": "2023-12-07T06:27:28Z", - "containerID": "containerd://ad6ad060e2d1b42c1a5f816e0271a3968d0385dace38e2646aad53ebf5a37d66" - }, - "name": "generate-build-script", - "container": "step-generate-build-script", - "imageID": "ghcr.io/pingcap-qe/cd/utils/release@sha256:a3819b92f2c78836bbe2f734e5ece968ed966717f735531d10fafad8d1f0ff89" - }, - { - "terminated": { - "exitCode": 0, - "reason": "Completed", - "startedAt": "2023-12-07T06:27:29Z", - "finishedAt": "2023-12-07T06:27:29Z", - "containerID": "containerd://c14124c747a4208193c984497cf771d954a2b993be2bbd24ed1072a589affd1e" - }, - "name": "prepare-remote-builder", - "container": "step-prepare-remote-builder", - "imageID": "ghcr.io/pingcap-qe/cd/utils/release@sha256:a3819b92f2c78836bbe2f734e5ece968ed966717f735531d10fafad8d1f0ff89" - }, - { - "terminated": { - "exitCode": 0, - "reason": "Completed", - "startedAt": "2023-12-07T06:27:29Z", - "finishedAt": "2023-12-07T06:30:00Z", - "containerID": "containerd://eeca8cdb857f192620ddf7b3d14c2e62cdad760b345a901f9b9c9169d4322f87" - }, - "name": "build", - "container": "step-build", - "imageID": "ghcr.io/pingcap-qe/cd/builders/tidb@sha256:328d64b5c5ec48676c32d0a5ce5fed43007cee076181e41fd22760c7c321dc17" - }, - { - "terminated": { - "exitCode": 0, - "reason": "Completed", - "startedAt": "2023-12-07T06:30:00Z", - "finishedAt": "2023-12-07T06:30:09Z", - "containerID": "containerd://f4651e41a3c59f67e4b6ff3f477f4aecab3606a7ac9de1ab042d259bcdd197a9" - }, - "name": "publish", - "container": "step-publish", - "imageID": "ghcr.io/pingcap-qe/cd/utils/release@sha256:a3819b92f2c78836bbe2f734e5ece968ed966717f735531d10fafad8d1f0ff89" - } - ], - "taskSpec": { - "params": [ - { - "name": "component", - "type": "string" - }, - { - "name": "os", - "type": "string", - "default": "linux" - }, - { - "name": "arch", - "type": "string", - "default": "amd64" - }, - { - "name": "version", - "type": "string", - "description": "the version to releasing." - }, - { - "name": "profile", - "type": "string", - "description": "supports: 'release' or 'debug'.\n", - "default": "release" - }, - { - "name": "git-ref", - "type": "string" - }, - { - "name": "git-sha", - "type": "string" - }, - { - "name": "builder-image", - "type": "string", - "default": "ghcr.io/pingcap-qe/cd/utils/release:5d33328" - }, - { - "name": "release-dir", - "type": "string", - "default": "build" - }, - { - "name": "push", - "type": "string", - "default": "false" - }, - { - "name": "mac-builder-resource", - "type": "string" - } - ], - "description": "Build binaries for the component.", - "steps": [ - { - "name": "generate-build-script", - "image": "ghcr.io/pingcap-qe/cd/utils/release:5d33328", - "resources": {}, - "script": "git clone --depth=1 --branch=main https://github.com/PingCAP-QE/artifacts.git /workspace/artifacts\n\ngit_ref=\"master\"\ngit_sha=\"be62f754fb4182a544b52b2f58a5f867136e7695\"\nif [ \"$git_sha\" == \"$git_ref\" ]; then\n git_sha=\"\"\nfi\n\nout_script=\"/workspace/build-package-artifacts.sh\"\n/workspace/artifacts/packages/scripts/gen-package-artifacts-with-config.sh \\\n tidb \\\n darwin \\\n arm64 \\\n v7.6.0-alpha-391-gbe62f754fb \\\n release \\\n $git_ref \\\n \"$git_sha\" \\\n /workspace/artifacts/packages/packages.yaml.tmpl \\\n \"$out_script\"\n\nif [ -f \"$out_script\" ]; then\n cat \"$out_script\"\nfi\n" - }, - { - "name": "prepare-remote-builder", - "image": "ghcr.io/pingcap-qe/cd/utils/release:5d33328", - "env": [ - { - "name": "WORKSPACE_SSH_DIRECTORY_BOUND", - "value": "$(workspaces.ssh-directory.bound)" - }, - { - "name": "WORKSPACE_SSH_DIRECTORY_PATH", - "value": "$(workspaces.ssh-directory.path)" - }, - { - "name": "REMOTE_BUILDER_INFO_DIR", - "value": "/workspace/remote-builder" - } - ], - "resources": {}, - "script": "#!/usr/bin/env bash\nset -exo pipefail\n\nif [ \"${WORKSPACE_SSH_DIRECTORY_BOUND}\" != \"true\" ] ; then\n exit 0\nfi\n\nif [ \"darwin\" != \"darwin\" ]; then\n exit 0\nfi\n\n\nif [ ! -f \"${WORKSPACE_SSH_DIRECTORY_PATH}/hosts.yaml\" ]; then\n echo \"No ~/.ssh/hosts.yaml found, we need it to get the address and other insecret configurations.\"\n exit 1\nfi\n\nwhich yq || (echo \"No yq tool found, I need it!\"; exit 1)\nmkdir -p \"$REMOTE_BUILDER_INFO_DIR\"\n\n######### checks and sets #########\nyq '.[\"darwin-arm64-1\"].host' \"${WORKSPACE_SSH_DIRECTORY_PATH}/hosts.yaml\" \u003e \"$REMOTE_BUILDER_INFO_DIR/ssh_host\"\nyq '.[\"darwin-arm64-1\"].config.workspace_dir' \"${WORKSPACE_SSH_DIRECTORY_PATH}/hosts.yaml\" \u003e \"$REMOTE_BUILDER_INFO_DIR/ssh_workspace\"\n# TODO: do more pre-check or pre-set.\n" - }, - { - "name": "build", - "image": "ghcr.io/pingcap-qe/cd/builders/tidb:v20231115-e1c4b43-go1.21", - "workingDir": "$(workspaces.source.path)", - "env": [ - { - "name": "WORKSPACE_SSH_DIRECTORY_BOUND", - "value": "$(workspaces.ssh-directory.bound)" - }, - { - "name": "WORKSPACE_SSH_DIRECTORY_PATH", - "value": "$(workspaces.ssh-directory.path)" - }, - { - "name": "MAC_MACHINE_RES_ID", - "value": "(params.mac-builder-resource)" - }, - { - "name": "REMOTE_BUILDER_INFO_DIR", - "value": "/workspace/remote-builder" - } - ], - "resources": {}, - "script": "#!/usr/bin/env bash\nset -exo pipefail\n\nscript=\"/workspace/build-package-artifacts.sh\"\nif [ ! -f \"$script\" ]; then\n echo \"No build script, skip build.\"\n exit 0\nfi\n\n##### Build mac targets in tekton task (k8s pod) ####\n# 1. Set ssh credentials\nif [ \"${WORKSPACE_SSH_DIRECTORY_BOUND}\" != \"true\" ] ; then\n echo \"❌: No ssh credential volume mounted, it's required!\"\n exit 1\nfi\ncp -R \"${WORKSPACE_SSH_DIRECTORY_PATH}\" ~/.ssh\nchmod 700 ~/.ssh\nchmod -R 400 ~/.ssh/*\nusername=$(cat ~/.ssh/username)\nhost=$(cat \"$REMOTE_BUILDER_INFO_DIR/ssh_host\")\nssh-keyscan -H $host \u003e\u003e ~/.ssh/known_hosts\nworkspace_base_dir=$(cat \"$REMOTE_BUILDER_INFO_DIR/ssh_workspace\")\n\n# 2. login to the remote builder with ssh and then execute the shell.\n# TODO: we need some pre-check scripts: such as get git version...\n\n# 2.1 create a randon workspace dir in the remote host:\nremote_workspace_dir=\"${workspace_base_dir}/$(uuidgen)\"\nssh ${username}@${host} \"mkdir -p '$remote_workspace_dir'\"\n\n# 2.2 copy the build shell to the remote host by ssh.\nscp \"\"$script\"\" ${username}@${host}:\"$remote_workspace_dir/\"\n\n# 2.3 copy source codes from workspace `source` to the remote host by ssh.\nscp -r $(workspaces.source.path) ${username}@${host}:\"$remote_workspace_dir/\"\nremote_workspace_source_path=\"$remote_workspace_dir/$(basename $(workspaces.source.path))\"\n\n# 2.4 run the shell on the mac host by ssh.\n# 2.4.1 optional get go builder in PATH env var, got the go version(x.y) from the current container with `go version`.\ngo_bin_path=\"\"\nif go version; then\n go_bin_path=\"/usr/local/$(go version | cut -d ' ' -f 3 | cut -d '.' -f -2)/bin\"\nfi\n\n# run remote build\nssh $username@$host -t \"bash -lc '\n PATH=${go_bin_path}:\\$PATH;\n cd \"$remote_workspace_source_path\";\n ${remote_workspace_dir}/build-package-artifacts.sh -b -a -w build\n'\"\n\n# 2.5 copy the artifacts from the mac hosts to the workspace `source`, we need delivery them internal firstly.\nscp -r ${username}@${host}:\"$remote_workspace_source_path/build\" ./\n\n# 3. clean the workspace dir(it will be a random name) on the ssh mac host.\nssh ${username}@${host} \"rm -rf '$remote_workspace_dir'\"\n" - }, - { - "name": "publish", - "image": "ghcr.io/pingcap-qe/cd/utils/release:5d33328", - "workingDir": "$(workspaces.source.path)", - "resources": {}, - "script": "script=\"/workspace/build-package-artifacts.sh\"\nif [ ! -f \"$script\" ]; then\n echo \"No build script, skip build.\"\n exit 0\nfi\n\noras version\n\"$script\" -p -w \"build\"\n" - } - ], - "workspaces": [ - { - "name": "source" - }, - { - "name": "dockerconfig", - "description": "Includes a docker `config.json`", - "mountPath": "/root/.docker", - "optional": true - }, - { - "name": "ssh-directory", - "description": "ssh credential for remote building on mac." - } - ], - "results": [ - { - "name": "package-artifacts", - "type": "string", - "description": "The package artifacts" - } - ] - } - } - }, - "build-package-pingcap-tidb-darwin-g9k4f-checkout": { - "pipelineTaskName": "checkout", - "status": { - "conditions": [ - { - "type": "Succeeded", - "status": "True", - "lastTransitionTime": "2023-12-07T06:26:29Z", - "reason": "Succeeded", - "message": "All Steps have completed executing" - } - ], - "podName": "build-package-pingcap-tidb-darwin-g9k4f-checkout-pod", - "startTime": "2023-12-07T06:25:30Z", - "completionTime": "2023-12-07T06:26:29Z", - "steps": [ - { - "terminated": { - "exitCode": 0, - "reason": "Completed", - "message": "[{\"key\":\"commit\",\"value\":\"be62f754fb4182a544b52b2f58a5f867136e7695\",\"type\":1},{\"key\":\"committer-date\",\"value\":\"1701930321\",\"type\":1},{\"key\":\"url\",\"value\":\"https://github.com/pingcap/tidb.git\",\"type\":1}]", - "startedAt": "2023-12-07T06:25:39Z", - "finishedAt": "2023-12-07T06:26:29Z", - "containerID": "containerd://0f3de6986b7ffc1ebc3c1a4c09bb3eb08f78c9b65b62787367bfecf41934a59e" - }, - "name": "clone", - "container": "step-clone", - "imageID": "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init@sha256:c0b0ed1cd81090ce8eecf60b936e9345089d9dfdb6ebdd2fd7b4a0341ef4f2b9" - } - ], - "taskResults": [ - { - "name": "commit", - "type": "string", - "value": "be62f754fb4182a544b52b2f58a5f867136e7695" - }, - { - "name": "committer-date", - "type": "string", - "value": "1701930321" - }, - { - "name": "url", - "type": "string", - "value": "https://github.com/pingcap/tidb.git" - } - ], - "taskSpec": { - "params": [ - { - "name": "url", - "type": "string", - "description": "Repository URL to clone from." - }, - { - "name": "revision", - "type": "string", - "description": "Revision to checkout. (branch, tag, sha, ref, etc...)", - "default": "" - }, - { - "name": "refspec", - "type": "string", - "description": "Refspec to fetch before checking out revision.", - "default": "" - }, - { - "name": "submodules", - "type": "string", - "description": "Initialize and fetch git submodules.", - "default": "true" - }, - { - "name": "depth", - "type": "string", - "description": "Perform a shallow clone, fetching only the most recent N commits.", - "default": "1" - }, - { - "name": "sslVerify", - "type": "string", - "description": "Set the `http.sslVerify` global git config. Setting this to `false` is not advised unless you are sure that you trust your git remote.", - "default": "true" - }, - { - "name": "crtFileName", - "type": "string", - "description": "file name of mounted crt using ssl-ca-directory workspace. default value is ca-bundle.crt.", - "default": "ca-bundle.crt" - }, - { - "name": "subdirectory", - "type": "string", - "description": "Subdirectory inside the `output` Workspace to clone the repo into.", - "default": "" - }, - { - "name": "sparseCheckoutDirectories", - "type": "string", - "description": "Define the directory patterns to match or exclude when performing a sparse checkout.", - "default": "" - }, - { - "name": "deleteExisting", - "type": "string", - "description": "Clean out the contents of the destination directory if it already exists before cloning.", - "default": "true" - }, - { - "name": "httpProxy", - "type": "string", - "description": "HTTP proxy server for non-SSL requests.", - "default": "" - }, - { - "name": "httpsProxy", - "type": "string", - "description": "HTTPS proxy server for SSL requests.", - "default": "" - }, - { - "name": "noProxy", - "type": "string", - "description": "Opt out of proxying HTTP/HTTPS requests.", - "default": "" - }, - { - "name": "verbose", - "type": "string", - "description": "Log the commands that are executed during `git-clone`'s operation.", - "default": "true" - }, - { - "name": "gitInitImage", - "type": "string", - "description": "The image providing the git-init binary that this Task runs.", - "default": "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init:v0.29.0" - }, - { - "name": "userHome", - "type": "string", - "description": "Absolute path to the user's home directory. Set this explicitly if you are running the image as a non-root user or have overridden\nthe gitInitImage param with an image containing custom user configuration.\n", - "default": "/tekton/home" - } - ], - "description": "These Tasks are Git tasks to work with repositories used by other tasks in your Pipeline.\nThe git-clone Task will clone a repo from the provided url into the output Workspace. By default the repo will be cloned into the root of your Workspace. You can clone into a subdirectory by setting this Task's subdirectory param. This Task also supports sparse checkouts. To perform a sparse checkout, pass a list of comma separated directory patterns to this Task's sparseCheckoutDirectories param.", - "steps": [ - { - "name": "clone", - "image": "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init:v0.29.0", - "env": [ - { - "name": "HOME", - "value": "/tekton/home" - }, - { - "name": "PARAM_URL", - "value": "https://github.com/pingcap/tidb.git" - }, - { - "name": "PARAM_REVISION", - "value": "be62f754fb4182a544b52b2f58a5f867136e7695" - }, - { - "name": "PARAM_REFSPEC", - "value": "+refs/heads/*:refs/remotes/origin/*" - }, - { - "name": "PARAM_SUBMODULES", - "value": "true" - }, - { - "name": "PARAM_DEPTH", - "value": "0" - }, - { - "name": "PARAM_SSL_VERIFY", - "value": "true" - }, - { - "name": "PARAM_CRT_FILENAME", - "value": "ca-bundle.crt" - }, - { - "name": "PARAM_SUBDIRECTORY" - }, - { - "name": "PARAM_DELETE_EXISTING", - "value": "true" - }, - { - "name": "PARAM_HTTP_PROXY" - }, - { - "name": "PARAM_HTTPS_PROXY" - }, - { - "name": "PARAM_NO_PROXY" - }, - { - "name": "PARAM_VERBOSE", - "value": "true" - }, - { - "name": "PARAM_SPARSE_CHECKOUT_DIRECTORIES" - }, - { - "name": "PARAM_USER_HOME", - "value": "/tekton/home" - }, - { - "name": "WORKSPACE_OUTPUT_PATH", - "value": "$(workspaces.output.path)" - }, - { - "name": "WORKSPACE_SSH_DIRECTORY_BOUND", - "value": "$(workspaces.ssh-directory.bound)" - }, - { - "name": "WORKSPACE_SSH_DIRECTORY_PATH", - "value": "$(workspaces.ssh-directory.path)" - }, - { - "name": "WORKSPACE_BASIC_AUTH_DIRECTORY_BOUND", - "value": "$(workspaces.basic-auth.bound)" - }, - { - "name": "WORKSPACE_BASIC_AUTH_DIRECTORY_PATH", - "value": "$(workspaces.basic-auth.path)" - }, - { - "name": "WORKSPACE_SSL_CA_DIRECTORY_BOUND", - "value": "$(workspaces.ssl-ca-directory.bound)" - }, - { - "name": "WORKSPACE_SSL_CA_DIRECTORY_PATH", - "value": "$(workspaces.ssl-ca-directory.path)" - }, - { - "name": "GIT_SSH_COMMAND", - "value": "ssh -o StrictHostKeyChecking=accept-new" - } - ], - "resources": {}, - "script": "#!/usr/bin/env sh\nset -eu\n\nif [ \"${PARAM_VERBOSE}\" = \"true\" ] ; then\n set -x\nfi\n\nif [ \"${WORKSPACE_BASIC_AUTH_DIRECTORY_BOUND}\" = \"true\" ] ; then\n cp \"${WORKSPACE_BASIC_AUTH_DIRECTORY_PATH}/.git-credentials\" \"${PARAM_USER_HOME}/.git-credentials\"\n cp \"${WORKSPACE_BASIC_AUTH_DIRECTORY_PATH}/.gitconfig\" \"${PARAM_USER_HOME}/.gitconfig\"\n chmod 400 \"${PARAM_USER_HOME}/.git-credentials\"\n chmod 400 \"${PARAM_USER_HOME}/.gitconfig\"\nfi\n\nif [ \"${WORKSPACE_SSH_DIRECTORY_BOUND}\" = \"true\" ] ; then\n cp -R \"${WORKSPACE_SSH_DIRECTORY_PATH}\" \"${PARAM_USER_HOME}\"/.ssh\n chmod 700 \"${PARAM_USER_HOME}\"/.ssh\n chmod -R 400 \"${PARAM_USER_HOME}\"/.ssh/*\nfi\n\nif [ \"${WORKSPACE_SSL_CA_DIRECTORY_BOUND}\" = \"true\" ] ; then\n export GIT_SSL_CAPATH=\"${WORKSPACE_SSL_CA_DIRECTORY_PATH}\"\n if [ \"${PARAM_CRT_FILENAME}\" != \"\" ] ; then\n export GIT_SSL_CAINFO=\"${WORKSPACE_SSL_CA_DIRECTORY_PATH}/${PARAM_CRT_FILENAME}\"\n fi\nfi\nCHECKOUT_DIR=\"${WORKSPACE_OUTPUT_PATH}/${PARAM_SUBDIRECTORY}\"\n\ncleandir() {\n # Delete any existing contents of the repo directory if it exists.\n #\n # We don't just \"rm -rf ${CHECKOUT_DIR}\" because ${CHECKOUT_DIR} might be \"/\"\n # or the root of a mounted volume.\n if [ -d \"${CHECKOUT_DIR}\" ] ; then\n # Delete non-hidden files and directories\n rm -rf \"${CHECKOUT_DIR:?}\"/*\n # Delete files and directories starting with . but excluding ..\n rm -rf \"${CHECKOUT_DIR}\"/.[!.]*\n # Delete files and directories starting with .. plus any other character\n rm -rf \"${CHECKOUT_DIR}\"/..?*\n fi\n}\n\nif [ \"${PARAM_DELETE_EXISTING}\" = \"true\" ] ; then\n cleandir || true\nfi\n\ntest -z \"${PARAM_HTTP_PROXY}\" || export HTTP_PROXY=\"${PARAM_HTTP_PROXY}\"\ntest -z \"${PARAM_HTTPS_PROXY}\" || export HTTPS_PROXY=\"${PARAM_HTTPS_PROXY}\"\ntest -z \"${PARAM_NO_PROXY}\" || export NO_PROXY=\"${PARAM_NO_PROXY}\"\n\ngit config --global --add safe.directory \"${WORKSPACE_OUTPUT_PATH}\"\n/ko-app/git-init \\\n -url=\"${PARAM_URL}\" \\\n -revision=\"${PARAM_REVISION}\" \\\n -refspec=\"${PARAM_REFSPEC}\" \\\n -path=\"${CHECKOUT_DIR}\" \\\n -sslVerify=\"${PARAM_SSL_VERIFY}\" \\\n -submodules=\"${PARAM_SUBMODULES}\" \\\n -depth=\"${PARAM_DEPTH}\" \\\n -sparseCheckoutDirectories=\"${PARAM_SPARSE_CHECKOUT_DIRECTORIES}\"\ncd \"${CHECKOUT_DIR}\"\nRESULT_SHA=\"$(git rev-parse HEAD)\"\nEXIT_CODE=\"$?\"\nif [ \"${EXIT_CODE}\" != 0 ] ; then\n exit \"${EXIT_CODE}\"\nfi\nRESULT_COMMITTER_DATE=\"$(git log -1 --pretty=%ct)\"\nprintf \"%s\" \"${RESULT_COMMITTER_DATE}\" \u003e \"/tekton/results/committer-date\"\nprintf \"%s\" \"${RESULT_SHA}\" \u003e \"/tekton/results/commit\"\nprintf \"%s\" \"${PARAM_URL}\" \u003e \"/tekton/results/url\"\n" - } - ], - "workspaces": [ - { - "name": "output", - "description": "The git repo will be cloned onto the volume backing this Workspace." - }, - { - "name": "ssh-directory", - "description": "A .ssh directory with private key, known_hosts, config, etc. Copied to\nthe user's home before git commands are executed. Used to authenticate\nwith the git remote when performing the clone. Binding a Secret to this\nWorkspace is strongly recommended over other volume types.\n", - "optional": true - }, - { - "name": "basic-auth", - "description": "A Workspace containing a .gitconfig and .git-credentials file. These\nwill be copied to the user's home before any git commands are run. Any\nother files in this Workspace are ignored. It is strongly recommended\nto use ssh-directory over basic-auth whenever possible and to bind a\nSecret to this Workspace over other volume types.\n", - "optional": true - }, - { - "name": "ssl-ca-directory", - "description": "A workspace containing CA certificates, this will be used by Git to\nverify the peer with when fetching or pushing over HTTPS.\n", - "optional": true - } - ], - "results": [ - { - "name": "commit", - "type": "string", - "description": "The precise commit SHA that was fetched by this Task." - }, - { - "name": "url", - "type": "string", - "description": "The precise URL that was fetched by this Task." - }, - { - "name": "committer-date", - "type": "string", - "description": "The epoch timestamp of the commit that was fetched by this Task." - } - ] - } - } - }, - "build-package-pingcap-tidb-darwin-g9k4f-get-release-ver": { - "pipelineTaskName": "get-release-ver", - "status": { - "conditions": [ - { - "type": "Succeeded", - "status": "True", - "lastTransitionTime": "2023-12-07T06:27:03Z", - "reason": "Succeeded", - "message": "All Steps have completed executing" - } - ], - "podName": "build-package-pingcap-tidb-darwin-g9k4f-get-release-ver-pod", - "startTime": "2023-12-07T06:26:29Z", - "completionTime": "2023-12-07T06:27:03Z", - "steps": [ - { - "terminated": { - "exitCode": 0, - "reason": "Completed", - "message": "[{\"key\":\"version\",\"value\":\"v7.6.0-alpha-391-gbe62f754fb\",\"type\":1}]", - "startedAt": "2023-12-07T06:26:58Z", - "finishedAt": "2023-12-07T06:27:02Z", - "containerID": "containerd://1cff6503e23d0b2eb85c1bd4e75187d2d2d4051c7a5d9927befd5ba4e9e104dd" - }, - "name": "git-describe", - "container": "step-git-describe", - "imageID": "docker.io/alpine/git@sha256:9a2947ae3651a9db60411eabb254fab595ee7fbd37817020ff7e43f0f2c463e3" - } - ], - "taskResults": [ - { - "name": "version", - "type": "string", - "value": "v7.6.0-alpha-391-gbe62f754fb" - } - ], - "taskSpec": { - "steps": [ - { - "name": "git-describe", - "image": "alpine/git:2.40.1", - "workingDir": "$(workspaces.source.path)", - "resources": {}, - "script": "RESULT_VERSION=\"$(git describe --tags --always --dirty)\"\nprintf \"%s\" \"${RESULT_VERSION}\" \u003e /tekton/results/version\n" - } - ], - "workspaces": [ - { - "name": "source" - } - ], - "results": [ - { - "name": "version", - "type": "string", - "description": "The release version of the git repo" - } - ] - } - } + "steps": [ + { + "image": "alpine/git:2.40.1", + "name": "git-describe", + "resources": { + "requests": { + "cpu": "100m", + "memory": "512Mi" + } }, - "build-package-pingcap-tidb-darwin-g9k4f-release-mac-machine": { - "pipelineTaskName": "release-mac-machine", - "status": { - "conditions": [ - { - "type": "Succeeded", - "status": "True", - "lastTransitionTime": "2023-12-07T06:30:55Z", - "reason": "Succeeded", - "message": "All Steps have completed executing" - } - ], - "podName": "build-package-pingcap-tidb-darwin-g9k4f-release-mac-machine-pod", - "startTime": "2023-12-07T06:30:15Z", - "completionTime": "2023-12-07T06:30:55Z", - "steps": [ - { - "terminated": { - "exitCode": 0, - "reason": "Completed", - "startedAt": "2023-12-07T06:30:21Z", - "finishedAt": "2023-12-07T06:30:21Z", - "containerID": "containerd://0bb42aa6888600eecd12d92b55a9747154c00767b1d9de7a8bf2f63700d59195" - }, - "name": "boskosctl-release", - "container": "step-boskosctl-release", - "imageID": "gcr.io/k8s-staging-boskos/boskosctl@sha256:a7fc984732c5dd0b4e0fe0a92e2730fa4b6bddecd0f6f6c7c6b5501abe4ab105" - }, - { - "terminated": { - "exitCode": 0, - "reason": "Completed", - "startedAt": "2023-12-07T06:30:21Z", - "finishedAt": "2023-12-07T06:30:52Z", - "containerID": "containerd://6a8fb4eddc6359844724bf1ee548d9fa5a21053f0fe095737e0c8a1a73902712" - }, - "name": "stop-boskosctl-heartbeat", - "container": "step-stop-boskosctl-heartbeat", - "imageID": "docker.io/lachlanevenson/k8s-kubectl@sha256:3a5e22a406a109f4f26ec06b5f1f6a66ae0cd0e185bc28499eb7b7a3bbf1fe09" - } - ], - "taskSpec": { - "params": [ - { - "name": "server-url", - "type": "string", - "description": "The URL of the running boskos server", - "default": "http://boskos.test-pods.svc.cluster.local" - }, - { - "name": "leased-resource", - "type": "string", - "description": "A string that identifies the leased resource to release." - }, - { - "name": "owner-name", - "type": "string", - "description": "A string that identifies the owner of the leased resource to request." - } - ], - "description": "Release a project acquired using Boskos.\n\nThe boskos-release Task will release the specified resource from the boskos instance\nat server-url. It also assumes the resource was obtained via boskos-acquire and so\nterminates the heartbeat pod that was created by that Task to keep the resource obtained.\nIt will mark the resource as dirty so that the boskos Janitor will clean it (by deleting\nany state created).\n", - "steps": [ - { - "name": "boskosctl-release", - "image": "gcr.io/k8s-staging-boskos/boskosctl@sha256:a7fc984732c5dd0b4e0fe0a92e2730fa4b6bddecd0f6f6c7c6b5501abe4ab105", - "args": [ - "release", - "--server-url=http://boskos.apps.svc", - "--owner-name=build-package-pingcap-tidb-darwin-g9k4f", - "--name=darwin-arm64-1", - "--target-state=dirty" - ], - "resources": {} - }, - { - "name": "stop-boskosctl-heartbeat", - "image": "docker.io/lachlanevenson/k8s-kubectl@sha256:3a5e22a406a109f4f26ec06b5f1f6a66ae0cd0e185bc28499eb7b7a3bbf1fe09", - "args": [ - "delete", - "pod", - "boskos-heartbeat-darwin-arm64-1" - ], - "resources": {} - } - ] - } - } - } - }, - "pipelineSpec": { - "tasks": [ - { - "name": "checkout", - "taskRef": { - "name": "git-clone", - "kind": "Task" - }, - "retries": 3, - "params": [ - { - "name": "url", - "value": "https://github.com/pingcap/tidb.git" - }, - { - "name": "revision", - "value": "be62f754fb4182a544b52b2f58a5f867136e7695" - }, - { - "name": "depth", - "value": "0" - }, - { - "name": "refspec", - "value": "+refs/heads/*:refs/remotes/origin/*" - } - ], - "workspaces": [ - { - "name": "output", - "workspace": "source" - }, - { - "name": "basic-auth", - "workspace": "git-basic-auth" - } - ] - }, - { - "name": "get-release-ver", - "taskSpec": { - "spec": null, - "metadata": {}, - "steps": [ - { - "name": "git-describe", - "image": "alpine/git:2.40.1", - "workingDir": "$(workspaces.source.path)", - "resources": {}, - "script": "RESULT_VERSION=\"$(git describe --tags --always --dirty)\"\nprintf \"%s\" \"${RESULT_VERSION}\" \u003e $(results.version.path)\n" - } - ], - "workspaces": [ - { - "name": "source" - } - ], - "results": [ - { - "name": "version", - "type": "string", - "description": "The release version of the git repo" - } - ] - }, - "runAfter": [ - "checkout" - ], - "workspaces": [ - { - "name": "source", - "workspace": "source" - } - ] - }, - { - "name": "acquire-mac-machine", - "taskRef": { - "name": "boskos-acquire", - "kind": "Task" - }, - "retries": 5, - "params": [ - { - "name": "server-url", - "value": "http://boskos.apps.svc" - }, - { - "name": "type", - "value": "mac-machine-arm64" - }, - { - "name": "owner-name", - "value": "build-package-pingcap-tidb-darwin-g9k4f" - } - ] - }, - { - "name": "build-binaries", - "taskRef": { - "name": "pingcap-build-binaries-darwin", - "kind": "Task" - }, - "params": [ - { - "name": "os", - "value": "darwin" - }, - { - "name": "arch", - "value": "arm64" - }, - { - "name": "profile", - "value": "release" - }, - { - "name": "component", - "value": "tidb" - }, - { - "name": "version", - "value": "$(tasks.get-release-ver.results.version)" - }, - { - "name": "git-ref", - "value": "master" - }, - { - "name": "git-sha", - "value": "be62f754fb4182a544b52b2f58a5f867136e7695" - }, - { - "name": "builder-image", - "value": "ghcr.io/pingcap-qe/cd/builders/tidb:v20231115-e1c4b43-go1.21" - }, - { - "name": "release-dir", - "value": "build" - }, - { - "name": "push", - "value": "true" - }, - { - "name": "mac-builder-resource", - "value": "$(tasks.acquire-mac-machine.results.leased-resource)" - } - ], - "workspaces": [ - { - "name": "source", - "workspace": "source" - }, - { - "name": "dockerconfig", - "workspace": "dockerconfig" - }, - { - "name": "ssh-directory", - "workspace": "mac-ssh-credentials" - } - ] - } - ], - "params": [ - { - "name": "git-url", - "type": "string" - }, - { - "name": "git-ref", - "type": "string", - "default": "master" - }, - { - "name": "git-revision", - "type": "string", - "default": "master" - }, - { - "name": "component", - "type": "string", - "description": "compoent name, supports:\n- tidb\n- tikv\n- pd\n- tiflash\n- tiflow\n- advanced-statefulset\n\nMay be it is an idea to judge it by git-url, but it maybe \nnot a generic way for forked repositories with custom names.\n" - }, - { - "name": "arch", - "type": "string", - "default": "amd64" - }, - { - "name": "profile", - "type": "string", - "default": "release" - }, - { - "name": "binary-builder-iamge", - "type": "string", - "description": "The image used to build binaries.", - "default": "ghcr.io/pingcap-qe/cd/utils/release:5d33328" - }, - { - "name": "push", - "type": "string", - "default": "true" - } - ], - "workspaces": [ - { - "name": "source", - "description": "The workspace where the git repo will be cloned." - }, - { - "name": "dockerconfig", - "description": "Includes a docker `config.json`" - }, - { - "name": "git-basic-auth", - "description": "secret containing a .gitconfig and .git-credentials file.", - "optional": true - }, - { - "name": "mac-ssh-credentials", - "description": "secret contains ssh private key in `id_rsa` key for login mac" - } - ], - "finally": [ - { - "name": "release-mac-machine", - "taskRef": { - "name": "boskos-release", - "kind": "Task" - }, - "params": [ - { - "name": "server-url", - "value": "http://boskos.apps.svc" - }, - { - "name": "leased-resource", - "value": "$(tasks.acquire-mac-machine.results.leased-resource)" - }, - { - "name": "owner-name", - "value": "build-package-pingcap-tidb-darwin-g9k4f" - } - ] - } - ] - } + "script": "RESULT_VERSION=\"$(git describe --tags --always --dirty --exclude 'v20[0-9][0-9].[0-1][0-9].[0-3][0-9]*')\"\nprintf \"%s\" \"${RESULT_VERSION}\" > /tekton/results/version\n", + "workingDir": "$(workspaces.source.path)" + } + ], + "workspaces": [ + { + "name": "source" + } + ] + } } + } } + } } + } } diff --git a/cloudevents-server/pkg/events/custom/tekton/testdata/event-taskrun.successful.json b/cloudevents-server/pkg/events/custom/tekton/testdata/event-taskrun.successful.json index df1d3d3..9247f54 100644 --- a/cloudevents-server/pkg/events/custom/tekton/testdata/event-taskrun.successful.json +++ b/cloudevents-server/pkg/events/custom/tekton/testdata/event-taskrun.successful.json @@ -9,255 +9,316 @@ "data": { "taskRun": { "metadata": { - "name": "auto-compose-multi-arch-image-run-zc8jc-collect-and-push", - "namespace": "ee-cd", - "uid": "c11bdd84-9f8b-4043-a934-82886c40fe01", - "resourceVersion": "2432973329", + "annotations": { + "pipeline.tekton.dev/release": "a34ad6b-dirty", + "tekton.dev/ce-context": "{}", + "tekton.dev/git-repo": "https://github.com/pingcap/tidb.git", + "tekton.dev/git-revision": "799a46107ec9fb7dd19c0734f9a4e8da2a3d29ff", + "tekton.dev/git-status": "true", + "tekton.dev/platforms": "linux/amd64,linux/arm64", + "tekton.dev/status-target-url": "https://do.pingcap.net/tekton/#/namespaces/{{ .Namespace }}/pipelineruns/{{ .Name }}" + }, + "creationTimestamp": "2024-01-25T15:11:41Z", "generation": 1, - "creationTimestamp": "2023-12-07T06:33:25Z", "labels": { "app.kubernetes.io/managed-by": "tekton-pipelines", + "app.kubernetes.io/version": "0.1", "kustomize.toolkit.fluxcd.io/name": "tekton-configs", "kustomize.toolkit.fluxcd.io/namespace": "apps", "tekton.dev/memberOf": "tasks", - "tekton.dev/pipeline": "auto-compose-multi-arch-image", - "tekton.dev/pipelineRun": "auto-compose-multi-arch-image-run-zc8jc", - "tekton.dev/pipelineTask": "collect-and-push", - "tekton.dev/task": "multi-arch-image-collect", - "triggers.tekton.dev/eventlistener": "trigger-groups-listener", - "triggers.tekton.dev/trigger": "image-push-on-harbor", - "triggers.tekton.dev/triggers-eventid": "8d56c7dc-5523-49a8-9c86-6ea43d355528" - }, - "annotations": { - "pipeline.tekton.dev/release": "19940f2", - "results.tekton.dev/record": "ee-cd/results/8d56c7dc-5523-49a8-9c86-6ea43d355528/records/c11bdd84-9f8b-4043-a934-82886c40fe01", - "results.tekton.dev/result": "ee-cd/results/8d56c7dc-5523-49a8-9c86-6ea43d355528" + "tekton.dev/pipeline": "pingcap-build-package", + "tekton.dev/pipelineRun": "build-package-tidb-linux-amd64-nmjrj", + "tekton.dev/pipelineTask": "build-binaries", + "tekton.dev/task": "pingcap-build-binaries", + "triggers.tekton.dev/eventlistener": "public", + "triggers.tekton.dev/trigger": "git-push-pingcap-tidb", + "triggers.tekton.dev/triggers-eventid": "8cc589a5-2236-464f-90e4-5b8ac26e68c8" }, + "name": "build-package-tidb-linux-amd64-nmjrj-build-binaries", + "namespace": "ee-cd", "ownerReferences": [ { "apiVersion": "tekton.dev/v1beta1", - "kind": "PipelineRun", - "name": "auto-compose-multi-arch-image-run-zc8jc", - "uid": "efd38cad-80cf-4a7c-b96b-268252881c9a", + "blockOwnerDeletion": true, "controller": true, - "blockOwnerDeletion": true + "kind": "PipelineRun", + "name": "build-package-tidb-linux-amd64-nmjrj", + "uid": "7e938f27-895c-46a3-b682-e1e6ae2cb131" } ], - "managedFields": [ - { - "manager": "Go-http-client", - "operation": "Update", - "apiVersion": "tekton.dev/v1beta1", - "time": "2023-12-07T06:33:25Z", - "fieldsType": "FieldsV1", - "fieldsV1": { - "f:metadata": { - "f:annotations": { - ".": {}, - "f:pipeline.tekton.dev/release": {} - }, - "f:labels": { - ".": {}, - "f:kustomize.toolkit.fluxcd.io/name": {}, - "f:kustomize.toolkit.fluxcd.io/namespace": {}, - "f:tekton.dev/memberOf": {}, - "f:tekton.dev/pipeline": {}, - "f:tekton.dev/pipelineRun": {}, - "f:tekton.dev/pipelineTask": {}, - "f:tekton.dev/task": {}, - "f:triggers.tekton.dev/eventlistener": {}, - "f:triggers.tekton.dev/trigger": {}, - "f:triggers.tekton.dev/triggers-eventid": {} - }, - "f:ownerReferences": { - ".": {}, - "k:{\"uid\":\"efd38cad-80cf-4a7c-b96b-268252881c9a\"}": { - ".": {}, - "f:apiVersion": {}, - "f:blockOwnerDeletion": {}, - "f:controller": {}, - "f:kind": {}, - "f:name": {}, - "f:uid": {} - } - } - }, - "f:spec": { - ".": {}, - "f:params": {}, - "f:podTemplate": { - ".": {}, - "f:nodeSelector": { - ".": {}, - "f:enable-ci": {} - }, - "f:tolerations": {} - }, - "f:resources": {}, - "f:serviceAccountName": {}, - "f:taskRef": { - ".": {}, - "f:kind": {}, - "f:name": {} - }, - "f:timeout": {}, - "f:workspaces": {} - }, - "f:status": { - ".": {}, - "f:conditions": {}, - "f:podName": {}, - "f:startTime": {}, - "f:steps": {}, - "f:taskSpec": { - ".": {}, - "f:description": {}, - "f:params": {}, - "f:results": {}, - "f:steps": {}, - "f:workspaces": {} - } - } - } - }, - { - "manager": "watcher", - "operation": "Update", - "apiVersion": "tekton.dev/v1beta1", - "time": "2023-12-07T06:33:25Z", - "fieldsType": "FieldsV1", - "fieldsV1": { - "f:metadata": { - "f:annotations": { - "f:results.tekton.dev/record": {}, - "f:results.tekton.dev/result": {} - } - } - } - } - ] + "resourceVersion": "2676164142", + "uid": "c00e5eba-7d95-47af-80cb-1868ab92bd11" }, "spec": { "params": [ { - "name": "image_url", - "value": "hub.pingcap.net/pingcap/tidb/images/tidb-lightning:master-be62f75-release_linux_arm64" + "name": "os", + "value": "linux" + }, + { + "name": "arch", + "value": "amd64" }, { - "name": "release_tag_suffix", + "name": "profile", "value": "release" + }, + { + "name": "component", + "value": "tidb" + }, + { + "name": "version", + "value": "v8.0.0-alpha-120-g799a46107e" + }, + { + "name": "git-ref", + "value": "master" + }, + { + "name": "git-sha", + "value": "799a46107ec9fb7dd19c0734f9a4e8da2a3d29ff" + }, + { + "name": "builder-image", + "value": "ghcr.io/pingcap-qe/cd/builders/tidb:v20231115-e1c4b43-go1.21" + }, + { + "name": "release-dir", + "value": "build" + }, + { + "name": "push", + "value": "true" } ], - "resources": {}, - "serviceAccountName": "default", - "taskRef": { - "name": "multi-arch-image-collect", - "kind": "Task" - }, - "timeout": "59m59.988451875s", "podTemplate": { "nodeSelector": { - "enable-ci": "true" + "kubernetes.io/arch": "amd64" }, "tolerations": [ { + "effect": "NoSchedule", "key": "dedicated", "operator": "Equal", - "value": "test-infra", - "effect": "NoSchedule" + "value": "test-infra" } ] }, + "resources": {}, + "serviceAccountName": "default", + "stepOverrides": [ + { + "name": "build", + "resources": { + "requests": { + "cpu": "8", + "memory": "32Gi" + } + } + } + ], + "taskRef": { + "kind": "Task", + "name": "pingcap-build-binaries" + }, + "timeout": "27m47.854381262s", "workspaces": [ + { + "name": "source", + "persistentVolumeClaim": { + "claimName": "pvc-56629b401e" + } + }, { "name": "dockerconfig", "secret": { "secretName": "hub-pingcap-net-ee" } + }, + { + "name": "cargo-home", + "persistentVolumeClaim": { + "claimName": "cargo-home" + } } ] }, "status": { + "completionTime": "2024-01-25T15:16:58Z", "conditions": [ { - "type": "Succeeded", - "status": "True", - "lastTransitionTime": "2023-12-07T06:34:54Z", + "lastTransitionTime": "2024-01-25T15:16:58Z", + "message": "All Steps have completed executing", "reason": "Succeeded", - "message": "All Steps have completed executing" + "status": "True", + "type": "Succeeded" } ], - "podName": "auto-compose-multi-arch-image-run-zc8jc-collect-and-push-pod", - "startTime": "2023-12-07T06:33:25Z", - "completionTime": "2023-12-07T06:34:54Z", + "podName": "build-package-tidb-linux-amd64-nmjrj-build-binaries-pod", + "startTime": "2024-01-25T15:11:41Z", "steps": [ { + "container": "step-generate-build-script", + "imageID": "ghcr.io/pingcap-qe/cd/utils/release@sha256:eb2fa80b95d41fd1ed7e7de5bb482d33e38b89e968993f39150e1f3cf71d9d14", + "name": "generate-build-script", "terminated": { + "containerID": "containerd://e06fa4bdceca4cc0aff66a31fe3b21c7e67888b391e5876903e3d39030bac693", "exitCode": 0, + "finishedAt": "2024-01-25T15:12:10Z", "reason": "Completed", - "message": "[{\"key\":\"repo\",\"value\":\"\",\"type\":1},{\"key\":\"tags\",\"value\":\"\",\"type\":1}]", - "startedAt": "2023-12-07T06:33:29Z", - "finishedAt": "2023-12-07T06:34:53Z", - "containerID": "containerd://95ca9c8dbaf07e02b9b756f1ee2bd14fa5096bb94ae3a648b7ce50f2e33bb8e3" - }, - "name": "prepare-manifest", - "container": "step-prepare-manifest", - "imageID": "ghcr.io/pingcap-qe/cd/utils/release@sha256:55c3127c8f14affb633b97365457c86e69f260da52c6698d25c8955b26a06b4d" + "startedAt": "2024-01-25T15:12:08Z" + } + }, + { + "container": "step-build", + "imageID": "ghcr.io/pingcap-qe/cd/builders/tidb@sha256:328d64b5c5ec48676c32d0a5ce5fed43007cee076181e41fd22760c7c321dc17", + "name": "build", + "terminated": { + "containerID": "containerd://09aa6613be28e25d0a542f187ff9bb4a65f06c6246ddb4df2d1def17d69f4df6", + "exitCode": 0, + "finishedAt": "2024-01-25T15:16:43Z", + "reason": "Completed", + "startedAt": "2024-01-25T15:12:10Z" + } + }, + { + "container": "step-publish", + "imageID": "ghcr.io/pingcap-qe/cd/utils/release@sha256:eb2fa80b95d41fd1ed7e7de5bb482d33e38b89e968993f39150e1f3cf71d9d14", + "name": "publish", + "terminated": { + "containerID": "containerd://8c4eb08e40a7f6baf4ab74f9a8f44188d84fe27f4270d81ccc1a130a26987963", + "exitCode": 0, + "finishedAt": "2024-01-25T15:16:57Z", + "message": "[{\"key\":\"pushed\",\"value\":\"oci:\\n repo: hub.pingcap.net/pingcap/tidb/package\\n tag: \\\"master-799a461_linux_amd64\\\"\\n digest: \\\"sha256:51299c4c53e252e0e5d4c67cbf1eccdcce21dfb7a719a5dd44c0114592e7eb40\\\"\\nfiles:\\n - tidb-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz\\n - tidb-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz.sha256\\n - br-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz\\n - br-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz.sha256\\n - dumpling-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz\\n - dumpling-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz.sha256\\n - tidb-lightning-ctl-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz\\n - tidb-lightning-ctl-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz.sha256\\n - tidb-lightning-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz\\n - tidb-lightning-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz.sha256\\n\",\"type\":1}]", + "reason": "Completed", + "startedAt": "2024-01-25T15:16:44Z" + } } ], "taskResults": [ { - "name": "repo", + "name": "pushed", "type": "string", - "value": "" - }, - { - "name": "tags", - "type": "string", - "value": "" + "value": "oci:\n repo: hub.pingcap.net/pingcap/tidb/package\n tag: \"master-799a461_linux_amd64\"\n digest: \"sha256:51299c4c53e252e0e5d4c67cbf1eccdcce21dfb7a719a5dd44c0114592e7eb40\"\nfiles:\n - tidb-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz\n - tidb-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz.sha256\n - br-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz\n - br-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz.sha256\n - dumpling-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz\n - dumpling-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz.sha256\n - tidb-lightning-ctl-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz\n - tidb-lightning-ctl-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz.sha256\n - tidb-lightning-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz\n - tidb-lightning-v8.0.0-alpha-120-g799a46107e-linux-amd64.tar.gz.sha256\n" } ], "taskSpec": { + "description": "Build binaries for the component.", "params": [ { - "name": "image_url", - "type": "string", - "description": "The full url of the pushed image, contain the tag part.\nIt will parse the repo from it.\n" + "name": "component", + "type": "string" + }, + { + "default": "linux", + "name": "os", + "type": "string" + }, + { + "default": "amd64", + "name": "arch", + "type": "string" + }, + { + "description": "the version to releasing.", + "name": "version", + "type": "string" + }, + { + "default": "release", + "description": "supports: 'release' or 'debug'.\n", + "name": "profile", + "type": "string" + }, + { + "name": "git-ref", + "type": "string" + }, + { + "name": "git-sha", + "type": "string" + }, + { + "default": "ghcr.io/pingcap-qe/cd/utils/release:v20231216-37-g8e0ca7e", + "name": "builder-image", + "type": "string" + }, + { + "default": "build", + "name": "release-dir", + "type": "string" + }, + { + "default": "false", + "name": "push", + "type": "string" }, { - "name": "release_tag_suffix", - "type": "string", - "default": "release" + "default": "", + "name": "mac-builder-resource", + "type": "string" + } + ], + "results": [ + { + "description": "Just built and pushed artifacts, it will be a yaml content.", + "name": "pushed", + "type": "string" } ], - "description": "The working flow:\n1. list the tags for the repo.\n2. filter the single arch tags.\n3. get the digest of the tags.\n4. the tags should follow the standard format:\n - master-00595b4-release_linux_amd64 =\u003e master-00595b4-release =\u003e master-00595b4 =\u003e master\n - master-00595b4-release-linux-arm64 =\u003e master-00595b4-release =\u003e master-00595b4 =\u003e master\n - master-00595b4-release_arm64 =\u003e master-00595b4-release =\u003e master-00595b4 =\u003e master\n - master-00595b4-release-arm64 =\u003e master-00595b4-release =\u003e master-00595b4 =\u003e master\n", "steps": [ { - "name": "prepare-manifest", - "image": "ghcr.io/pingcap-qe/cd/utils/release:bcb089f", - "workingDir": "/workspace", + "image": "ghcr.io/pingcap-qe/cd/utils/release:v20231216-37-g8e0ca7e", + "name": "generate-build-script", + "resources": {}, + "script": "git clone --depth=1 --branch=main https://github.com/PingCAP-QE/artifacts.git /workspace/artifacts\n\ngit_ref=\"master\"\ngit_sha=\"799a46107ec9fb7dd19c0734f9a4e8da2a3d29ff\"\nif [ \"$git_sha\" == \"$git_ref\" ]; then\n git_sha=\"\"\nfi\n\nout_script=\"/workspace/build-package-artifacts.sh\"\n/workspace/artifacts/packages/scripts/gen-package-artifacts-with-config.sh \\\n tidb \\\n linux \\\n amd64 \\\n v8.0.0-alpha-120-g799a46107e \\\n release \\\n $git_ref \\\n \"$git_sha\" \\\n /workspace/artifacts/packages/packages.yaml.tmpl \\\n \"$out_script\"\n\nif [ -f \"$out_script\" ]; then\n cat \"$out_script\"\nelse\n echo \"🤷 no output script generated!\"\nfi\n" + }, + { + "env": [ + { + "name": "CARGO_NET_GIT_FETCH_WITH_CLI", + "value": "true" + }, + { + "name": "GOPROXY", + "value": "http://goproxy.apps.svc,direct" + }, + { + "name": "CARGO_HOME", + "value": "/workspace/.cargo" + } + ], + "image": "ghcr.io/pingcap-qe/cd/builders/tidb:v20231115-e1c4b43-go1.21", + "name": "build", "resources": {}, - "script": "#! /usr/bin/env bash\n\nset -exo pipefail\n\n:\u003e /tekton/results/repo\n:\u003e /tekton/results/tags\n:\u003e manifest.yaml\n\n# steps:\n# 1. check the pushed tag, if not existed, step will fail.\noras repo tags hub.pingcap.net/pingcap/tidb/images/tidb-lightning:master-be62f75-release_linux_arm64\n\n# 2. compute the mult-arch tags and digests\npushed_repo=\"$(echo hub.pingcap.net/pingcap/tidb/images/tidb-lightning:master-be62f75-release_linux_arm64 | cut -d ':' -f 1)\"\npushed_tag=\"$(echo hub.pingcap.net/pingcap/tidb/images/tidb-lightning:master-be62f75-release_linux_arm64 | cut -d ':' -f 2)\"\ntag=$(\\\n echo \"$pushed_tag\" | \\\n sed -E 's/[-_](amd64|arm64)$//g' | \\\n sed -E 's/[-_]linux$//g' \\\n)\n\n# repo\nyq -i \".image = \\\"$pushed_repo\\\"\" manifest.yaml\n\n# tags\ntags=\"$tag\"\ntags=\"$tags $(echo $tag | sed -E 's/[-_]release$//g')\"\n# for tags\nfor t in $tags; do\n yq -i \".tags += [\\\"$t\\\"]\" manifest.yaml\ndone\n\n# digest map\nfor t in `oras repo tags $pushed_repo | grep -E \"${tag}[-_].*[-_](amd64|arm64)$\"`; do\n manifest-tool inspect --raw \"${pushed_repo}:$t\" \u003e manifest.json\n platform=`jq -r '.os + \"/\" + .architecture' manifest.json`\n digest=`jq -r '.digest' manifest.json`\n echo \"add for: ${platform} =\u003e ${digest}\"\n\n os=\"$(echo \"$platform\" | awk -F/ '{print $1}')\"\n architecture=\"${platform#*/}\"\n yq -i '.manifests += [{}]' manifest.yaml\n yq -i \".manifests[-1].image = \\\"${pushed_repo}@${digest}\\\"\" manifest.yaml\n yq -i \".manifests[-1].platform.os = \\\"$os\\\"\" manifest.yaml\n yq -i \".manifests[-1].platform.architecture = \\\"$architecture\\\"\" manifest.yaml\ndone\n\nif yq -e '.manifests |length \u003e 1' manifest.yaml \u003e/dev/null 2\u003e\u00261; then\n printf \"%s\" \"$pushed_repo\" \u003e /tekton/results/repo\n printf \"%s\" \"$tags\" \u003e /tekton/results/tags\n cat manifest.yaml\n manifest-tool push from-spec manifest.yaml\nelse\n echo \"🤷 no more than one arch tags found. Skip push oci manifest tags\"\n exit 0\nfi\n" + "script": "script=\"/workspace/build-package-artifacts.sh\"\nif [ ! -f \"$script\" ]; then\n echo \"No build script, skip it.\"\n exit 0\nfi\n\n\"$script\" -b -a -w \"build\"\n", + "workingDir": "$(workspaces.source.path)" + }, + { + "image": "ghcr.io/pingcap-qe/cd/utils/release:v20231216-37-g8e0ca7e", + "name": "publish", + "resources": {}, + "script": "script=\"/workspace/build-package-artifacts.sh\"\nif [ ! -f \"$script\" ]; then\n echo \"No build script, skip it.\"\n printf '\"{}\"' \u003e /tekton/results/pushed\n exit 0\nfi\n\noras version\n\"$script\" -p -w \"build\" -o /tekton/results/pushed\n", + "workingDir": "$(workspaces.source.path)" } ], "workspaces": [ { - "name": "dockerconfig", - "description": "Includes a docker `config.json`", - "mountPath": "/root/.docker", - "optional": true - } - ], - "results": [ + "description": "source code.", + "name": "source" + }, { - "name": "repo", - "type": "string", - "description": "image repo" + "description": "Cache for cargo packages.", + "mountPath": "/workspace/.cargo", + "name": "cargo-home", + "optional": true }, { - "name": "tags", - "type": "string", - "description": "tags pushed" + "description": "Includes a docker `config.json`", + "mountPath": "/root/.docker", + "name": "dockerconfig", + "optional": true } ] } diff --git a/cloudevents-server/pkg/events/custom/tekton/types.go b/cloudevents-server/pkg/events/custom/tekton/types.go index 3d78fc8..634bcc4 100644 --- a/cloudevents-server/pkg/events/custom/tekton/types.go +++ b/cloudevents-server/pkg/events/custom/tekton/types.go @@ -5,6 +5,17 @@ import ( tektoncloudevent "github.com/tektoncd/pipeline/pkg/reconciler/events/cloudevent" ) +type cardMessageInfos struct { + Title string + TitleTemplate string + RerunURL string + ViewURL string + StartTime string + EndTime string + TimeCost string + Results string +} + var larkCardHeaderTemplates = map[tektoncloudevent.TektonEventType]string{ tektoncloudevent.PipelineRunFailedEventV1: larkcard.TemplateRed, tektoncloudevent.PipelineRunRunningEventV1: larkcard.TemplateBlue,