mirror of
https://github.com/appleboy/drone-ssh.git
synced 2026-06-16 14:49:25 +08:00
Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8da3787c97 | |||
| bf419cebf8 | |||
| 7b141b72ae | |||
| 058dcd40d8 | |||
| 598a11a626 | |||
| 31c298bb19 | |||
| df6997a8e1 | |||
| 8c5823d726 | |||
| c643b61b1b | |||
| 7c482e315d | |||
| 07f8a59174 | |||
| f1ffd39895 | |||
| 040533909f | |||
| 5be4214887 | |||
| 906f6275a4 | |||
| 4a05db1fe7 | |||
| f1be0b3f99 | |||
| d296797a6f | |||
| 5525ed602f | |||
| 836fd2d711 | |||
| 307409651f | |||
| b937d64a58 | |||
| 1dcc9acbe5 |
@@ -1,16 +0,0 @@
|
||||
local pipeline = import 'pipeline.libsonnet';
|
||||
local name = 'drone-ssh';
|
||||
|
||||
[
|
||||
pipeline.test,
|
||||
pipeline.build(name, 'linux', 'amd64'),
|
||||
pipeline.build(name, 'linux', 'arm64'),
|
||||
pipeline.build(name, 'linux', 'arm'),
|
||||
pipeline.release,
|
||||
pipeline.notifications(depends_on=[
|
||||
'linux-amd64',
|
||||
'linux-arm64',
|
||||
'linux-arm',
|
||||
'release-binary',
|
||||
]),
|
||||
]
|
||||
-298
@@ -1,298 +0,0 @@
|
||||
---
|
||||
kind: pipeline
|
||||
name: testing
|
||||
platform:
|
||||
arch: amd64
|
||||
os: linux
|
||||
steps:
|
||||
- commands:
|
||||
- make vet
|
||||
image: golang:1.18
|
||||
name: vet
|
||||
pull: always
|
||||
volumes:
|
||||
- name: gopath
|
||||
path: /go
|
||||
- image: robertstettner/drone-codecov
|
||||
name: codecov
|
||||
pull: always
|
||||
settings:
|
||||
token:
|
||||
from_secret: codecov_token
|
||||
volumes:
|
||||
- name: gopath
|
||||
temp: {}
|
||||
---
|
||||
depends_on:
|
||||
- testing
|
||||
kind: pipeline
|
||||
name: linux-amd64
|
||||
platform:
|
||||
arch: amd64
|
||||
os: linux
|
||||
steps:
|
||||
- commands:
|
||||
- go build -v -ldflags '-X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/amd64/drone-ssh
|
||||
environment:
|
||||
CGO_ENABLED: "0"
|
||||
image: golang:1.18
|
||||
name: build-push
|
||||
pull: always
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- tag
|
||||
- commands:
|
||||
- go build -v -ldflags '-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}'
|
||||
-a -o release/linux/amd64/drone-ssh
|
||||
environment:
|
||||
CGO_ENABLED: "0"
|
||||
image: golang:1.18
|
||||
name: build-tag
|
||||
pull: always
|
||||
when:
|
||||
event:
|
||||
- tag
|
||||
- commands:
|
||||
- ./release/linux/amd64/drone-ssh --help
|
||||
image: golang:1.18
|
||||
name: executable
|
||||
pull: always
|
||||
- image: plugins/docker:linux-amd64
|
||||
name: dryrun
|
||||
pull: always
|
||||
settings:
|
||||
cache_from: appleboy/drone-ssh
|
||||
daemon_off: false
|
||||
dockerfile: docker/Dockerfile.linux.amd64
|
||||
dry_run: true
|
||||
repo: appleboy/drone-ssh
|
||||
tags: linux-amd64
|
||||
when:
|
||||
event:
|
||||
- pull_request
|
||||
- image: plugins/docker:linux-amd64
|
||||
name: publish
|
||||
pull: always
|
||||
settings:
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-amd64
|
||||
cache_from: appleboy/drone-ssh
|
||||
daemon_off: "false"
|
||||
dockerfile: docker/Dockerfile.linux.amd64
|
||||
password:
|
||||
from_secret: docker_password
|
||||
repo: appleboy/drone-ssh
|
||||
username:
|
||||
from_secret: docker_username
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- pull_request
|
||||
trigger:
|
||||
ref:
|
||||
- refs/heads/master
|
||||
- refs/pull/**
|
||||
- refs/tags/**
|
||||
---
|
||||
depends_on:
|
||||
- testing
|
||||
kind: pipeline
|
||||
name: linux-arm64
|
||||
platform:
|
||||
arch: arm64
|
||||
os: linux
|
||||
steps:
|
||||
- commands:
|
||||
- go build -v -ldflags '-X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/arm64/drone-ssh
|
||||
environment:
|
||||
CGO_ENABLED: "0"
|
||||
image: golang:1.18
|
||||
name: build-push
|
||||
pull: always
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- tag
|
||||
- commands:
|
||||
- go build -v -ldflags '-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}'
|
||||
-a -o release/linux/arm64/drone-ssh
|
||||
environment:
|
||||
CGO_ENABLED: "0"
|
||||
image: golang:1.18
|
||||
name: build-tag
|
||||
pull: always
|
||||
when:
|
||||
event:
|
||||
- tag
|
||||
- commands:
|
||||
- ./release/linux/arm64/drone-ssh --help
|
||||
image: golang:1.18
|
||||
name: executable
|
||||
pull: always
|
||||
- image: plugins/docker:linux-arm64
|
||||
name: dryrun
|
||||
pull: always
|
||||
settings:
|
||||
cache_from: appleboy/drone-ssh
|
||||
daemon_off: false
|
||||
dockerfile: docker/Dockerfile.linux.arm64
|
||||
dry_run: true
|
||||
repo: appleboy/drone-ssh
|
||||
tags: linux-arm64
|
||||
when:
|
||||
event:
|
||||
- pull_request
|
||||
- image: plugins/docker:linux-arm64
|
||||
name: publish
|
||||
pull: always
|
||||
settings:
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-arm64
|
||||
cache_from: appleboy/drone-ssh
|
||||
daemon_off: "false"
|
||||
dockerfile: docker/Dockerfile.linux.arm64
|
||||
password:
|
||||
from_secret: docker_password
|
||||
repo: appleboy/drone-ssh
|
||||
username:
|
||||
from_secret: docker_username
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- pull_request
|
||||
trigger:
|
||||
ref:
|
||||
- refs/heads/master
|
||||
- refs/pull/**
|
||||
- refs/tags/**
|
||||
---
|
||||
depends_on:
|
||||
- testing
|
||||
kind: pipeline
|
||||
name: linux-arm
|
||||
platform:
|
||||
arch: arm
|
||||
os: linux
|
||||
steps:
|
||||
- commands:
|
||||
- go build -v -ldflags '-X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/arm/drone-ssh
|
||||
environment:
|
||||
CGO_ENABLED: "0"
|
||||
image: golang:1.18
|
||||
name: build-push
|
||||
pull: always
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- tag
|
||||
- commands:
|
||||
- go build -v -ldflags '-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}'
|
||||
-a -o release/linux/arm/drone-ssh
|
||||
environment:
|
||||
CGO_ENABLED: "0"
|
||||
image: golang:1.18
|
||||
name: build-tag
|
||||
pull: always
|
||||
when:
|
||||
event:
|
||||
- tag
|
||||
- commands:
|
||||
- ./release/linux/arm/drone-ssh --help
|
||||
image: golang:1.18
|
||||
name: executable
|
||||
pull: always
|
||||
- image: plugins/docker:linux-arm
|
||||
name: dryrun
|
||||
pull: always
|
||||
settings:
|
||||
cache_from: appleboy/drone-ssh
|
||||
daemon_off: false
|
||||
dockerfile: docker/Dockerfile.linux.arm
|
||||
dry_run: true
|
||||
repo: appleboy/drone-ssh
|
||||
tags: linux-arm
|
||||
when:
|
||||
event:
|
||||
- pull_request
|
||||
- image: plugins/docker:linux-arm
|
||||
name: publish
|
||||
pull: always
|
||||
settings:
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-arm
|
||||
cache_from: appleboy/drone-ssh
|
||||
daemon_off: "false"
|
||||
dockerfile: docker/Dockerfile.linux.arm
|
||||
password:
|
||||
from_secret: docker_password
|
||||
repo: appleboy/drone-ssh
|
||||
username:
|
||||
from_secret: docker_username
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- pull_request
|
||||
trigger:
|
||||
ref:
|
||||
- refs/heads/master
|
||||
- refs/pull/**
|
||||
- refs/tags/**
|
||||
---
|
||||
depends_on:
|
||||
- testing
|
||||
kind: pipeline
|
||||
name: release-binary
|
||||
platform:
|
||||
arch: amd64
|
||||
os: linux
|
||||
steps:
|
||||
- commands:
|
||||
- export PATH=$PATH:$GOPATH/bin
|
||||
- make release
|
||||
image: techknowlogick/xgo:go-1.18.x
|
||||
name: build-all-binary
|
||||
pull: always
|
||||
when:
|
||||
event:
|
||||
- tag
|
||||
- image: plugins/github-release
|
||||
name: deploy-all-binary
|
||||
pull: always
|
||||
settings:
|
||||
api_key:
|
||||
from_secret: github_release_api_key
|
||||
files:
|
||||
- dist/release/*
|
||||
when:
|
||||
event:
|
||||
- tag
|
||||
trigger:
|
||||
ref:
|
||||
- refs/tags/**
|
||||
---
|
||||
depends_on:
|
||||
- linux-amd64
|
||||
- linux-arm64
|
||||
- linux-arm
|
||||
- release-binary
|
||||
kind: pipeline
|
||||
name: notifications
|
||||
platform:
|
||||
arch: amd64
|
||||
os: linux
|
||||
steps:
|
||||
- image: plugins/manifest
|
||||
name: manifest
|
||||
pull: always
|
||||
settings:
|
||||
ignore_missing: true
|
||||
password:
|
||||
from_secret: docker_password
|
||||
spec: docker/manifest.tmpl
|
||||
username:
|
||||
from_secret: docker_username
|
||||
trigger:
|
||||
ref:
|
||||
- refs/heads/master
|
||||
- refs/tags/**
|
||||
@@ -0,0 +1,138 @@
|
||||
name: Release Binary
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Setup go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: '^1'
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Build binary
|
||||
run : |
|
||||
make build_linux_amd64
|
||||
make build_linux_arm64
|
||||
make build_linux_arm
|
||||
|
||||
- name: Check binary
|
||||
run : |
|
||||
./release/linux/amd64/drone-ssh --help
|
||||
|
||||
-
|
||||
name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
-
|
||||
name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
-
|
||||
name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
-
|
||||
name: Docker meta for linux amd64
|
||||
id: meta-linux-amd64
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
flavor: |
|
||||
latest=false
|
||||
suffix=linux-amd64
|
||||
images: |
|
||||
appleboy/drone-ssh
|
||||
ghcr.io/appleboy/drone-ssh
|
||||
tags: |
|
||||
type=raw,value=,enable={{is_default_branch}}
|
||||
type=raw,value=latest,suffix=,enable={{is_default_branch}}
|
||||
type=semver,event=tag,pattern={{version}},suffix=-linux-amd64
|
||||
type=semver,event=tag,pattern={{major}}.{{minor}},suffix=-linux-amd64
|
||||
type=semver,event=tag,pattern={{major}},suffix=-linux-amd64
|
||||
|
||||
-
|
||||
name: Build and push linux amd64
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
file: docker/Dockerfile.linux.amd64
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: ${{ steps.meta-linux-amd64.outputs.tags }}
|
||||
labels: ${{ steps.meta-linux-amd64.outputs.labels }}
|
||||
|
||||
-
|
||||
name: Docker meta for linux arm64
|
||||
id: meta-linux-arm64
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
flavor: |
|
||||
latest=false
|
||||
suffix=linux-arm64
|
||||
images: |
|
||||
appleboy/drone-ssh
|
||||
ghcr.io/appleboy/drone-ssh
|
||||
tags: |
|
||||
type=raw,value=,enable={{is_default_branch}}
|
||||
type=semver,event=tag,pattern={{version}},suffix=-linux-arm64
|
||||
type=semver,event=tag,pattern={{major}}.{{minor}},suffix=-linux-arm64
|
||||
type=semver,event=tag,pattern={{major}},suffix=-linux-arm64
|
||||
|
||||
-
|
||||
name: Build and push linux arm64
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
file: docker/Dockerfile.linux.arm64
|
||||
platforms: linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta-linux-arm64.outputs.tags }}
|
||||
labels: ${{ steps.meta-linux-arm64.outputs.labels }}
|
||||
|
||||
-
|
||||
name: Docker meta for linux arm
|
||||
id: meta-linux-arm
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
flavor: |
|
||||
latest=false
|
||||
suffix=linux-arm
|
||||
images: |
|
||||
appleboy/drone-ssh
|
||||
ghcr.io/appleboy/drone-ssh
|
||||
tags: |
|
||||
type=raw,value=,enable={{is_default_branch}}
|
||||
type=semver,event=tag,pattern={{version}},suffix=-linux-arm
|
||||
type=semver,event=tag,pattern={{major}}.{{minor}},suffix=-linux-arm
|
||||
type=semver,event=tag,pattern={{major}},suffix=-linux-arm
|
||||
|
||||
-
|
||||
name: Build and push linux arm
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
file: docker/Dockerfile.linux.arm
|
||||
platforms: linux/arm
|
||||
push: true
|
||||
tags: ${{ steps.meta-linux-arm.outputs.tags }}
|
||||
labels: ${{ steps.meta-linux-arm.outputs.labels }}
|
||||
@@ -1,64 +0,0 @@
|
||||
name: Run Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Setup go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: '^1'
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
- name: Setup golangci-lint
|
||||
uses: golangci/golangci-lint-action@v3
|
||||
with:
|
||||
version: v1.46.2
|
||||
args: --verbose
|
||||
|
||||
# build:
|
||||
# strategy:
|
||||
# matrix:
|
||||
# os: [ubuntu-latest]
|
||||
# go: [ 1.18]
|
||||
# include:
|
||||
# - os: ubuntu-latest
|
||||
# go-build: ~/.cache/go-build
|
||||
# name: ${{ matrix.os }} @ Go ${{ matrix.go }}
|
||||
# runs-on: ${{ matrix.os }}
|
||||
# env:
|
||||
# GO111MODULE: on
|
||||
# GOPROXY: https://proxy.golang.org
|
||||
# steps:
|
||||
# - name: Set up Go ${{ matrix.go }}
|
||||
# uses: actions/setup-go@v3
|
||||
# with:
|
||||
# go-version: ${{ matrix.go }}
|
||||
|
||||
# - name: Checkout Code
|
||||
# uses: actions/checkout@v3
|
||||
# with:
|
||||
# ref: ${{ github.ref }}
|
||||
|
||||
# - uses: actions/cache@v3
|
||||
# with:
|
||||
# path: |
|
||||
# ${{ matrix.go-build }}
|
||||
# ~/go/pkg/mod
|
||||
# key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
# restore-keys: |
|
||||
# ${{ runner.os }}-go-
|
||||
# - name: initial docker
|
||||
# uses: docker-practice/actions-setup-docker@master
|
||||
# - name: build all binaries
|
||||
# run: |
|
||||
# set -x
|
||||
# make release
|
||||
@@ -0,0 +1,35 @@
|
||||
name: Goreleaser
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
goreleaser:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
-
|
||||
name: Setup go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: '^1'
|
||||
|
||||
-
|
||||
name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v4
|
||||
with:
|
||||
# either 'goreleaser' (default) or 'goreleaser-pro'
|
||||
distribution: goreleaser
|
||||
version: latest
|
||||
args: release --rm-dist
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -0,0 +1,25 @@
|
||||
name: Run Lint
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Setup go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: '^1'
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
- name: Setup golangci-lint
|
||||
uses: golangci/golangci-lint-action@v3
|
||||
with:
|
||||
version: latest
|
||||
args: --verbose
|
||||
@@ -39,24 +39,10 @@ else
|
||||
EXECUTABLE ?= $(EXECUTABLE)
|
||||
endif
|
||||
|
||||
STORED_VERSION_FILE := VERSION
|
||||
|
||||
ifneq ($(DRONE_TAG),)
|
||||
VERSION ?= $(subst v,,$(DRONE_TAG))
|
||||
RELASE_VERSION ?= $(VERSION)
|
||||
VERSION ?= $(DRONE_TAG)
|
||||
else
|
||||
ifneq ($(DRONE_BRANCH),)
|
||||
VERSION ?= $(subst release/v,,$(DRONE_BRANCH))
|
||||
else
|
||||
VERSION ?= master
|
||||
endif
|
||||
|
||||
STORED_VERSION=$(shell cat $(STORED_VERSION_FILE) 2>/dev/null)
|
||||
ifneq ($(STORED_VERSION),)
|
||||
RELASE_VERSION ?= $(STORED_VERSION)
|
||||
else
|
||||
RELASE_VERSION ?= $(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//')
|
||||
endif
|
||||
VERSION ?= $(shell git describe --tags --always || git rev-parse --short HEAD)
|
||||
endif
|
||||
|
||||
TAGS ?=
|
||||
@@ -133,7 +119,7 @@ deps-backend:
|
||||
$(GO) install $(XGO_PACKAGE)
|
||||
|
||||
.PHONY: release
|
||||
release: release-windows release-linux release-darwin release-copy release-compress release-check
|
||||
release: release-linux release-copy release-compress release-check
|
||||
|
||||
$(DIST_DIRS):
|
||||
mkdir -p $(DIST_DIRS)
|
||||
|
||||
@@ -8,5 +8,6 @@ LABEL maintainer="Bo-Yi Wu <appleboy.tw@gmail.com>" \
|
||||
RUN apk add --no-cache ca-certificates && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
ADD release/linux/amd64/drone-ssh /bin/
|
||||
COPY release/linux/amd64/drone-ssh /bin/
|
||||
|
||||
ENTRYPOINT ["/bin/drone-ssh"]
|
||||
|
||||
@@ -8,5 +8,6 @@ LABEL maintainer="Bo-Yi Wu <appleboy.tw@gmail.com>" \
|
||||
RUN apk add --no-cache ca-certificates && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
ADD release/linux/arm/drone-ssh /bin/
|
||||
COPY release/linux/arm/drone-ssh /bin/
|
||||
|
||||
ENTRYPOINT ["/bin/drone-ssh"]
|
||||
|
||||
@@ -8,5 +8,6 @@ LABEL maintainer="Bo-Yi Wu <appleboy.tw@gmail.com>" \
|
||||
RUN apk add --no-cache ca-certificates && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
ADD release/linux/arm64/drone-ssh /bin/
|
||||
COPY release/linux/arm64/drone-ssh /bin/
|
||||
|
||||
ENTRYPOINT ["/bin/drone-ssh"]
|
||||
|
||||
@@ -5,18 +5,18 @@ go 1.18
|
||||
require (
|
||||
github.com/appleboy/easyssh-proxy v1.3.9
|
||||
github.com/joho/godotenv v1.4.0
|
||||
github.com/stretchr/testify v1.7.2
|
||||
github.com/urfave/cli v1.22.9
|
||||
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e
|
||||
github.com/stretchr/testify v1.8.1
|
||||
github.com/urfave/cli v1.22.10
|
||||
golang.org/x/crypto v0.4.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/ScaleFT/sshkeys v0.0.0-20200327173127-6142f742bca5 // indirect
|
||||
github.com/ScaleFT/sshkeys v1.2.0 // indirect
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
|
||||
github.com/davecgh/go-spew v1.1.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // 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.1.0 // indirect
|
||||
golang.org/x/sys v0.0.0-20220614162138-6c1b26c55098 // indirect
|
||||
golang.org/x/sys v0.3.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/ScaleFT/sshkeys v0.0.0-20200327173127-6142f742bca5 h1:VauE2GcJNZFun2Och6tIT2zJZK1v6jxALQDA9BIji/E=
|
||||
github.com/ScaleFT/sshkeys v0.0.0-20200327173127-6142f742bca5/go.mod h1:gxOHeajFfvGQh/fxlC8oOKBe23xnnJTif00IFFbiT+o=
|
||||
github.com/ScaleFT/sshkeys v1.2.0 h1:5BRp6rTVIhJzXT3VcUQrKgXR8zWA3sOsNeuyW15WUA8=
|
||||
github.com/ScaleFT/sshkeys v1.2.0/go.mod h1:gxOHeajFfvGQh/fxlC8oOKBe23xnnJTif00IFFbiT+o=
|
||||
github.com/appleboy/easyssh-proxy v1.3.9 h1:b+sVSTz+cVFvfA23HQywMMpm0s5g3gH7jYdBcQqaCQI=
|
||||
github.com/appleboy/easyssh-proxy v1.3.9/go.mod h1:G1eQomBEME7NWKA3hE49s5HsT44S5fn0aBxX7k9Yjug=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||
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/dchest/bcrypt_pbkdf v0.0.0-20150205184540-83f37f9c154a h1:saTgr5tMLFnmy/yg3qDTft4rE5DY2uJ/cCxCe3q0XTU=
|
||||
github.com/dchest/bcrypt_pbkdf v0.0.0-20150205184540-83f37f9c154a/go.mod h1:Bw9BbhOJVNR+t0jCqx2GC6zv0TGBsShs56Y3gfSCvl0=
|
||||
github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg=
|
||||
@@ -19,26 +21,30 @@ github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
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/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.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s=
|
||||
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
|
||||
github.com/urfave/cli v1.22.9 h1:cv3/KhXGBGjEXLC4bH0sLuJ9BewaAbpk5oyMOveu4pw=
|
||||
github.com/urfave/cli v1.22.9/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||
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/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-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
||||
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e h1:T8NU3HyQ8ClP4SEE+KbFlg6n0NhuTsN4MyznaarGsZM=
|
||||
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
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/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200219091948-cb0a6d8edb6c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20220614162138-6c1b26c55098 h1:PgOr27OhUx2IRqGJ2RxAWI4dJQ7bi9cSrB82uzFzfUA=
|
||||
golang.org/x/sys v0.0.0-20220614162138-6c1b26c55098/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ=
|
||||
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
|
||||
golang.org/x/term v0.3.0 h1:qoo4akIqOcDME5bhc/NgxUdovd6BSS2uMsVjB56q1xI=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
|
||||
@@ -1,229 +0,0 @@
|
||||
{
|
||||
test:: {
|
||||
kind: 'pipeline',
|
||||
name: 'testing',
|
||||
platform: {
|
||||
os: 'linux',
|
||||
arch: 'amd64',
|
||||
},
|
||||
steps: [
|
||||
{
|
||||
name: 'vet',
|
||||
image: 'golang:1.18',
|
||||
pull: 'always',
|
||||
commands: [
|
||||
'make vet',
|
||||
],
|
||||
volumes: [
|
||||
{
|
||||
name: 'gopath',
|
||||
path: '/go',
|
||||
},
|
||||
],
|
||||
},
|
||||
// {
|
||||
// name: 'test',
|
||||
// image: 'golang:1.18-alpine',
|
||||
// pull: 'always',
|
||||
// commands: [
|
||||
// 'apk add git make curl perl bash build-base zlib-dev ucl-dev',
|
||||
// 'make ssh-server',
|
||||
// 'make test',
|
||||
// 'make coverage',
|
||||
// ],
|
||||
// volumes: [
|
||||
// {
|
||||
// name: 'gopath',
|
||||
// path: '/go',
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
{
|
||||
name: 'codecov',
|
||||
image: 'robertstettner/drone-codecov',
|
||||
pull: 'always',
|
||||
settings: {
|
||||
token: { 'from_secret': 'codecov_token' },
|
||||
},
|
||||
},
|
||||
],
|
||||
volumes: [
|
||||
{
|
||||
name: 'gopath',
|
||||
temp: {},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
build(name, os='linux', arch='amd64'):: {
|
||||
kind: 'pipeline',
|
||||
name: os + '-' + arch,
|
||||
platform: {
|
||||
os: os,
|
||||
arch: arch,
|
||||
},
|
||||
steps: [
|
||||
{
|
||||
name: 'build-push',
|
||||
image: 'golang:1.18',
|
||||
pull: 'always',
|
||||
environment: {
|
||||
CGO_ENABLED: '0',
|
||||
},
|
||||
commands: [
|
||||
'go build -v -ldflags \'-X main.build=${DRONE_BUILD_NUMBER}\' -a -o release/' + os + '/' + arch + '/' + name,
|
||||
],
|
||||
when: {
|
||||
event: {
|
||||
exclude: [ 'tag' ],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'build-tag',
|
||||
image: 'golang:1.18',
|
||||
pull: 'always',
|
||||
environment: {
|
||||
CGO_ENABLED: '0',
|
||||
},
|
||||
commands: [
|
||||
'go build -v -ldflags \'-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\' -a -o release/' + os + '/' + arch + '/' + name,
|
||||
],
|
||||
when: {
|
||||
event: [ 'tag' ],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'executable',
|
||||
image: 'golang:1.18',
|
||||
pull: 'always',
|
||||
commands: [
|
||||
'./release/' + os + '/' + arch + '/' + name + ' --help',
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'dryrun',
|
||||
image: 'plugins/docker:' + os + '-' + arch,
|
||||
pull: 'always',
|
||||
settings: {
|
||||
daemon_off: false,
|
||||
dry_run: true,
|
||||
tags: os + '-' + arch,
|
||||
dockerfile: 'docker/Dockerfile.' + os + '.' + arch,
|
||||
repo: 'appleboy/' + name,
|
||||
cache_from: 'appleboy/' + name,
|
||||
},
|
||||
when: {
|
||||
event: [ 'pull_request' ],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'publish',
|
||||
image: 'plugins/docker:' + os + '-' + arch,
|
||||
pull: 'always',
|
||||
settings: {
|
||||
daemon_off: 'false',
|
||||
auto_tag: true,
|
||||
auto_tag_suffix: os + '-' + arch,
|
||||
dockerfile: 'docker/Dockerfile.' + os + '.' + arch,
|
||||
repo: 'appleboy/' + name,
|
||||
cache_from: 'appleboy/' + name,
|
||||
username: { 'from_secret': 'docker_username' },
|
||||
password: { 'from_secret': 'docker_password' },
|
||||
},
|
||||
when: {
|
||||
event: {
|
||||
exclude: [ 'pull_request' ],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
depends_on: [
|
||||
'testing',
|
||||
],
|
||||
trigger: {
|
||||
ref: [
|
||||
'refs/heads/master',
|
||||
'refs/pull/**',
|
||||
'refs/tags/**',
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
release:: {
|
||||
kind: 'pipeline',
|
||||
name: 'release-binary',
|
||||
platform: {
|
||||
os: 'linux',
|
||||
arch: 'amd64',
|
||||
},
|
||||
steps: [
|
||||
{
|
||||
name: 'build-all-binary',
|
||||
image: 'techknowlogick/xgo:go-1.18.x',
|
||||
pull: 'always',
|
||||
commands: [
|
||||
'export PATH=$PATH:$GOPATH/bin',
|
||||
'make release'
|
||||
],
|
||||
when: {
|
||||
event: [ 'tag' ],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'deploy-all-binary',
|
||||
image: 'plugins/github-release',
|
||||
pull: 'always',
|
||||
settings: {
|
||||
files: [ 'dist/release/*' ],
|
||||
api_key: { 'from_secret': 'github_release_api_key' },
|
||||
},
|
||||
when: {
|
||||
event: [ 'tag' ],
|
||||
},
|
||||
},
|
||||
],
|
||||
depends_on: [
|
||||
'testing',
|
||||
],
|
||||
trigger: {
|
||||
ref: [
|
||||
'refs/tags/**',
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
notifications(os='linux', arch='amd64', depends_on=[]):: {
|
||||
kind: 'pipeline',
|
||||
name: 'notifications',
|
||||
platform: {
|
||||
os: os,
|
||||
arch: arch,
|
||||
},
|
||||
steps: [
|
||||
{
|
||||
name: 'manifest',
|
||||
image: 'plugins/manifest',
|
||||
pull: 'always',
|
||||
settings: {
|
||||
username: { from_secret: 'docker_username' },
|
||||
password: { from_secret: 'docker_password' },
|
||||
spec: 'docker/manifest.tmpl',
|
||||
ignore_missing: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
depends_on: depends_on,
|
||||
trigger: {
|
||||
ref: [
|
||||
'refs/heads/master',
|
||||
'refs/tags/**',
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
signature(key):: {
|
||||
kind: 'signature',
|
||||
hmac: key,
|
||||
}
|
||||
}
|
||||
@@ -127,9 +127,13 @@ func (p Plugin) exec(host string, wg *sync.WaitGroup, errChannel chan error) {
|
||||
case isTimeout = <-doneChan:
|
||||
break loop
|
||||
case outline := <-stdoutChan:
|
||||
p.log(host, "out:", outline)
|
||||
if outline != "" {
|
||||
p.log(host, "out:", outline)
|
||||
}
|
||||
case errline := <-stderrChan:
|
||||
p.log(host, "err:", errline)
|
||||
if errline != "" {
|
||||
p.log(host, "err:", errline)
|
||||
}
|
||||
case err = <-errChan:
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -3,7 +3,6 @@ package main
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"reflect"
|
||||
"strings"
|
||||
@@ -410,7 +409,7 @@ func TestWrongFingerprint(t *testing.T) {
|
||||
func getHostPublicKeyFile(keypath string) (ssh.PublicKey, error) {
|
||||
var pubkey ssh.PublicKey
|
||||
var err error
|
||||
buf, err := ioutil.ReadFile(keypath)
|
||||
buf, err := os.ReadFile(keypath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user