From 492a5db6aefe3e091c65dd9026c52afbf675a8db Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Wed, 15 Jun 2022 22:24:28 +0800 Subject: [PATCH] chore: update drone build flow --- .drone.yml | 34 +++++++++++++--------------------- Makefile | 18 ++---------------- go.mod | 14 +++++++++++++- pipeline.libsonnet | 28 +++++++--------------------- 4 files changed, 35 insertions(+), 59 deletions(-) diff --git a/.drone.yml b/.drone.yml index 4cfc4ec..5fbabf0 100644 --- a/.drone.yml +++ b/.drone.yml @@ -7,7 +7,7 @@ platform: steps: - commands: - make vet - image: golang:1.17 + image: golang:1.18 name: vet pull: always volumes: @@ -15,26 +15,18 @@ steps: path: /go - commands: - make lint - image: golang:1.17 + image: golang:1.18 name: lint pull: always volumes: - name: gopath path: /go -- commands: - - make misspell-check - image: golang:1.17 - name: misspell - pull: always - volumes: - - name: gopath - path: /go - commands: - apk add git make curl perl bash build-base zlib-dev ucl-dev - make ssh-server - make test - make coverage - image: golang:1.17-alpine + image: golang:1.18-alpine name: test pull: always volumes: @@ -62,7 +54,7 @@ steps: - go build -v -ldflags '-X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/amd64/drone-ssh environment: CGO_ENABLED: "0" - image: golang:1.17 + image: golang:1.18 name: build-push pull: always when: @@ -74,7 +66,7 @@ steps: -a -o release/linux/amd64/drone-ssh environment: CGO_ENABLED: "0" - image: golang:1.17 + image: golang:1.18 name: build-tag pull: always when: @@ -82,7 +74,7 @@ steps: - tag - commands: - ./release/linux/amd64/drone-ssh --help - image: golang:1.17 + image: golang:1.18 name: executable pull: always - image: plugins/docker:linux-amd64 @@ -134,7 +126,7 @@ steps: - go build -v -ldflags '-X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/arm64/drone-ssh environment: CGO_ENABLED: "0" - image: golang:1.17 + image: golang:1.18 name: build-push pull: always when: @@ -146,7 +138,7 @@ steps: -a -o release/linux/arm64/drone-ssh environment: CGO_ENABLED: "0" - image: golang:1.17 + image: golang:1.18 name: build-tag pull: always when: @@ -154,7 +146,7 @@ steps: - tag - commands: - ./release/linux/arm64/drone-ssh --help - image: golang:1.17 + image: golang:1.18 name: executable pull: always - image: plugins/docker:linux-arm64 @@ -206,7 +198,7 @@ steps: - go build -v -ldflags '-X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/arm/drone-ssh environment: CGO_ENABLED: "0" - image: golang:1.17 + image: golang:1.18 name: build-push pull: always when: @@ -218,7 +210,7 @@ steps: -a -o release/linux/arm/drone-ssh environment: CGO_ENABLED: "0" - image: golang:1.17 + image: golang:1.18 name: build-tag pull: always when: @@ -226,7 +218,7 @@ steps: - tag - commands: - ./release/linux/arm/drone-ssh --help - image: golang:1.17 + image: golang:1.18 name: executable pull: always - image: plugins/docker:linux-arm @@ -276,7 +268,7 @@ platform: steps: - commands: - make release - image: golang:1.17 + image: golang:1.18 name: build-all-binary pull: always when: diff --git a/Makefile b/Makefile index 43e2cbe..1c29639 100644 --- a/Makefile +++ b/Makefile @@ -38,24 +38,10 @@ vet: lint: @hash revive > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ - $(GO) get -u github.com/mgechev/revive; \ + $(GO) install github.com/mgechev/revive; \ fi revive -config .revive.toml ./... || exit 1 -.PHONY: misspell-check -misspell-check: - @hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ - $(GO) get -u github.com/client9/misspell/cmd/misspell; \ - fi - misspell -error $(SOURCES) - -.PHONY: misspell -misspell: - @hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ - $(GO) get -u github.com/client9/misspell/cmd/misspell; \ - fi - misspell -w $(SOURCES) - .PHONY: fmt-check fmt-check: @hash gofumpt > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ @@ -86,7 +72,7 @@ release-dirs: release-build: @which gox > /dev/null; if [ $$? -ne 0 ]; then \ - $(GO) get -u github.com/mitchellh/gox; \ + $(GO) install github.com/mitchellh/gox; \ fi gox -os="$(TARGETS)" -arch="$(ARCHS)" -tags="$(TAGS)" -ldflags="-s -w $(LDFLAGS)" -output="$(DIST)/binaries/$(EXECUTABLE)-$(VERSION)-{{.OS}}-{{.Arch}}" diff --git a/go.mod b/go.mod index 6416370..66e07a3 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/appleboy/drone-ssh -go 1.14 +go 1.18 require ( github.com/appleboy/easyssh-proxy v1.3.7 @@ -9,3 +9,15 @@ require ( github.com/urfave/cli v1.22.4 golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de ) + +require ( + github.com/ScaleFT/sshkeys v0.0.0-20181112160850-82451a803681 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect + github.com/davecgh/go-spew v1.1.0 // indirect + github.com/dchest/bcrypt_pbkdf v0.0.0-20150205184540-83f37f9c154a // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/russross/blackfriday/v2 v2.0.1 // indirect + github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect + golang.org/x/sys v0.0.0-20190412213103-97732733099d // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect +) diff --git a/pipeline.libsonnet b/pipeline.libsonnet index 3e9097c..0d9a214 100644 --- a/pipeline.libsonnet +++ b/pipeline.libsonnet @@ -9,7 +9,7 @@ steps: [ { name: 'vet', - image: 'golang:1.17', + image: 'golang:1.18', pull: 'always', commands: [ 'make vet', @@ -23,7 +23,7 @@ }, { name: 'lint', - image: 'golang:1.17', + image: 'golang:1.18', pull: 'always', commands: [ 'make lint', @@ -35,23 +35,9 @@ }, ], }, - { - name: 'misspell', - image: 'golang:1.17', - pull: 'always', - commands: [ - 'make misspell-check', - ], - volumes: [ - { - name: 'gopath', - path: '/go', - }, - ], - }, { name: 'test', - image: 'golang:1.17-alpine', + image: 'golang:1.18-alpine', pull: 'always', commands: [ 'apk add git make curl perl bash build-base zlib-dev ucl-dev', @@ -93,7 +79,7 @@ steps: [ { name: 'build-push', - image: 'golang:1.17', + image: 'golang:1.18', pull: 'always', environment: { CGO_ENABLED: '0', @@ -109,7 +95,7 @@ }, { name: 'build-tag', - image: 'golang:1.17', + image: 'golang:1.18', pull: 'always', environment: { CGO_ENABLED: '0', @@ -123,7 +109,7 @@ }, { name: 'executable', - image: 'golang:1.17', + image: 'golang:1.18', pull: 'always', commands: [ './release/' + os + '/' + arch + '/' + name + ' --help', @@ -188,7 +174,7 @@ steps: [ { name: 'build-all-binary', - image: 'golang:1.17', + image: 'golang:1.18', pull: 'always', commands: [ 'make release'