From 0dc50ce4abdd7ce815fd1742b9462f454924f214 Mon Sep 17 00:00:00 2001 From: Nuru Date: Mon, 7 Dec 2020 13:03:27 -0800 Subject: [PATCH 1/9] Add terraform-config-inspect for apk and deb --- apk/Dockerfile-3.12 | 2 +- deb/Dockerfile.stable-slim | 10 +++ tasks/Makefile.package | 2 +- vendor/terraform-config-inspect/DESCRIPTION | 1 + vendor/terraform-config-inspect/LICENSE | 1 + vendor/terraform-config-inspect/Makefile | 39 +++++++++ vendor/terraform-config-inspect/RELEASE | 1 + vendor/terraform-config-inspect/VERSION | 1 + vendor/terraform-config-inspect/go.mod | 15 ++++ vendor/terraform-config-inspect/go.sum | 79 +++++++++++++++++++ vendor/terraform-config-inspect/main.go | 63 +++++++++++++++ .../scripts/includeversion.go | 17 ++++ vendor/terraform-config-inspect/version.go | 5 ++ 13 files changed, 234 insertions(+), 2 deletions(-) create mode 100644 vendor/terraform-config-inspect/DESCRIPTION create mode 100644 vendor/terraform-config-inspect/LICENSE create mode 100644 vendor/terraform-config-inspect/Makefile create mode 100644 vendor/terraform-config-inspect/RELEASE create mode 100644 vendor/terraform-config-inspect/VERSION create mode 100644 vendor/terraform-config-inspect/go.mod create mode 100644 vendor/terraform-config-inspect/go.sum create mode 100644 vendor/terraform-config-inspect/main.go create mode 100644 vendor/terraform-config-inspect/scripts/includeversion.go create mode 100644 vendor/terraform-config-inspect/version.go diff --git a/apk/Dockerfile-3.12 b/apk/Dockerfile-3.12 index 25a6f97694..7d87413c3b 100644 --- a/apk/Dockerfile-3.12 +++ b/apk/Dockerfile-3.12 @@ -10,6 +10,6 @@ RUN echo "https://alpine.global.ssl.fastly.net/alpine/edge/testing" >> /etc/apk/ RUN echo "https://alpine.global.ssl.fastly.net/alpine/edge/community" >> /etc/apk/repositories RUN apk update && \ - apk add make curl alpine-sdk shadow bash jq sudo + apk add make curl alpine-sdk shadow bash jq sudo go RUN echo "auth sufficient pam_shells.so" > /etc/pam.d/chsh diff --git a/deb/Dockerfile.stable-slim b/deb/Dockerfile.stable-slim index de5d206071..c419676bd2 100644 --- a/deb/Dockerfile.stable-slim +++ b/deb/Dockerfile.stable-slim @@ -9,4 +9,14 @@ RUN apt-get update && \ RUN gem install --no-document backports -v 3.15.0 RUN gem install --no-document fpm +ARG GO_INSTALL_VERSION=1.15.6 + +# Install go +RUN echo downloading go${GO_INSTALL_VERSION} && \ + curl -sSL --retry 3 -o golang.tar.gz https://golang.org/dl/go${GO_INSTALL_VERSION}.linux-amd64.tar.gz && \ + tar xzf golang.tar.gz && \ + mv go /usr/lib/ && rm golang.tar.gz && \ + ln -s /usr/lib/go/bin/go /usr/bin/go + + WORKDIR /packages diff --git a/tasks/Makefile.package b/tasks/Makefile.package index 165c1e1c4d..b0e22722e2 100644 --- a/tasks/Makefile.package +++ b/tasks/Makefile.package @@ -124,7 +124,7 @@ RELEASE: VERSION LICENSE DESCRIPTION fi init: AUTO_UPDATE_ENABLED=true -init: $(PACKAGE_VERSION_TARGET) LICENSE DESCRIPTION RELEASE +init: LICENSE DESCRIPTION $(PACKAGE_VERSION_TARGET) RELEASE update: $(PACKAGE_VERSION_TARGET) RELEASE diff --git a/vendor/terraform-config-inspect/DESCRIPTION b/vendor/terraform-config-inspect/DESCRIPTION new file mode 100644 index 0000000000..1d5d0b0062 --- /dev/null +++ b/vendor/terraform-config-inspect/DESCRIPTION @@ -0,0 +1 @@ +A helper library for shallow inspection of Terraform configurations diff --git a/vendor/terraform-config-inspect/LICENSE b/vendor/terraform-config-inspect/LICENSE new file mode 100644 index 0000000000..eb86038d19 --- /dev/null +++ b/vendor/terraform-config-inspect/LICENSE @@ -0,0 +1 @@ +MPL-2.0 diff --git a/vendor/terraform-config-inspect/Makefile b/vendor/terraform-config-inspect/Makefile new file mode 100644 index 0000000000..bf8cfe04cd --- /dev/null +++ b/vendor/terraform-config-inspect/Makefile @@ -0,0 +1,39 @@ +## Package - terraform-config-inspect +export VENDOR = hashicorp +export PACKAGE_NAME = terraform-config-inspect +export DOWNLOAD_URL ?= $(PACKAGE_EXE) +export APK_BUILD_TEMPLATE ?= APKBUILD.github-binary +export APK_PACKAGE_VERSION := $(shell cat VERSION | sed s/\+.*//) +export INSTALL_PATH=/usr/local/bin + +# RPM should be relatively easy, but we will get to it later +export PACKAGE_TYPES_DISABLED = rpm + +# Custom auto-update target +export PACKAGE_VERSION_TARGET := go-update + +include ../../tasks/Makefile.vendor_includes + +$(INSTALL_PATH)/$(PACKAGE_EXE): main.go version.go VERSION + mkdir -p $(INSTALL_PATH) + go generate + go build -o $(INSTALL_PATH)/$(PACKAGE_EXE) + +test: + $(PACKAGE_EXE) --version | grep -F $(APK_PACKAGE_VERSION) + +## This may be required for apk building and varies from package to package +# Custom post-package processing (Note the double colon to append to current inherited package/prepare task) +#package/prepare:: +# echo EXAMPLE PREPARE +# echo cp src/gh_$(PACKAGE_VERSION)_$(OS)_$(ARCH)/bin/$(PACKAGE_EXE) src +# exit 1 + +apk/prepare:: $(INSTALL_PATH)/$(PACKAGE_EXE) + cp -p $(INSTALL_PATH)/$(PACKAGE_EXE) $(APK_TMP_DIR) + +install: $(INSTALL_PATH)/$(PACKAGE_EXE) + +go-update: + go get -u github.com/hashicorp/terraform-config-inspect + printf "%s" $$(grep -F github.com/hashicorp/terraform-config-inspect go.mod| sed -e 's/.* v//' -e 's/\.0-/./' -e 's/-/+git/') > VERSION diff --git a/vendor/terraform-config-inspect/RELEASE b/vendor/terraform-config-inspect/RELEASE new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/vendor/terraform-config-inspect/RELEASE @@ -0,0 +1 @@ +0 diff --git a/vendor/terraform-config-inspect/VERSION b/vendor/terraform-config-inspect/VERSION new file mode 100644 index 0000000000..ece1bef359 --- /dev/null +++ b/vendor/terraform-config-inspect/VERSION @@ -0,0 +1 @@ +0.0.20201102131242+git0c45ba392e51 \ No newline at end of file diff --git a/vendor/terraform-config-inspect/go.mod b/vendor/terraform-config-inspect/go.mod new file mode 100644 index 0000000000..7d0b48981c --- /dev/null +++ b/vendor/terraform-config-inspect/go.mod @@ -0,0 +1,15 @@ +module github.com/cloudposse/packages + +go 1.13 + +require ( + github.com/agext/levenshtein v1.2.3 // indirect + github.com/google/go-cmp v0.5.4 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/hashicorp/hcl/v2 v2.8.0 // indirect + github.com/hashicorp/terraform-config-inspect v0.0.0-20201102131242-0c45ba392e51 + github.com/mitchellh/go-wordwrap v1.0.1 // indirect + github.com/spf13/pflag v1.0.5 + github.com/zclconf/go-cty v1.7.0 // indirect + golang.org/x/text v0.3.4 // indirect +) diff --git a/vendor/terraform-config-inspect/go.sum b/vendor/terraform-config-inspect/go.sum new file mode 100644 index 0000000000..8d8cd1e069 --- /dev/null +++ b/vendor/terraform-config-inspect/go.sum @@ -0,0 +1,79 @@ +github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= +github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= +github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= +github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= +github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= +github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= +github.com/apparentlymart/go-textseg v1.0.0 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2wFoYVvnCs0= +github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= +github.com/apparentlymart/go-textseg/v12 v12.0.0 h1:bNEQyAGak9tojivJNkoqWErVCQbjdL7GzRt3F8NvfJ0= +github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= +github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f h1:UdxlrJz4JOnY8W+DbLISwf2B8WXEolNRA8BGCwI9jws= +github.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f/go.mod h1:oZtUIOe8dh44I2q6ScRibXws4Ajl+d+nod3AaR9vL5w= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/hcl/v2 v2.0.0 h1:efQznTz+ydmQXq3BOnRa3AXzvCeTq1P4dKj/z5GLlY8= +github.com/hashicorp/hcl/v2 v2.0.0/go.mod h1:oVVDG71tEinNGYCxinCYadcmKU9bglqW9pV3txagJ90= +github.com/hashicorp/hcl/v2 v2.8.0 h1:iHLEAsNDp3N2MtqroP1wf0nF/zB2+McHN5YCzwqIm80= +github.com/hashicorp/hcl/v2 v2.8.0/go.mod h1:bQTN5mpo+jewjJgh8jr0JUguIi7qPHUF6yIfAEN3jqY= +github.com/hashicorp/terraform-config-inspect v0.0.0-20201102131242-0c45ba392e51 h1:SEGO1vz/pFLfKy4QpABIMCe7wffmtsOiWO4yc1E87cU= +github.com/hashicorp/terraform-config-inspect v0.0.0-20201102131242-0c45ba392e51/go.mod h1:Z0Nnk4+3Cy89smEbrq+sl1bxc9198gIP4I7wcQF6Kqs= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= +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/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= +github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= +github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4= +github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= +github.com/zclconf/go-cty v1.1.0 h1:uJwc9HiBOCpoKIObTQaLR+tsEXx1HBHnOsOOpcdhZgw= +github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= +github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= +github.com/zclconf/go-cty v1.7.0 h1:yMqLinUwNCYkmiHjEH+luio1yGl35cjqVzjvdRg2WlY= +github.com/zclconf/go-cty v1.7.0/go.mod h1:VDR4+I79ubFBGm1uJac1226K5yANQFHeauxPBoP54+o= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.4 h1:0YWbFKbhXG/wIiuHDSKpS0Iy7FSA+u45VtBMfQcFTTc= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/vendor/terraform-config-inspect/main.go b/vendor/terraform-config-inspect/main.go new file mode 100644 index 0000000000..c567086df8 --- /dev/null +++ b/vendor/terraform-config-inspect/main.go @@ -0,0 +1,63 @@ +package main + +import ( + "encoding/json" + "fmt" + "os" + "strings" + + "github.com/hashicorp/terraform-config-inspect/tfconfig" + flag "github.com/spf13/pflag" +) + +//go:generate go run scripts/includeversion.go + +var showJSON = flag.Bool("json", false, "produce JSON-formatted output") +var showVersion = flag.BoolP("version", "v", false, "output version") + +func main() { + flag.Parse() + + var dir string + if flag.NArg() > 0 { + dir = flag.Arg(0) + } else { + dir = "." + } + + module, _ := tfconfig.LoadModule(dir) + + if *showVersion { + printVersion() + } else if *showJSON { + showModuleJSON(module) + } else { + showModuleMarkdown(module) + } + + if module.Diagnostics.HasErrors() { + os.Exit(1) + } +} + +func showModuleJSON(module *tfconfig.Module) { + j, err := json.MarshalIndent(module, "", " ") + if err != nil { + fmt.Fprintf(os.Stderr, "error producing JSON: %s\n", err) + os.Exit(2) + } + os.Stdout.Write(j) + os.Stdout.Write([]byte{'\n'}) +} + +func showModuleMarkdown(module *tfconfig.Module) { + err := tfconfig.RenderMarkdown(os.Stdout, module) + if err != nil { + fmt.Fprintf(os.Stderr, "error rendering template: %s\n", err) + os.Exit(2) + } +} + +func printVersion() { + fmt.Fprintf(os.Stdout, "terraform-config-inspect v%v (Cloud Posse)\n", strings.Trim(Version,"\n")) +} diff --git a/vendor/terraform-config-inspect/scripts/includeversion.go b/vendor/terraform-config-inspect/scripts/includeversion.go new file mode 100644 index 0000000000..1ba06c1251 --- /dev/null +++ b/vendor/terraform-config-inspect/scripts/includeversion.go @@ -0,0 +1,17 @@ +package main + +import ( + "io" + "os" +) + +// Reads the VERSION files in the current folder +// and encodes them as strings literals in textfiles.go +func main() { + out, _ := os.Create("version.go") + out.Write([]byte("package main \n\nconst (\n")) + out.Write([]byte("Version = `")) + f, _ := os.Open("Version") + io.Copy(out, f) + out.Write([]byte("`\n)\n")) +} diff --git a/vendor/terraform-config-inspect/version.go b/vendor/terraform-config-inspect/version.go new file mode 100644 index 0000000000..30fdd2e38d --- /dev/null +++ b/vendor/terraform-config-inspect/version.go @@ -0,0 +1,5 @@ +package main + +const ( +Version = `0.0.20201102131242+git0c45ba392e51` +) From 2390f33bd59840f6f0b554ad9cd5b2137c10cb2e Mon Sep 17 00:00:00 2001 From: Nuru Date: Mon, 7 Dec 2020 13:10:32 -0800 Subject: [PATCH 2/9] Update README etc. --- .github/auto-label.yml | 3 + .github/workflows/auto-update-packages.yml | 1 + .../workflows/terraform-config-inspect.yml | 220 ++++++++++++++++++ README.md | 1 + docs/badges.md | 1 + docs/targets.md | 1 + 6 files changed, 227 insertions(+) create mode 100644 .github/workflows/terraform-config-inspect.yml diff --git a/.github/auto-label.yml b/.github/auto-label.yml index 24509e25d5..744ef64ce8 100644 --- a/.github/auto-label.yml +++ b/.github/auto-label.yml @@ -338,6 +338,9 @@ vendor/terraform-0.13: vendor/terraform-0.14: - any: ["vendor/terraform-0.14/**"] all: ["!bin/**", "!tasks/**"] +vendor/terraform-config-inspect: +- any: ["vendor/terraform-config-inspect/**"] + all: ["!bin/**", "!tasks/**"] vendor/terraform-docs: - any: ["vendor/terraform-docs/**"] all: ["!bin/**", "!tasks/**"] diff --git a/.github/workflows/auto-update-packages.yml b/.github/workflows/auto-update-packages.yml index e7b875f93a..798a0baddb 100644 --- a/.github/workflows/auto-update-packages.yml +++ b/.github/workflows/auto-update-packages.yml @@ -117,6 +117,7 @@ jobs: - terraform-0.12 - terraform-0.13 - terraform-0.14 + - terraform-config-inspect - terraform-docs - terraform_0.11 - terraform_0.12 diff --git a/.github/workflows/terraform-config-inspect.yml b/.github/workflows/terraform-config-inspect.yml new file mode 100644 index 0000000000..ca29a8716f --- /dev/null +++ b/.github/workflows/terraform-config-inspect.yml @@ -0,0 +1,220 @@ +# +# This workflow was created automatically from the `package-template.yml` by running `make -C .github workflows` +# DO NOT EDIT THIS WORKFLOW, changes will be lost on the next update. +# + +name: "terraform-config-inspect" +on: + push: + branches: + - master + + paths: + - apk/** + - deb/** + - rpm/** + - tasks/** + - vendor/terraform-config-inspect/** + - .github/workflows/terraform-config-inspect.yml + + + pull_request: + types: [opened, synchronize, reopened] + paths: + - apk/** + - deb/** + - rpm/** + - tasks/** + - vendor/terraform-config-inspect/** + - .github/workflows/terraform-config-inspect.yml + +jobs: + matrix: + if: github.event_name != 'schedule' + runs-on: ubuntu-latest + outputs: + package-enabled: ${{ steps.info.outputs.package_enabled }} + package-matrix: ${{steps.info.outputs.package_matrix}} + apk-enabled: ${{ steps.info.outputs.package_enabled == 'true' && steps.info.outputs.apk_package_enabled == 'true' }} + steps: + - uses: actions/checkout@v2 + + - name: Export package build matrix + shell: bash + id: info + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + run: | + echo setting ouputs + make -C vendor/terraform-config-inspect info/github + echo + echo outputs set + make -C vendor/terraform-config-inspect info/github | sed s'/::set-output name=//' | sed 's/::/=/' + + + # Build for alpine linux + # Kept separate because it is old and slightly different than the other package builds + alpine: + needs: matrix + if: github.event_name != 'schedule' && needs.matrix.outputs.apk-enabled != 'false' + runs-on: ubuntu-latest + strategy: + matrix: + # These versions must be strings. E.g. Otherwise `3.10` -> `3.1` + alpine: + - '3.12' + env: + APK_KEY_RSA: "${{ secrets.APK_KEY_RSA }}" + APK_PACKAGES_PATH: ${{github.workspace}}/artifacts/${{matrix.alpine}} + PACKAGER: ops@cloudposse.com + PACKAGER_PRIVKEY: /dev/shm/ops@cloudposse.com.rsa + PACKAGER_PUBKEY: ${{github.workspace}}/artifacts/ops@cloudposse.com.rsa.pub + + container: cloudposse/packages-apkbuild:${{matrix.alpine}} + steps: + # Checkout the packages repo so we can build the packages as a monorepo + - name: "Checkout source code at current commit" + uses: actions/checkout@v2 + + # Export the apk keys as files from secrets + - name: "Export keys" + run: "make -C .github/ export" + + # Build the alpine packages for the matrix version of alpine + - name: "Build alpine packages" + run: "make -C vendor/${{github.workflow}} apk" + + # Verify the packages were built or error + - name: "List packages" + run: 'find ${APK_PACKAGES_PATH} -type f -name \*.apk | xargs --no-run-if-empty ls -l | grep .' + + # Export the artifact filename including path + # Path must be relative to workdir for Cloudsmith action to be able to find it + - name: "Set output path to artifact" + id: artifact + shell: bash + run: | + artifact=$(find artifacts/${{matrix.alpine}} -type f -name \*.apk) + echo "::set-output name=path::$artifact" + echo "set output path=$artifact" + echo creating '"pip"' cache directory for Cloudsmith + mkdir -p $HOME/.cache/pip && chmod -R 777 $HOME/.cache || echo Ignoring error creating '"pip"' cache directory + + + # Determine which package organization we should use (e.g. dev or prod) + - name: "Determine package repo" + shell: bash + id: repo + run: | + if [[ ${GITHUB_REF} == 'refs/heads/master' ]]; then + echo "::set-output name=org::${{github.repository_owner}}" + else + echo "::set-output name=org::${{github.repository_owner}}-dev" + fi + env: + GITHUB_REF: ${{ github.ref }} + + # Publish the artifacts + - name: "Push artifact to package repository" + uses: cloudsmith-io/action@v0.5.1 + with: + api-key: ${{ secrets.CLOUDSMITH_API_KEY }} + command: 'push' + format: 'alpine' + owner: '${{steps.repo.outputs.org}}' # Your Cloudsmith account name or org name (namespace) + repo: 'packages' # Your Cloudsmith Repository name (slug) + distro: 'alpine' # Your Distribution (i.e debian, ubuntu, alpine) + release: 'any-version' # Use "any-version" if your package is compatible with more than one version of alpine linux + republish: 'true' # Needed if version is not changing + file: '${{steps.artifact.outputs.path}}' # Package filename (including path) + no-wait-for-sync: 'true' # Skip the waiting for package synchronisation (i.e. upload only) + + # Build packages with fpm package manager + package: + needs: matrix + # Should not be needed, but without these conditions, this job would fail with an error if the matrix is [] + # and would run with package-type empty if matrix is ["apk"] + if: > + github.event_name != 'schedule' && needs.matrix.outputs.package-enabled != 'false' + && needs.matrix.outputs.package-matrix != '[]' && needs.matrix.outputs.package-matrix != '["apk"]' + + runs-on: ubuntu-latest + strategy: + matrix: + package-type: ${{ fromJSON(needs.matrix.outputs.package-matrix) }} + exclude: + - package-type: 'apk' + env: + # We are in a bit of a bind here because of how GitHub actions work as of 2020-11-19 + # Although the "workspace" is mounted to the container, it is not mounted + # at `/github/workspace` or ${{github.workspace}}, although through some + # mechanism, an environment variable whose value starts with ${{github.workspace}} + # will have ${{github.workspace}} replaced with the correct mount point. + # + # We need an absolute path for the package build system, since every build happens + # in a different directory, but because the mount point changes, we also + # need a path relative to the initial working directory to communicate between + # the package building container and the cloudsmith action. + PACKAGES_PATH: ${{github.workspace}}/artifacts/${{matrix.package-type}}/any-version + PACKAGE_RELPATH: artifacts/${{matrix.package-type}}/any-version + + # Unfortunately, there is no reasonable way to configure the docker image tag based on the package-type + container: cloudposse/packages-${{matrix.package-type}}build:latest + steps: + # Checkout the packages repo so we can build the packages as a monorepo + - name: "Checkout source code at current commit" + uses: actions/checkout@v2 + + # Build the packages for the matrix version + - name: "Build ${{matrix.package-type}} packages" + shell: bash + run: | + echo Current directory is $(pwd) + [[ $PACKAGES_PATH =~ ^$(pwd) ]] || { echo Package dir \"$PACKAGES_PATH\" not beneath workdir \"$(pwd)\" >&2; exit 1; } + make -C vendor/${{github.workflow}} ${{matrix.package-type}} + + # Export the artifact filename including path + - name: "Set output path to artifact" + id: artifact + shell: bash + run: | + [[ -n $PACKAGE_RELPATH ]] || { echo Error: PACKAGE_RELPATH is not set >&2; exit 1; } + packages=($(find ${PACKAGE_RELPATH} -type f -name \*.${{matrix.package-type}})) + echo List packages found: + printf "%s\n" "${packages[@]}" | xargs --no-run-if-empty ls -l + echo Error if not exactly 1 package found + (( ${#packages[@]} == 1 )) || { echo "Error: other than 1 package found (${#packages[@]})" >&2; exit 1; } + + echo "setting output name=path::$packages" + echo "::set-output name=path::$packages" + + echo creating '"pip"' cache directory for Cloudsmith + mkdir -p $HOME/.cache/pip && chmod -R 777 $HOME/.cache || echo Ignoring error creating '"pip"' cache directory + + # Determine which package organization we should use (e.g. dev or prod) + - name: "Determine package repo" + shell: bash + id: repo + run: | + if [[ ${GITHUB_REF} == 'refs/heads/master' ]]; then + echo "::set-output name=org::${{github.repository_owner}}" + else + echo "::set-output name=org::${{github.repository_owner}}-dev" + fi + env: + GITHUB_REF: ${{ github.ref }} + + # Publish the artifacts + - name: "Push artifact to package repository" + uses: cloudsmith-io/action@v0.5.1 + with: + api-key: ${{ secrets.CLOUDSMITH_API_KEY }} + command: 'push' + format: '${{matrix.package-type}}' + owner: '${{steps.repo.outputs.org}}' # Your Cloudsmith account name or org name (namespace) + repo: 'packages' # Your Cloudsmith Repository name (slug) + distro: 'any-distro' # Use "any-distro" since our package is compatible with more than more distribution + release: 'any-version' # Use "any-version" since our package is compatible with more than more version + republish: 'true' # Needed if version is not changing + file: '${{steps.artifact.outputs.path}}' # Package filename (including path) + no-wait-for-sync: 'true' # Skip the waiting for package synchronisation (i.e. upload only) diff --git a/README.md b/README.md index 87d25a973d..61da696ce4 100644 --- a/README.md +++ b/README.md @@ -348,6 +348,7 @@ exit [![terraform-0.12](https://github.com/cloudposse/packages/workflows/terraform-0.12/badge.svg?branch=master)](https://github.com/cloudposse/packages/actions?query=workflow%3Aterraform-0.12) | 0.12.29 | Terraform is a tool for building, changing, and combining infrastructure safely and efficiently. [![terraform-0.13](https://github.com/cloudposse/packages/workflows/terraform-0.13/badge.svg?branch=master)](https://github.com/cloudposse/packages/actions?query=workflow%3Aterraform-0.13) | 0.13.5 | Terraform is a tool for building, changing, and combining infrastructure safely and efficiently. [![terraform-0.14](https://github.com/cloudposse/packages/workflows/terraform-0.14/badge.svg?branch=master)](https://github.com/cloudposse/packages/actions?query=workflow%3Aterraform-0.14) | 0.14.0 | Terraform is a tool for building, changing, and combining infrastructure safely and efficiently. +[![terraform-config-inspect](https://github.com/cloudposse/packages/workflows/terraform-config-inspect/badge.svg?branch=master)](https://github.com/cloudposse/packages/actions?query=workflow%3Aterraform-config-inspect) | 0.0.20201102131242+git0c45ba392e51 | A helper library for shallow inspection of Terraform configurations [![terraform-docs](https://github.com/cloudposse/packages/workflows/terraform-docs/badge.svg?branch=master)](https://github.com/cloudposse/packages/actions?query=workflow%3Aterraform-docs) | 0.10.1 | Generate docs from terraform modules [![terraform_0.11](https://github.com/cloudposse/packages/workflows/terraform_0.11/badge.svg?branch=master)](https://github.com/cloudposse/packages/actions?query=workflow%3Aterraform_0.11) | 0.11.14 | Terraform (Deprecated package. Use terraform-0.11 instead) [![terraform_0.12](https://github.com/cloudposse/packages/workflows/terraform_0.12/badge.svg?branch=master)](https://github.com/cloudposse/packages/actions?query=workflow%3Aterraform_0.12) | 0.12.29 | Terraform (Deprecated package. Use terraform-0.12 instead) diff --git a/docs/badges.md b/docs/badges.md index 99809295b1..78dd90586c 100644 --- a/docs/badges.md +++ b/docs/badges.md @@ -103,6 +103,7 @@ [![terraform-0.12](https://github.com/cloudposse/packages/workflows/terraform-0.12/badge.svg?branch=master)](https://github.com/cloudposse/packages/actions?query=workflow%3Aterraform-0.12) | 0.12.29 | Terraform is a tool for building, changing, and combining infrastructure safely and efficiently. [![terraform-0.13](https://github.com/cloudposse/packages/workflows/terraform-0.13/badge.svg?branch=master)](https://github.com/cloudposse/packages/actions?query=workflow%3Aterraform-0.13) | 0.13.5 | Terraform is a tool for building, changing, and combining infrastructure safely and efficiently. [![terraform-0.14](https://github.com/cloudposse/packages/workflows/terraform-0.14/badge.svg?branch=master)](https://github.com/cloudposse/packages/actions?query=workflow%3Aterraform-0.14) | 0.14.0 | Terraform is a tool for building, changing, and combining infrastructure safely and efficiently. +[![terraform-config-inspect](https://github.com/cloudposse/packages/workflows/terraform-config-inspect/badge.svg?branch=master)](https://github.com/cloudposse/packages/actions?query=workflow%3Aterraform-config-inspect) | 0.0.20201102131242+git0c45ba392e51 | A helper library for shallow inspection of Terraform configurations [![terraform-docs](https://github.com/cloudposse/packages/workflows/terraform-docs/badge.svg?branch=master)](https://github.com/cloudposse/packages/actions?query=workflow%3Aterraform-docs) | 0.10.1 | Generate docs from terraform modules [![terraform_0.11](https://github.com/cloudposse/packages/workflows/terraform_0.11/badge.svg?branch=master)](https://github.com/cloudposse/packages/actions?query=workflow%3Aterraform_0.11) | 0.11.14 | Terraform (Deprecated package. Use terraform-0.11 instead) [![terraform_0.12](https://github.com/cloudposse/packages/workflows/terraform_0.12/badge.svg?branch=master)](https://github.com/cloudposse/packages/actions?query=workflow%3Aterraform_0.12) | 0.12.29 | Terraform (Deprecated package. Use terraform-0.12 instead) diff --git a/docs/targets.md b/docs/targets.md index 0a6d7fdc38..bd60c84420 100644 --- a/docs/targets.md +++ b/docs/targets.md @@ -108,6 +108,7 @@ terraform-0.11 0.11.14 Terraform is a tool for building, changing, terraform-0.12 0.12.29 Terraform is a tool for building, changing, and combining infrastructure safely and efficiently. terraform-0.13 0.13.5 Terraform is a tool for building, changing, and combining infrastructure safely and efficiently. terraform-0.14 0.14.0 Terraform is a tool for building, changing, and combining infrastructure safely and efficiently. +terraform-config-inspect 0.0.20201102131242+git0c45ba392e51 A helper library for shallow inspection of Terraform configurations terraform-docs 0.10.1 Generate docs from terraform modules terraform_0.11 0.11.14 Terraform (Deprecated package. Use terraform-0.11 instead) terraform_0.12 0.12.29 Terraform (Deprecated package. Use terraform-0.12 instead) From bcb1a4dd3e6e8b2aad163ce53ff84344fc420fc6 Mon Sep 17 00:00:00 2001 From: Nuru Date: Mon, 7 Dec 2020 13:23:51 -0800 Subject: [PATCH 3/9] Update Docker build to build go binary --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 7d5deee8e9..f615ee9569 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ FROM alpine:3.12 ENV INSTALL_PATH=/packages/bin ENV PATH=${INSTALL_PATH}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin RUN mkdir -p ${INSTALL_PATH} -RUN apk add --update --no-cache bash make curl coreutils libc6-compat tar xz jq +RUN apk add --update --no-cache bash make curl coreutils libc6-compat tar xz jq sudo go COPY --from=cfssl /go/bin/ ${INSTALL_PATH}/ From 491b02be389fe2f2841794768fb1648c9176da87 Mon Sep 17 00:00:00 2001 From: Nuru Date: Mon, 7 Dec 2020 19:01:40 -0800 Subject: [PATCH 4/9] Attempt to fix remote build error --- vendor/terraform-config-inspect/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vendor/terraform-config-inspect/Makefile b/vendor/terraform-config-inspect/Makefile index bf8cfe04cd..174615edfe 100644 --- a/vendor/terraform-config-inspect/Makefile +++ b/vendor/terraform-config-inspect/Makefile @@ -18,9 +18,12 @@ $(INSTALL_PATH)/$(PACKAGE_EXE): main.go version.go VERSION mkdir -p $(INSTALL_PATH) go generate go build -o $(INSTALL_PATH)/$(PACKAGE_EXE) + chmod 777 $(INSTALL_PATH)/$(PACKAGE_EXE) test: - $(PACKAGE_EXE) --version | grep -F $(APK_PACKAGE_VERSION) + @echo Test: expecting exe version like $(APK_PACKAGE_VERSION) + @echo Running: $(PACKAGE_EXE) --version && $(PACKAGE_EXE) --version + $(PACKAGE_EXE) --version | grep -q -F $(APK_PACKAGE_VERSION) ## This may be required for apk building and varies from package to package # Custom post-package processing (Note the double colon to append to current inherited package/prepare task) From baa38cd3d1efdf212a2bf9c14af63da83a328e40 Mon Sep 17 00:00:00 2001 From: Nuru Date: Mon, 7 Dec 2020 19:59:18 -0800 Subject: [PATCH 5/9] debugging --- vendor/terraform-config-inspect/Makefile | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/vendor/terraform-config-inspect/Makefile b/vendor/terraform-config-inspect/Makefile index 174615edfe..1e43f908b8 100644 --- a/vendor/terraform-config-inspect/Makefile +++ b/vendor/terraform-config-inspect/Makefile @@ -18,19 +18,24 @@ $(INSTALL_PATH)/$(PACKAGE_EXE): main.go version.go VERSION mkdir -p $(INSTALL_PATH) go generate go build -o $(INSTALL_PATH)/$(PACKAGE_EXE) - chmod 777 $(INSTALL_PATH)/$(PACKAGE_EXE) test: - @echo Test: expecting exe version like $(APK_PACKAGE_VERSION) + @echo Test: expecting exe version like $(APK_PACKAGE_VERSION) or $(DEB_PACKAGE_VERSION) from VERSION $(shell cat VERSION) @echo Running: $(PACKAGE_EXE) --version && $(PACKAGE_EXE) --version $(PACKAGE_EXE) --version | grep -q -F $(APK_PACKAGE_VERSION) ## This may be required for apk building and varies from package to package # Custom post-package processing (Note the double colon to append to current inherited package/prepare task) -#package/prepare:: -# echo EXAMPLE PREPARE -# echo cp src/gh_$(PACKAGE_VERSION)_$(OS)_$(ARCH)/bin/$(PACKAGE_EXE) src -# exit 1 +# echo cp src/gh_$(PACKAGE_VERSION)_$(OS)_$(ARCH)/bin/$(PACKAGE_EXE) src +package/prepare:: + echo CUSTOM PREPARE + echo cwd is $$(pwd) + echo APK_TMP_DIR is $(APK_TMP_DIR) + echo ls -l $(APK_TMP_DIR)/../.. + ls -l $(APK_TMP_DIR)/../.. + echo ls -l ../../ + ls -l ../../ + chmod 777 ../../tmp || echo could not chmod ../../tmp apk/prepare:: $(INSTALL_PATH)/$(PACKAGE_EXE) cp -p $(INSTALL_PATH)/$(PACKAGE_EXE) $(APK_TMP_DIR) From c7a7a43a5a3588368e5d6b6bd9313558930b34e2 Mon Sep 17 00:00:00 2001 From: Nuru Date: Mon, 7 Dec 2020 20:19:09 -0800 Subject: [PATCH 6/9] tmp dir perms --- vendor/terraform-config-inspect/Makefile | 5 ++++- vendor/terraform-config-inspect/scripts/includeversion.go | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/vendor/terraform-config-inspect/Makefile b/vendor/terraform-config-inspect/Makefile index 1e43f908b8..34ddabe1f5 100644 --- a/vendor/terraform-config-inspect/Makefile +++ b/vendor/terraform-config-inspect/Makefile @@ -14,9 +14,12 @@ export PACKAGE_VERSION_TARGET := go-update include ../../tasks/Makefile.vendor_includes +version.go: VERSION + go generate + $(INSTALL_PATH)/$(PACKAGE_EXE): main.go version.go VERSION + chown 777 ../../tmp || echo Failed to chown ../../tmp from $(shell pwd -P) mkdir -p $(INSTALL_PATH) - go generate go build -o $(INSTALL_PATH)/$(PACKAGE_EXE) test: diff --git a/vendor/terraform-config-inspect/scripts/includeversion.go b/vendor/terraform-config-inspect/scripts/includeversion.go index 1ba06c1251..2bc60af1d0 100644 --- a/vendor/terraform-config-inspect/scripts/includeversion.go +++ b/vendor/terraform-config-inspect/scripts/includeversion.go @@ -11,7 +11,7 @@ func main() { out, _ := os.Create("version.go") out.Write([]byte("package main \n\nconst (\n")) out.Write([]byte("Version = `")) - f, _ := os.Open("Version") + f, _ := os.Open("VERSION") io.Copy(out, f) out.Write([]byte("`\n)\n")) } From 50def42d3ff25b08bdd7b289579ecfb20aab5f49 Mon Sep 17 00:00:00 2001 From: Nuru Date: Mon, 7 Dec 2020 20:43:28 -0800 Subject: [PATCH 7/9] More tmp dir stuff --- tasks/Makefile.apk | 2 +- vendor/terraform-config-inspect/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/Makefile.apk b/tasks/Makefile.apk index c29db081ce..69f063b35c 100644 --- a/tasks/Makefile.apk +++ b/tasks/Makefile.apk @@ -26,7 +26,7 @@ export APK_PACKAGE_ENABLED := $(shell $(LOCAL_BIN)/package-filter apk-enabled "$ export APK_TEMPLATE_PATH ?= ../../apk/templates/ export APK_BUILD_TEMPLATE ?= APKBUILD.github-binary export APK_PACKAGES_PATH ?= /tmp/packages -export APK_TMP_DIR := $(realpath $(shell mktemp -d ../../tmp/build.XXXXXX)) +export APK_TMP_DIR := $(realpath $(shell mktemp -d ../../tmp/build.XXXXXX 2>/dev/null || mktemp -d ../../../tmp/build.XXXXXX)) export APK_PACKAGE_NAME ?= $(PACKAGE_NAME) export APK_NORMALIZED_PACKAGE_VERSION := $(if $(subst false,,$(PACKAGE_PRERELEASE_ENABLED)),$(shell printf "%s" "$(PACKAGE_VERSION)" | sed -E 's/-([a-z]*)\.?/_\1/'),$(PACKAGE_VERSION)) export APK_PACKAGE_VERSION ?= $(APK_NORMALIZED_PACKAGE_VERSION) diff --git a/vendor/terraform-config-inspect/Makefile b/vendor/terraform-config-inspect/Makefile index 34ddabe1f5..962e68a5c2 100644 --- a/vendor/terraform-config-inspect/Makefile +++ b/vendor/terraform-config-inspect/Makefile @@ -18,7 +18,7 @@ version.go: VERSION go generate $(INSTALL_PATH)/$(PACKAGE_EXE): main.go version.go VERSION - chown 777 ../../tmp || echo Failed to chown ../../tmp from $(shell pwd -P) + chmod 777 ../../tmp || echo Failed to chmod ../../tmp from $(shell pwd -P) mkdir -p $(INSTALL_PATH) go build -o $(INSTALL_PATH)/$(PACKAGE_EXE) From 7253164313f480e6f8a9e8ff892a8687ccbb0771 Mon Sep 17 00:00:00 2001 From: Nuru Date: Mon, 7 Dec 2020 21:02:14 -0800 Subject: [PATCH 8/9] alakazam --- vendor/terraform-config-inspect/Makefile | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/vendor/terraform-config-inspect/Makefile b/vendor/terraform-config-inspect/Makefile index 962e68a5c2..898b105f02 100644 --- a/vendor/terraform-config-inspect/Makefile +++ b/vendor/terraform-config-inspect/Makefile @@ -18,7 +18,6 @@ version.go: VERSION go generate $(INSTALL_PATH)/$(PACKAGE_EXE): main.go version.go VERSION - chmod 777 ../../tmp || echo Failed to chmod ../../tmp from $(shell pwd -P) mkdir -p $(INSTALL_PATH) go build -o $(INSTALL_PATH)/$(PACKAGE_EXE) @@ -29,19 +28,12 @@ test: ## This may be required for apk building and varies from package to package # Custom post-package processing (Note the double colon to append to current inherited package/prepare task) +#package/prepare:: # echo cp src/gh_$(PACKAGE_VERSION)_$(OS)_$(ARCH)/bin/$(PACKAGE_EXE) src -package/prepare:: - echo CUSTOM PREPARE - echo cwd is $$(pwd) - echo APK_TMP_DIR is $(APK_TMP_DIR) - echo ls -l $(APK_TMP_DIR)/../.. - ls -l $(APK_TMP_DIR)/../.. - echo ls -l ../../ - ls -l ../../ - chmod 777 ../../tmp || echo could not chmod ../../tmp apk/prepare:: $(INSTALL_PATH)/$(PACKAGE_EXE) cp -p $(INSTALL_PATH)/$(PACKAGE_EXE) $(APK_TMP_DIR) + chown nobody $(APK_TMP_DIR)/$(PACKAGE_EXE) install: $(INSTALL_PATH)/$(PACKAGE_EXE) From 1b4db9b2d9ab40026253c1c926d588f30779f4f5 Mon Sep 17 00:00:00 2001 From: Nuru Date: Mon, 7 Dec 2020 21:27:42 -0800 Subject: [PATCH 9/9] Remove redundant failing mktemp --- tasks/Makefile.apk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tasks/Makefile.apk b/tasks/Makefile.apk index 69f063b35c..36f5e65902 100644 --- a/tasks/Makefile.apk +++ b/tasks/Makefile.apk @@ -26,7 +26,8 @@ export APK_PACKAGE_ENABLED := $(shell $(LOCAL_BIN)/package-filter apk-enabled "$ export APK_TEMPLATE_PATH ?= ../../apk/templates/ export APK_BUILD_TEMPLATE ?= APKBUILD.github-binary export APK_PACKAGES_PATH ?= /tmp/packages -export APK_TMP_DIR := $(realpath $(shell mktemp -d ../../tmp/build.XXXXXX 2>/dev/null || mktemp -d ../../../tmp/build.XXXXXX)) +APK_DEFAULT_TMP_DIR := $(realpath $(shell mktemp -d ../../tmp/build.XXXXXX)) +export APK_TMP_DIR ?= $(APK_DEFAULT_TMP_DIR) export APK_PACKAGE_NAME ?= $(PACKAGE_NAME) export APK_NORMALIZED_PACKAGE_VERSION := $(if $(subst false,,$(PACKAGE_PRERELEASE_ENABLED)),$(shell printf "%s" "$(PACKAGE_VERSION)" | sed -E 's/-([a-z]*)\.?/_\1/'),$(PACKAGE_VERSION)) export APK_PACKAGE_VERSION ?= $(APK_NORMALIZED_PACKAGE_VERSION)