From 7f3f4ca3c775489cfae093cade23e33b265650ff Mon Sep 17 00:00:00 2001 From: Paul Meyer <49727155+katexochen@users.noreply.github.com> Date: Fri, 17 Mar 2023 17:14:27 +0100 Subject: [PATCH] bazel: get actionlint as binary download Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com> --- bazel/ci/BUILD.bazel | 16 ++++++++--- bazel/toolchains/BUILD.actionlint.bazel | 8 ++++++ bazel/toolchains/ci_deps.bzl | 35 +++++++++++++++++++++++++ bazel/toolchains/go_module_deps.bzl | 20 ++------------ hack/tools/BUILD.bazel | 1 - hack/tools/go.mod | 6 ----- hack/tools/go.sum | 16 ----------- hack/tools/tools.go | 1 - 8 files changed, 58 insertions(+), 45 deletions(-) create mode 100644 bazel/toolchains/BUILD.actionlint.bazel diff --git a/bazel/ci/BUILD.bazel b/bazel/ci/BUILD.bazel index a4215cca5..936752fbe 100644 --- a/bazel/ci/BUILD.bazel +++ b/bazel/ci/BUILD.bazel @@ -92,14 +92,24 @@ sh_template( template = "shellcheck.sh.in", ) +alias( + name = "com_github_rhysd_actionlint", + actual = select({ + "@io_bazel_rules_go//go/platform:darwin_amd64": "@com_github_rhysd_actionlint_darwin_amd64//:actionlint_bin", + "@io_bazel_rules_go//go/platform:darwin_arm64": "@com_github_rhysd_actionlint_darwin_arm64//:actionlint_bin", + "@io_bazel_rules_go//go/platform:linux_amd64": "@com_github_rhysd_actionlint_linux_amd64//:actionlint_bin", + "@io_bazel_rules_go//go/platform:linux_arm64": "@com_github_rhysd_actionlint_linux_arm64//:actionlint_bin", + }), +) + sh_template( name = "actionlint", data = [ ":com_github_koalaman_shellcheck", - "@com_github_rhysd_actionlint//cmd/actionlint", + ":com_github_rhysd_actionlint", ], substitutions = { - "@@ACTIONLINT@@": "$(rootpath @com_github_rhysd_actionlint//cmd/actionlint)", + "@@ACTIONLINT@@": "$(rootpath :com_github_rhysd_actionlint)", "@@SHELLCHECK@@": "$(rootpath :com_github_koalaman_shellcheck)", }, template = "actionlint.sh.in", @@ -107,7 +117,7 @@ sh_template( repo_command( name = "actionlint_no_shellcheck", - command = "@com_github_rhysd_actionlint//cmd/actionlint", + command = ":com_github_rhysd_actionlint", ) repo_command( diff --git a/bazel/toolchains/BUILD.actionlint.bazel b/bazel/toolchains/BUILD.actionlint.bazel new file mode 100644 index 000000000..f76b13814 --- /dev/null +++ b/bazel/toolchains/BUILD.actionlint.bazel @@ -0,0 +1,8 @@ +genrule( + name = "actionlint_bin", + srcs = ["actionlint"], + outs = ["actionlint_bin_out"], + cmd = "cp $< $@", # Copy the binary to the output directory. + executable = True, + visibility = ["//visibility:public"], +) diff --git a/bazel/toolchains/ci_deps.bzl b/bazel/toolchains/ci_deps.bzl index 52ed8720c..ccae63c4c 100644 --- a/bazel/toolchains/ci_deps.bzl +++ b/bazel/toolchains/ci_deps.bzl @@ -6,6 +6,7 @@ def ci_deps(): """Install CI dependencies""" _shellcheck_deps() _terraform_deps() + _actionlint_deps() def _shellcheck_deps(): http_archive( @@ -69,3 +70,37 @@ def _terraform_deps(): ], sha256 = "af8ff7576c8fc41496fdf97e9199b00d8d81729a6a0e821eaf4dfd08aa763540", ) + +def _actionlint_deps(): + http_archive( + name = "com_github_rhysd_actionlint_linux_amd64", + build_file = "//bazel/toolchains:BUILD.actionlint.bazel", + urls = [ + "https://github.com/rhysd/actionlint/releases/download/v1.6.23/actionlint_1.6.23_linux_amd64.tar.gz", + ], + sha256 = "b39e7cd53f4a317aecfb09edcebcc058df9ebef967866e11aa7f0df27339af3b", + ) + http_archive( + name = "com_github_rhysd_actionlint_linux_arm64", + build_file = "//bazel/toolchains:BUILD.actionlint.bazel", + urls = [ + "https://github.com/rhysd/actionlint/releases/download/v1.6.23/actionlint_1.6.23_linux_arm64.tar.gz", + ], + sha256 = "a36ba721621e861e900d36457836bfd6a29d6e10d9edebe547544a0e3dbf4348", + ) + http_archive( + name = "com_github_rhysd_actionlint_darwin_amd64", + build_file = "//bazel/toolchains:BUILD.actionlint.bazel", + urls = [ + "https://github.com/rhysd/actionlint/releases/download/v1.6.23/actionlint_1.6.23_darwin_amd64.tar.gz", + ], + sha256 = "54f000f84d3fe85012a8726cd731c4101202c787963c9f8b40d15086b003d48e", + ) + http_archive( + name = "com_github_rhysd_actionlint_darwin_arm64", + build_file = "//bazel/toolchains:BUILD.actionlint.bazel", + urls = [ + "https://github.com/rhysd/actionlint/releases/download/v1.6.23/actionlint_1.6.23_darwin_arm64.tar.gz", + ], + sha256 = "ddd0263968f7f024e49bd8721cd2b3d27c7a4d77081b81a4b376d5053ea25cdc", + ) diff --git a/bazel/toolchains/go_module_deps.bzl b/bazel/toolchains/go_module_deps.bzl index 1183a92c1..f5cd5b2d0 100644 --- a/bazel/toolchains/go_module_deps.bzl +++ b/bazel/toolchains/go_module_deps.bzl @@ -5795,14 +5795,6 @@ def go_dependencies(): sum = "h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ=", version = "v0.0.0-20200313005456-10cdbea86bc0", ) - go_repository( - name = "com_github_rhysd_actionlint", - build_file_generation = "on", - build_file_proto_mode = "disable_global", - importpath = "github.com/rhysd/actionlint", - sum = "h1:041VOXgZddfvSJa9Il+WT3Iwuo/j0Nmu4bhpAScrds4=", - version = "v1.6.23", - ) go_repository( name = "com_github_rivo_uniseg", @@ -5812,14 +5804,6 @@ def go_dependencies(): sum = "h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=", version = "v0.4.4", ) - go_repository( - name = "com_github_robfig_cron", - build_file_generation = "on", - build_file_proto_mode = "disable_global", - importpath = "github.com/robfig/cron", - sum = "h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ=", - version = "v1.2.0", - ) go_repository( name = "com_github_robfig_cron_v3", @@ -6847,8 +6831,8 @@ def go_dependencies(): build_file_generation = "on", build_file_proto_mode = "disable_global", importpath = "github.com/yuin/goldmark", - sum = "h1:3HUJmBFbQW9fhQOzMgseU134xfi6hU+mjWywx5Ty+/M=", - version = "v1.5.3", + sum = "h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE=", + version = "v1.4.13", ) go_repository( diff --git a/hack/tools/BUILD.bazel b/hack/tools/BUILD.bazel index d9ae43470..ff8235f42 100644 --- a/hack/tools/BUILD.bazel +++ b/hack/tools/BUILD.bazel @@ -11,7 +11,6 @@ go_library( "@cc_mvdan_gofumpt//:gofumpt", "@com_github_aquasecurity_tfsec//cmd/tfsec", "@com_github_katexochen_sh_v3//cmd/shfmt", - "@com_github_rhysd_actionlint//cmd/actionlint", ], "//conditions:default": [], }), diff --git a/hack/tools/go.mod b/hack/tools/go.mod index 2109bc47a..43539751c 100644 --- a/hack/tools/go.mod +++ b/hack/tools/go.mod @@ -5,7 +5,6 @@ go 1.20 require ( github.com/aquasecurity/tfsec v1.28.1 github.com/katexochen/sh/v3 v3.6.0 - github.com/rhysd/actionlint v1.6.23 mvdan.cc/gofumpt v0.4.0 ) @@ -28,7 +27,6 @@ require ( github.com/bmatcuk/doublestar v1.3.4 // indirect github.com/dlclark/regexp2 v1.4.0 // indirect github.com/emirpasic/gods v1.12.0 // indirect - github.com/fatih/color v1.13.0 // indirect github.com/gdamore/encoding v1.0.0 // indirect github.com/gdamore/tcell/v2 v2.5.0 // indirect github.com/ghodss/yaml v1.0.0 // indirect @@ -61,8 +59,6 @@ require ( github.com/liamg/jfather v0.0.7 // indirect github.com/liamg/tml v0.6.0 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.17 // indirect github.com/mattn/go-runewidth v0.0.14 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-testing-interface v1.0.0 // indirect @@ -75,7 +71,6 @@ require ( github.com/pkg/errors v0.9.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 // indirect github.com/rivo/uniseg v0.4.3 // indirect - github.com/robfig/cron v1.2.0 // indirect github.com/sergi/go-diff v1.1.0 // indirect github.com/sirupsen/logrus v1.9.0 // indirect github.com/spf13/cobra v1.6.0 // indirect @@ -106,6 +101,5 @@ require ( google.golang.org/protobuf v1.28.1 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect mvdan.cc/editorconfig v0.2.0 // indirect ) diff --git a/hack/tools/go.sum b/hack/tools/go.sum index 4f1b05b0b..c4c68b01e 100644 --- a/hack/tools/go.sum +++ b/hack/tools/go.sum @@ -135,8 +135,6 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= -github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/foxcpp/go-mockdns v0.0.0-20210729171921-fb145fc6f897 h1:E52jfcE64UG42SwLmrW0QByONfGynWuzBvm86BoB9z8= @@ -319,15 +317,7 @@ github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i github.com/matryer/is v1.2.0 h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A= github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= -github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= @@ -367,13 +357,9 @@ github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8 github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ= github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rhysd/actionlint v1.6.23 h1:041VOXgZddfvSJa9Il+WT3Iwuo/j0Nmu4bhpAScrds4= -github.com/rhysd/actionlint v1.6.23/go.mod h1:o5qc1K3I9taGMBhL7mVkpRd64hx3YqI+3t8ewGfYXfE= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw= github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ= -github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= @@ -568,7 +554,6 @@ golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -611,7 +596,6 @@ golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220318055525-2edf467146b5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220517195934-5e4e11fc645e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= diff --git a/hack/tools/tools.go b/hack/tools/tools.go index 3ee587ef7..5f5bb1f25 100644 --- a/hack/tools/tools.go +++ b/hack/tools/tools.go @@ -11,6 +11,5 @@ package main import ( _ "github.com/aquasecurity/tfsec/cmd/tfsec" _ "github.com/katexochen/sh/v3/cmd/shfmt" - _ "github.com/rhysd/actionlint/cmd/actionlint" _ "mvdan.cc/gofumpt" )