From c51e841585916f23a1eccb3c6572fa4de089c9be Mon Sep 17 00:00:00 2001 From: TP Honey Date: Fri, 16 Dec 2022 10:19:14 +0000 Subject: [PATCH] (maint) move to harness.drone.io --- .drone.yml | 476 ++++++++---------- docker/Dockerfile.linux.arm | 19 - ...ndows.1803 => Dockerfile.windows.ltsc2022} | 2 +- docker/manifest.tmpl | 14 +- go.mod | 30 +- go.sum | 72 ++- plugin.go | 6 +- 7 files changed, 282 insertions(+), 337 deletions(-) delete mode 100644 docker/Dockerfile.linux.arm rename docker/{Dockerfile.windows.1803 => Dockerfile.windows.ltsc2022} (87%) diff --git a/.drone.yml b/.drone.yml index 61c0aa3..dc4ff21 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,326 +1,254 @@ ---- kind: pipeline +type: vm name: testing - platform: os: linux arch: amd64 +pool: + use: ubuntu steps: -- name: vet - pull: always - image: golang:1.11 - commands: - - go vet ./... - environment: - GO111MODULE: on - volumes: - - name: gopath - path: /go - -- name: test - pull: always - image: golang:1.11 - commands: - - go test -cover ./... - environment: - GO111MODULE: on - volumes: - - name: gopath - path: /go - + - name: lint + image: golang:1.19 + pull: always + commands: + - go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest + - golangci-lint version + - golangci-lint run + volumes: + - name: gopath + path: "/go" + - name: test + image: golang:1.19 + commands: + - go test -cover ./... + volumes: + - name: gopath + path: "/go" volumes: -- name: gopath - temp: {} - + - name: gopath + temp: {} trigger: ref: - - refs/heads/master - - "refs/tags/**" - - "refs/pull/**" + - refs/heads/master + - refs/tags/** + - refs/pull/** --- kind: pipeline +type: vm name: linux-amd64 - platform: os: linux arch: amd64 +pool: + use: ubuntu steps: -- name: build-push - pull: always - image: golang:1.11 - commands: - - "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/amd64/drone-manifest" - environment: - CGO_ENABLED: 0 - GO111MODULE: on - when: - event: - exclude: - - tag - -- name: build-tag - pull: always - image: golang:1.11 - commands: - - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/amd64/drone-manifest" - environment: - CGO_ENABLED: 0 - GO111MODULE: on - when: - event: - - tag - -- name: executable - pull: always - image: golang:1.11 - commands: - - ./release/linux/amd64/drone-manifest --help - -- name: dryrun - pull: always - image: plugins/docker - settings: - daemon_off: false - dockerfile: docker/Dockerfile.linux.amd64 - dry_run: true - password: - from_secret: docker_password - repo: plugins/manifest - tags: linux-amd64 - username: - from_secret: docker_username - when: - event: - - pull_request - -- name: publish - pull: always - image: plugins/docker - settings: - auto_tag: true - auto_tag_suffix: linux-amd64 - daemon_off: false - dockerfile: docker/Dockerfile.linux.amd64 - password: - from_secret: docker_password - repo: plugins/manifest - username: - from_secret: docker_username - when: - event: - exclude: - - pull_request - + - name: environment + image: golang:1.19 + pull: always + environment: + CGO_ENABLED: "0" + commands: + - go version + - go env + - name: build + image: golang:1.19 + environment: + CGO_ENABLED: "0" + commands: + - go build -v -ldflags "-X main.version=" -a -tags netgo -o release/linux/amd64/drone-manifest . + - name: docker + image: plugins/docker + settings: + dockerfile: docker/Dockerfile.linux.amd64 + repo: plugins/manifest + username: + from_secret: docker_username + password: + from_secret: docker_password + auto_tag: true + auto_tag_suffix: linux-amd64 +depends_on: + - testing trigger: ref: - - refs/heads/master - - "refs/tags/**" - - "refs/pull/**" - -depends_on: -- testing + - refs/heads/master + - refs/tags/** + - refs/pull/** --- kind: pipeline +type: vm name: linux-arm64 - platform: os: linux arch: arm64 +pool: + use: ubuntu_arm64 steps: -- name: build-push - pull: always - image: golang:1.11 - commands: - - "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/arm64/drone-manifest" - environment: - CGO_ENABLED: 0 - GO111MODULE: on - when: - event: - exclude: - - tag - -- name: build-tag - pull: always - image: golang:1.11 - commands: - - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/arm64/drone-manifest" - environment: - CGO_ENABLED: 0 - GO111MODULE: on - when: - event: - - tag - -- name: executable - pull: always - image: golang:1.11 - commands: - - ./release/linux/arm64/drone-manifest --help - -- name: dryrun - pull: always - image: plugins/docker - settings: - daemon_off: false - dockerfile: docker/Dockerfile.linux.arm64 - dry_run: true - password: - from_secret: docker_password - repo: plugins/manifest - tags: linux-arm64 - username: - from_secret: docker_username - when: - event: - - pull_request - -- name: publish - pull: always - image: plugins/docker - settings: - auto_tag: true - auto_tag_suffix: linux-arm64 - daemon_off: false - dockerfile: docker/Dockerfile.linux.arm64 - password: - from_secret: docker_password - repo: plugins/manifest - username: - from_secret: docker_username - when: - event: - exclude: - - pull_request - + - name: environment + image: golang:1.19 + pull: always + environment: + CGO_ENABLED: "0" + commands: + - go version + - go env + - name: build + image: golang:1.19 + environment: + CGO_ENABLED: "0" + commands: + - go build -v -ldflags "-X main.version=" -a -tags netgo -o release/linux/arm64/drone-manifest . + - name: docker + image: plugins/docker + settings: + dockerfile: docker/Dockerfile.linux.arm64 + repo: plugins/manifest + username: + from_secret: docker_username + password: + from_secret: docker_password + auto_tag: true + auto_tag_suffix: linux-arm64 +depends_on: + - testing trigger: ref: - - refs/heads/master - - "refs/tags/**" - - "refs/pull/**" - -depends_on: -- testing + - refs/heads/master + - refs/tags/** + - refs/pull/** --- kind: pipeline -name: linux-arm - +type: vm +name: windows-1809 platform: - os: linux - arch: arm + os: windows + arch: amd64 +pool: + use: windows steps: -- name: build-push - pull: always - image: golang:1.11 - commands: - - "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/arm/drone-manifest" - environment: - CGO_ENABLED: 0 - GO111MODULE: on - when: - event: - exclude: - - tag - -- name: build-tag - pull: always - image: golang:1.11 - commands: - - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/arm/drone-manifest" - environment: - CGO_ENABLED: 0 - GO111MODULE: on - when: - event: - - tag - -- name: executable - pull: always - image: golang:1.11 - commands: - - ./release/linux/arm/drone-manifest --help - -- name: dryrun - pull: always - image: plugins/docker - settings: - daemon_off: false - dockerfile: docker/Dockerfile.linux.arm - dry_run: true - password: - from_secret: docker_password - repo: plugins/manifest - tags: linux-arm - username: - from_secret: docker_username - when: - event: - - pull_request - -- name: publish - pull: always - image: plugins/docker - settings: - auto_tag: true - auto_tag_suffix: linux-arm - daemon_off: false - dockerfile: docker/Dockerfile.linux.arm - password: - from_secret: docker_password - repo: plugins/manifest - username: - from_secret: docker_username - when: - event: - exclude: - - pull_request - + - name: environment + image: golang:1.19 + pull: always + environment: + CGO_ENABLED: "0" + commands: + - go version + - go env + - name: build + image: golang:1.19 + environment: + CGO_ENABLED: "0" + commands: + - go build -v -ldflags "-X main.version=" -a -tags netgo -o release/windows/amd64/drone-manifest.exe . + - name: docker + image: plugins/docker + settings: + dockerfile: docker/Dockerfile.windows.1809 + repo: plugins/manifest + username: + from_secret: docker_username + password: + from_secret: docker_password + auto_tag: true + auto_tag_suffix: windows-1809-amd64 + daemon_off: true + purge: false + when: + ref: + - refs/heads/master + - refs/tags/** +depends_on: + - testing trigger: ref: - - refs/heads/master - - "refs/tags/**" - - "refs/pull/**" + - refs/heads/master + - refs/tags/** + - refs/pull/** + +--- +kind: pipeline +type: vm +name: windows-ltsc2022 +platform: + os: windows + arch: amd64 +pool: + use: windows-2022 +steps: + - name: environment + image: golang:1.19 + pull: always + environment: + CGO_ENABLED: "0" + commands: + - go version + - go env + - name: build + image: golang:1.19 + environment: + CGO_ENABLED: "0" + commands: + - go build -v -ldflags "-X main.version=" -a -tags netgo -o release/windows/amd64/drone-manifest.exe . + - name: docker + image: plugins/docker + settings: + dockerfile: docker/Dockerfile.windows.ltsc2022 + repo: plugins/manifest + username: + from_secret: docker_username + password: + from_secret: docker_password + auto_tag: true + auto_tag_suffix: windows-ltsc2022-amd64 + daemon_off: true + purge: false + when: + ref: + - refs/heads/master + - refs/tags/** depends_on: -- testing + - testing +trigger: + ref: + - refs/heads/master + - refs/tags/** + - refs/pull/** --- kind: pipeline -name: notifications - +type: vm +name: manifest platform: os: linux arch: amd64 +pool: + use: ubuntu steps: -- name: manifest - pull: always - image: plugins/manifest - settings: - dump: true - auto_tag: true - ignore_missing: true - password: - from_secret: docker_password - spec: docker/manifest.tmpl - username: - from_secret: docker_username - + - name: manifest + image: plugins/manifest + settings: + auto_tag: "true" + username: + from_secret: docker_username + password: + from_secret: docker_password + spec: docker/manifest.tmpl + ignore_missing: true +depends_on: + - linux-amd64 + - linux-arm64 + - windows-1809 + - windows-ltsc2022 trigger: ref: - - refs/heads/master - - "refs/tags/**" - -depends_on: -- linux-amd64 -- linux-arm64 -- linux-arm - -... + - refs/heads/master + - refs/tags/** diff --git a/docker/Dockerfile.linux.arm b/docker/Dockerfile.linux.arm deleted file mode 100644 index 2bc33e3..0000000 --- a/docker/Dockerfile.linux.arm +++ /dev/null @@ -1,19 +0,0 @@ -FROM alpine:3.10 as base - -ENV MANIFEST_TOOL_VERSION 1.0.2 - -RUN apk add --no-cache curl && \ - curl -sSLo /bin/manifest-tool https://github.com/estesp/manifest-tool/releases/download/v${MANIFEST_TOOL_VERSION}/manifest-tool-linux-armv7 && \ - chmod +x /bin/manifest-tool - -FROM plugins/base:multiarch - -LABEL maintainer="Drone.IO Community " \ - org.label-schema.name="Drone Manifest" \ - org.label-schema.vendor="Drone.IO Community" \ - org.label-schema.schema-version="1.0" - -COPY --from=base /bin/manifest-tool /bin/ - -ADD release/linux/arm/drone-manifest /bin/ -ENTRYPOINT ["/bin/drone-manifest"] diff --git a/docker/Dockerfile.windows.1803 b/docker/Dockerfile.windows.ltsc2022 similarity index 87% rename from docker/Dockerfile.windows.1803 rename to docker/Dockerfile.windows.ltsc2022 index a5ef9ac..96eb606 100644 --- a/docker/Dockerfile.windows.1803 +++ b/docker/Dockerfile.windows.ltsc2022 @@ -1,5 +1,5 @@ # escape=` -FROM plugins/base:windows-1803-amd64 +FROM plugins/base:windows-ltsc2022-amd64@sha256:0f90d5bceb432f1ee6f93cf44eed6a38c322834edd55df8a6648c9e6f15131f4 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] diff --git a/docker/manifest.tmpl b/docker/manifest.tmpl index cd5d3e5..033a248 100644 --- a/docker/manifest.tmpl +++ b/docker/manifest.tmpl @@ -18,20 +18,14 @@ manifests: os: linux variant: v8 - - image: plugins/manifest:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm - platform: - architecture: arm - os: linux - variant: v7 - - - image: plugins/manifest:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803-amd64 + image: plugins/manifest:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809-amd64 platform: architecture: amd64 os: windows - version: 1803 + version: 1809 - - image: plugins/manifest:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809-amd64 + image: plugins/manifest:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-ltsc2022-amd64 platform: architecture: amd64 os: windows - version: 1809 + version: ltsc2022 \ No newline at end of file diff --git a/go.mod b/go.mod index b35c094..74dbb83 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,29 @@ module github.com/drone-plugins/drone-manifest +go 1.19 + require ( - github.com/bouk/monkey v1.0.0 // indirect - github.com/coreos/go-semver v0.2.0 + github.com/coreos/go-semver v0.3.0 github.com/drone/drone-template-lib v0.0.0-20190801203641-b3f90dc7cabc - github.com/pkg/errors v0.8.1 - github.com/stretchr/testify v1.3.0 // indirect - github.com/urfave/cli v0.0.0-20180821064027-934abfb2f102 - gopkg.in/yaml.v2 v2.2.2 // indirect + github.com/pkg/errors v0.9.1 + github.com/urfave/cli v1.22.10 +) + +require ( + github.com/Masterminds/goutils v1.1.1 // indirect + github.com/Masterminds/semver v1.5.0 // indirect + github.com/Masterminds/sprig v2.22.0+incompatible // indirect + github.com/aymerick/raymond v2.0.2+incompatible // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect + github.com/google/uuid v1.3.0 // indirect + github.com/huandu/xstrings v1.4.0 // indirect + github.com/imdario/mergo v0.3.13 // indirect + github.com/mitchellh/copystructure v1.2.0 // indirect + github.com/mitchellh/reflectwalk v1.0.2 // indirect + github.com/russross/blackfriday/v2 v2.0.1 // indirect + github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect + github.com/stretchr/testify v1.8.1 // indirect + golang.org/x/crypto v0.4.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index c98d2d2..485eec0 100644 --- a/go.sum +++ b/go.sum @@ -1,48 +1,72 @@ +bou.ke/monkey v1.0.1 h1:zEMLInw9xvNakzUUPjfS4Ds6jYPqCFx3m7bRmG5NH2U= bou.ke/monkey v1.0.1/go.mod h1:FgHuK96Rv2Nlf+0u1OOVDpCMdsWyOFmeeketDHE7LIg= -github.com/Masterminds/goutils v1.1.0 h1:zukEsf/1JZwCMgHiK3GZftabmxiCw4apj3a28RPBiVg= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= -github.com/Masterminds/semver v1.4.2 h1:WBLTQ37jOCzSLtXNdoo8bNM8876KhNqOKvrlGITgsTc= +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 v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= -github.com/Masterminds/sprig v2.18.0+incompatible h1:QoGhlbC6pter1jxKnjMFxT8EqsLuDE6FEcNbWEpw+lI= -github.com/Masterminds/sprig v2.18.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= -github.com/Masterminds/sprig v2.20.0+incompatible h1:dJTKKuUkYW3RMFdQFXPU/s6hg10RgctmTjRcbZ98Ap8= +github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= +github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Masterminds/sprig v2.20.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= +github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60= +github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= github.com/aymerick/raymond v2.0.2+incompatible h1:VEp3GpgdAnv9B2GFyTvqgcKvY+mfKMjPOA3SbKLtnU0= github.com/aymerick/raymond v2.0.2+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= -github.com/bouk/monkey v1.0.0/go.mod h1:PG/63f4XEUlVyW1ttIeOJmJhhe1+t9EC/je3eTjvFhE= -github.com/coreos/go-semver v0.2.0 h1:3Jm3tLmsgAYcjC+4Up7hJrFBPr+n7rAqYeSw/SZazuY= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/drone/drone-template-lib v0.0.0-20190801203641-b3f90dc7cabc h1:9OGyB12S8hsgr6zTPEGIqpyMptUXPFSA6kpt+W0BasU= github.com/drone/drone-template-lib v0.0.0-20190801203641-b3f90dc7cabc/go.mod h1:t/pyHx6y2nrLHJFCxuMPAOq0QwC9p8jimznjjFzmbkE= -github.com/drone/drone-template-lib v1.0.0 h1:PNBBfUhifRnrPCoWBlTitk3jipXdv8u8WLbIf7h7j00= -github.com/drone/drone-template-lib v1.0.0/go.mod h1:Hqy1tgqPH5mtbFOZmow19l4jOkZvp+WZ00cB4W3MJhg= -github.com/google/uuid v1.1.0 h1:Jf4mxPC/ziBnoPIdpQdPJ9OeiomAUHLvxmPRSPH9m4s= -github.com/google/uuid v1.1.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/huandu/xstrings v1.2.0 h1:yPeWdRnmynF7p+lLYz0H2tthW9lqhMJrQV/U7yy4wX0= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4= -github.com/imdario/mergo v0.3.7 h1:Y+UAYTZ7gDEuOfhxKWy+dvb5dRQ6rJjFSdX2HZY1/gI= +github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU= +github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/imdario/mergo v0.3.7/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= +github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= +github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= +github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= +github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= +github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/tkuchiki/faketime v0.0.0-20170607100027-a4500a4f4643/go.mod h1:RXY/TXAwGGL36IKDjrHFMcjpUrEiyWSEtLhFPw3UWF0= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/tkuchiki/faketime v0.1.1 h1:UZjBlktFAi23wo+jWuHuNoHUpLnB0j/5B62bl5nCPls= github.com/tkuchiki/faketime v0.1.1/go.mod h1:RXY/TXAwGGL36IKDjrHFMcjpUrEiyWSEtLhFPw3UWF0= -github.com/urfave/cli v0.0.0-20180821064027-934abfb2f102 h1:Er7kUEUX12vAWCp23Uv6Nrza7kEzEm/Z77amjMT7/Lo= -github.com/urfave/cli v0.0.0-20180821064027-934abfb2f102/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +github.com/urfave/cli v1.22.10 h1:p8Fspmz3iTctJstry1PYS3HVdllxnEzTEsgIgtxTrCk= +github.com/urfave/cli v1.22.10/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8= +golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 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/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/plugin.go b/plugin.go index 2c6e1f2..8f4d547 100644 --- a/plugin.go +++ b/plugin.go @@ -2,7 +2,7 @@ package main import ( "fmt" - "io/ioutil" + "log" "os" "os/exec" @@ -98,7 +98,7 @@ func (p *Plugin) Exec() error { if _, err := os.Stat(p.Config.Spec); os.IsNotExist(err) { raw = []byte(p.Config.Spec) } else { // otherwise read it - raw, err = ioutil.ReadFile(p.Config.Spec) + raw, err = os.ReadFile(p.Config.Spec) if err != nil { return errors.Wrap(err, "failed to read template") @@ -111,7 +111,7 @@ func (p *Plugin) Exec() error { return errors.Wrap(err, "failed to render template") } - tmpfile, err := ioutil.TempFile(p.Build.Path, "manifest-") + tmpfile, err := os.CreateTemp(p.Build.Path, "manifest-") if err != nil { return errors.Wrap(err, "failed to create tempfile")