mirror of
https://github.com/appleboy/drone-scp.git
synced 2026-06-14 05:12:37 +08:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c66c78f88f | |||
| 9723eea384 | |||
| 14ec2704bd | |||
| a1482e89a3 | |||
| 9bf9ed00a4 | |||
| 6bc14e020b | |||
| c309cf901d | |||
| 4c5df18366 | |||
| 5ec7c1ddf8 | |||
| 1c9314ed83 | |||
| 5672c1219f | |||
| 9d29c82de6 | |||
| 1f8d333b42 | |||
| 50338d5bb1 | |||
| 6d8c114979 | |||
| c5c8b4021f | |||
| 4a81a55a53 | |||
| 9aef844da2 | |||
| 6a4996cd63 | |||
| 5053fc6aee |
@@ -1,16 +0,0 @@
|
|||||||
local pipeline = import 'pipeline.libsonnet';
|
|
||||||
local name = 'drone-scp';
|
|
||||||
|
|
||||||
[
|
|
||||||
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',
|
|
||||||
]),
|
|
||||||
]
|
|
||||||
-297
@@ -1,297 +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-scp
|
|
||||||
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-scp
|
|
||||||
environment:
|
|
||||||
CGO_ENABLED: "0"
|
|
||||||
image: golang:1.18
|
|
||||||
name: build-tag
|
|
||||||
pull: always
|
|
||||||
when:
|
|
||||||
event:
|
|
||||||
- tag
|
|
||||||
- commands:
|
|
||||||
- ./release/linux/amd64/drone-scp --help
|
|
||||||
image: golang:1.18
|
|
||||||
name: executable
|
|
||||||
pull: always
|
|
||||||
- image: plugins/docker:linux-amd64
|
|
||||||
name: dryrun
|
|
||||||
pull: always
|
|
||||||
settings:
|
|
||||||
cache_from: appleboy/drone-scp
|
|
||||||
daemon_off: false
|
|
||||||
dockerfile: docker/Dockerfile.linux.amd64
|
|
||||||
dry_run: true
|
|
||||||
repo: appleboy/drone-scp
|
|
||||||
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-scp
|
|
||||||
daemon_off: "false"
|
|
||||||
dockerfile: docker/Dockerfile.linux.amd64
|
|
||||||
password:
|
|
||||||
from_secret: docker_password
|
|
||||||
repo: appleboy/drone-scp
|
|
||||||
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-scp
|
|
||||||
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-scp
|
|
||||||
environment:
|
|
||||||
CGO_ENABLED: "0"
|
|
||||||
image: golang:1.18
|
|
||||||
name: build-tag
|
|
||||||
pull: always
|
|
||||||
when:
|
|
||||||
event:
|
|
||||||
- tag
|
|
||||||
- commands:
|
|
||||||
- ./release/linux/arm64/drone-scp --help
|
|
||||||
image: golang:1.18
|
|
||||||
name: executable
|
|
||||||
pull: always
|
|
||||||
- image: plugins/docker:linux-arm64
|
|
||||||
name: dryrun
|
|
||||||
pull: always
|
|
||||||
settings:
|
|
||||||
cache_from: appleboy/drone-scp
|
|
||||||
daemon_off: false
|
|
||||||
dockerfile: docker/Dockerfile.linux.arm64
|
|
||||||
dry_run: true
|
|
||||||
repo: appleboy/drone-scp
|
|
||||||
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-scp
|
|
||||||
daemon_off: "false"
|
|
||||||
dockerfile: docker/Dockerfile.linux.arm64
|
|
||||||
password:
|
|
||||||
from_secret: docker_password
|
|
||||||
repo: appleboy/drone-scp
|
|
||||||
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-scp
|
|
||||||
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-scp
|
|
||||||
environment:
|
|
||||||
CGO_ENABLED: "0"
|
|
||||||
image: golang:1.18
|
|
||||||
name: build-tag
|
|
||||||
pull: always
|
|
||||||
when:
|
|
||||||
event:
|
|
||||||
- tag
|
|
||||||
- commands:
|
|
||||||
- ./release/linux/arm/drone-scp --help
|
|
||||||
image: golang:1.18
|
|
||||||
name: executable
|
|
||||||
pull: always
|
|
||||||
- image: plugins/docker:linux-arm
|
|
||||||
name: dryrun
|
|
||||||
pull: always
|
|
||||||
settings:
|
|
||||||
cache_from: appleboy/drone-scp
|
|
||||||
daemon_off: false
|
|
||||||
dockerfile: docker/Dockerfile.linux.arm
|
|
||||||
dry_run: true
|
|
||||||
repo: appleboy/drone-scp
|
|
||||||
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-scp
|
|
||||||
daemon_off: "false"
|
|
||||||
dockerfile: docker/Dockerfile.linux.arm
|
|
||||||
password:
|
|
||||||
from_secret: docker_password
|
|
||||||
repo: appleboy/drone-scp
|
|
||||||
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:
|
|
||||||
- make release
|
|
||||||
image: golang:1.18
|
|
||||||
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/**
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
# unifying the coding style for different editors and IDEs => editorconfig.org
|
|
||||||
|
|
||||||
; indicate this is the root of the project
|
|
||||||
root = true
|
|
||||||
|
|
||||||
###########################################################
|
|
||||||
; common
|
|
||||||
###########################################################
|
|
||||||
|
|
||||||
[*]
|
|
||||||
charset = utf-8
|
|
||||||
|
|
||||||
end_of_line = LF
|
|
||||||
insert_final_newline = true
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 2
|
|
||||||
|
|
||||||
###########################################################
|
|
||||||
; make
|
|
||||||
###########################################################
|
|
||||||
|
|
||||||
[Makefile]
|
|
||||||
indent_style = tab
|
|
||||||
|
|
||||||
[makefile]
|
|
||||||
indent_style = tab
|
|
||||||
|
|
||||||
###########################################################
|
|
||||||
; markdown
|
|
||||||
###########################################################
|
|
||||||
|
|
||||||
[*.md]
|
|
||||||
trim_trailing_whitespace = false
|
|
||||||
|
|
||||||
###########################################################
|
|
||||||
; golang
|
|
||||||
###########################################################
|
|
||||||
|
|
||||||
[*.go]
|
|
||||||
indent_style = tab
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||||
|
patreon: # Replace with a single Patreon username
|
||||||
|
open_collective: # Replace with a single Open Collective username
|
||||||
|
ko_fi: # Replace with a single Ko-fi username
|
||||||
|
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||||
|
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||||
|
liberapay: # Replace with a single Liberapay username
|
||||||
|
issuehunt: # Replace with a single IssueHunt username
|
||||||
|
otechie: # Replace with a single Otechie username
|
||||||
|
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||||
|
custom: ['https://www.paypal.me/appleboy46']
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: github-actions
|
||||||
|
directory: /
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
- package-ecosystem: gomod
|
||||||
|
directory: /
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
name: Release Binary
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: techknowlogick/xgo:go-1.19.x
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
# - name: Release binary
|
||||||
|
# run: |
|
||||||
|
# ls -al
|
||||||
|
# make release
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
# For most projects, this workflow file will not need changing; you simply need
|
||||||
|
# to commit it to your repository.
|
||||||
|
#
|
||||||
|
# You may wish to alter this file to override the set of languages analyzed,
|
||||||
|
# or to provide custom queries or build logic.
|
||||||
|
#
|
||||||
|
# ******** NOTE ********
|
||||||
|
# We have attempted to detect the languages in your repository. Please check
|
||||||
|
# the `language` matrix defined below to confirm you have the correct set of
|
||||||
|
# supported CodeQL languages.
|
||||||
|
#
|
||||||
|
name: "CodeQL"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
pull_request:
|
||||||
|
# The branches below must be a subset of the branches above
|
||||||
|
branches: [ master ]
|
||||||
|
schedule:
|
||||||
|
- cron: '41 23 * * 6'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
name: Analyze
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
language: [ 'go' ]
|
||||||
|
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
||||||
|
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
# Initializes the CodeQL tools for scanning.
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v2
|
||||||
|
with:
|
||||||
|
languages: ${{ matrix.language }}
|
||||||
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
|
# By default, queries listed here will override any specified in a config file.
|
||||||
|
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||||
|
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||||
|
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v2
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
name: Docker Image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-docker:
|
||||||
|
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_arm
|
||||||
|
make build_linux_arm64
|
||||||
|
-
|
||||||
|
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
|
||||||
|
id: docker-meta
|
||||||
|
uses: docker/metadata-action@v4
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
${{ github.repository }}
|
||||||
|
ghcr.io/${{ github.repository }}
|
||||||
|
tags: |
|
||||||
|
type=raw,value=latest,enable={{is_default_branch}}
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Build and push
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm,linux/arm64
|
||||||
|
file: docker/Dockerfile
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ${{ steps.docker-meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.docker-meta.outputs.labels }}
|
||||||
@@ -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,45 @@
|
|||||||
|
name: Lint and Testing
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
- uses: hadolint/hadolint-action@v3.1.0
|
||||||
|
name: hadolint for Dockerfile
|
||||||
|
with:
|
||||||
|
dockerfile: docker/Dockerfile
|
||||||
|
|
||||||
|
testing:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: golang:1.19-alpine
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: setup sshd server
|
||||||
|
run: |
|
||||||
|
apk add git make curl perl bash build-base zlib-dev ucl-dev
|
||||||
|
make ssh-server
|
||||||
|
|
||||||
|
- name: testing
|
||||||
|
run: |
|
||||||
|
make test
|
||||||
|
|
||||||
|
- name: Upload coverage to Codecov
|
||||||
|
uses: codecov/codecov-action@v3
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
ignored:
|
||||||
|
- DL3018
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
ignoreGeneratedHeader = false
|
|
||||||
severity = "warning"
|
|
||||||
confidence = 0.8
|
|
||||||
errorCode = 1
|
|
||||||
warningCode = 1
|
|
||||||
|
|
||||||
[rule.blank-imports]
|
|
||||||
[rule.context-as-argument]
|
|
||||||
[rule.context-keys-type]
|
|
||||||
[rule.dot-imports]
|
|
||||||
[rule.error-return]
|
|
||||||
[rule.error-strings]
|
|
||||||
[rule.error-naming]
|
|
||||||
[rule.exported]
|
|
||||||
[rule.if-return]
|
|
||||||
[rule.increment-decrement]
|
|
||||||
[rule.var-naming]
|
|
||||||
[rule.var-declaration]
|
|
||||||
[rule.package-comments]
|
|
||||||
[rule.range]
|
|
||||||
[rule.receiver-naming]
|
|
||||||
[rule.time-naming]
|
|
||||||
[rule.unexported-return]
|
|
||||||
[rule.indent-error-flow]
|
|
||||||
[rule.errorf]
|
|
||||||
@@ -1,17 +1,19 @@
|
|||||||
DIST := dist
|
DIST := dist
|
||||||
EXECUTABLE := drone-scp
|
EXECUTABLE := drone-scp
|
||||||
GOFMT ?= gofmt "-s"
|
GOFMT ?= gofumpt -l
|
||||||
|
DIST := dist
|
||||||
|
DIST_DIRS := $(DIST)/binaries $(DIST)/release
|
||||||
GO ?= go
|
GO ?= go
|
||||||
|
SHASUM ?= shasum -a 256
|
||||||
|
GOFILES := $(shell find . -name "*.go" -type f)
|
||||||
|
HAS_GO = $(shell hash $(GO) > /dev/null 2>&1 && echo "GO" || echo "NOGO" )
|
||||||
|
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
|
||||||
|
XGO_VERSION := go-1.19.x
|
||||||
|
GXZ_PAGAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.11
|
||||||
|
|
||||||
# for dockerhub
|
LINUX_ARCHS ?= linux/amd64,linux/arm64
|
||||||
DEPLOY_ACCOUNT := appleboy
|
DARWIN_ARCHS ?= darwin-10.12/amd64,darwin-10.12/arm64
|
||||||
DEPLOY_IMAGE := $(EXECUTABLE)
|
WINDOWS_ARCHS ?= windows/*
|
||||||
|
|
||||||
TARGETS ?= linux darwin windows
|
|
||||||
ARCHS ?= amd64
|
|
||||||
SOURCES ?= $(shell find . -name "*.go" -type f)
|
|
||||||
TAGS ?=
|
|
||||||
LDFLAGS ?= -X 'main.Version=$(VERSION)'
|
|
||||||
|
|
||||||
ifneq ($(shell uname), Darwin)
|
ifneq ($(shell uname), Darwin)
|
||||||
EXTLDFLAGS = -extldflags "-static" $(null)
|
EXTLDFLAGS = -extldflags "-static" $(null)
|
||||||
@@ -19,63 +21,68 @@ else
|
|||||||
EXTLDFLAGS =
|
EXTLDFLAGS =
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(HAS_GO), GO)
|
||||||
|
GOPATH ?= $(shell $(GO) env GOPATH)
|
||||||
|
export PATH := $(GOPATH)/bin:$(PATH)
|
||||||
|
|
||||||
|
CGO_EXTRA_CFLAGS := -DSQLITE_MAX_VARIABLE_NUMBER=32766
|
||||||
|
CGO_CFLAGS ?= $(shell $(GO) env CGO_CFLAGS) $(CGO_EXTRA_CFLAGS)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(OS), Windows_NT)
|
||||||
|
GOFLAGS := -v -buildmode=exe
|
||||||
|
EXECUTABLE ?= $(EXECUTABLE).exe
|
||||||
|
else ifeq ($(OS), Windows)
|
||||||
|
GOFLAGS := -v -buildmode=exe
|
||||||
|
EXECUTABLE ?= $(EXECUTABLE).exe
|
||||||
|
else
|
||||||
|
GOFLAGS := -v
|
||||||
|
EXECUTABLE ?= $(EXECUTABLE)
|
||||||
|
endif
|
||||||
|
|
||||||
ifneq ($(DRONE_TAG),)
|
ifneq ($(DRONE_TAG),)
|
||||||
VERSION ?= $(DRONE_TAG)
|
VERSION ?= $(DRONE_TAG)
|
||||||
else
|
else
|
||||||
VERSION ?= $(shell git describe --tags --always || git rev-parse --short HEAD)
|
VERSION ?= $(shell git describe --tags --always || git rev-parse --short HEAD)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
TAGS ?=
|
||||||
|
LDFLAGS ?= -X 'main.Version=$(VERSION)'
|
||||||
|
|
||||||
all: build
|
all: build
|
||||||
|
|
||||||
fmt:
|
fmt:
|
||||||
$(GOFMT) -w $(SOURCES)
|
@hash gofumpt > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||||
|
$(GO) install mvdan.cc/gofumpt; \
|
||||||
|
fi
|
||||||
|
$(GOFMT) -w $(GOFILES)
|
||||||
|
|
||||||
vet:
|
vet:
|
||||||
$(GO) vet ./...
|
$(GO) vet ./...
|
||||||
|
|
||||||
lint:
|
|
||||||
@hash revive > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
|
||||||
$(GO) install github.com/mgechev/revive@v1.2.1; \
|
|
||||||
fi
|
|
||||||
revive -config .revive.toml ./... || exit 1
|
|
||||||
|
|
||||||
.PHONY: fmt-check
|
.PHONY: fmt-check
|
||||||
fmt-check:
|
fmt-check:
|
||||||
@diff=$$($(GOFMT) -d $(SOURCES)); \
|
@hash gofumpt > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||||
|
$(GO) install mvdan.cc/gofumpt; \
|
||||||
|
fi
|
||||||
|
@diff=$$($(GOFMT) -d $(GOFILES)); \
|
||||||
if [ -n "$$diff" ]; then \
|
if [ -n "$$diff" ]; then \
|
||||||
echo "Please run 'make fmt' and commit the result:"; \
|
echo "Please run 'make fmt' and commit the result:"; \
|
||||||
echo "$${diff}"; \
|
echo "$${diff}"; \
|
||||||
exit 1; \
|
exit 1; \
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
test: fmt-check
|
test:
|
||||||
@$(GO) test -v -cover -coverprofile coverage.txt ./... && echo "\n==>\033[32m Ok\033[m\n" || exit 1
|
@$(GO) test -v -cover -coverprofile coverage.txt ./... && echo "\n==>\033[32m Ok\033[m\n" || exit 1
|
||||||
|
|
||||||
install: $(SOURCES)
|
install: $(GOFILES)
|
||||||
$(GO) install -v -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)'
|
$(GO) install -v -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)'
|
||||||
|
|
||||||
build: $(EXECUTABLE)
|
build: $(EXECUTABLE)
|
||||||
|
|
||||||
$(EXECUTABLE): $(SOURCES)
|
$(EXECUTABLE): $(GOFILES)
|
||||||
$(GO) build -v -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o $@
|
$(GO) build -v -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o $@
|
||||||
|
|
||||||
release: release-dirs release-build release-copy release-check
|
|
||||||
|
|
||||||
release-dirs:
|
|
||||||
mkdir -p $(DIST)/binaries $(DIST)/release
|
|
||||||
|
|
||||||
release-build:
|
|
||||||
@which gox > /dev/null; if [ $$? -ne 0 ]; then \
|
|
||||||
$(GO) install github.com/mitchellh/gox@master; \
|
|
||||||
fi
|
|
||||||
gox -os="$(TARGETS)" -arch="$(ARCHS)" -tags="$(TAGS)" -ldflags="-s -w $(LDFLAGS)" -output="$(DIST)/binaries/$(EXECUTABLE)-$(VERSION)-{{.OS}}-{{.Arch}}"
|
|
||||||
|
|
||||||
release-copy:
|
|
||||||
$(foreach file,$(wildcard $(DIST)/binaries/$(EXECUTABLE)-*),cp $(file) $(DIST)/release/$(notdir $(file));)
|
|
||||||
|
|
||||||
release-check:
|
|
||||||
cd $(DIST)/release; $(foreach file,$(wildcard $(DIST)/release/$(EXECUTABLE)-*),sha256sum $(notdir $(file)) > $(notdir $(file)).sha256;)
|
|
||||||
|
|
||||||
build_linux_amd64:
|
build_linux_amd64:
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GO) build -a -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o release/linux/amd64/$(DEPLOY_IMAGE)
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GO) build -a -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o release/linux/amd64/$(DEPLOY_IMAGE)
|
||||||
|
|
||||||
@@ -88,20 +95,6 @@ build_linux_arm64:
|
|||||||
build_linux_arm:
|
build_linux_arm:
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 $(GO) build -a -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o release/linux/arm/$(DEPLOY_IMAGE)
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 $(GO) build -a -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o release/linux/arm/$(DEPLOY_IMAGE)
|
||||||
|
|
||||||
docker_image:
|
|
||||||
docker build -t $(DEPLOY_ACCOUNT)/$(DEPLOY_IMAGE) .
|
|
||||||
|
|
||||||
docker: docker_image
|
|
||||||
|
|
||||||
docker_deploy:
|
|
||||||
ifeq ($(tag),)
|
|
||||||
@echo "Usage: make $@ tag=<tag>"
|
|
||||||
@exit 1
|
|
||||||
endif
|
|
||||||
# deploy image
|
|
||||||
docker tag $(DEPLOY_ACCOUNT)/$(DEPLOY_IMAGE):latest $(DEPLOY_ACCOUNT)/$(DEPLOY_IMAGE):$(tag)
|
|
||||||
docker push $(DEPLOY_ACCOUNT)/$(DEPLOY_IMAGE):$(tag)
|
|
||||||
|
|
||||||
ssh-server:
|
ssh-server:
|
||||||
adduser -h /home/drone-scp -s /bin/sh -D -S drone-scp
|
adduser -h /home/drone-scp -s /bin/sh -D -S drone-scp
|
||||||
echo drone-scp:1234 | chpasswd
|
echo drone-scp:1234 | chpasswd
|
||||||
@@ -111,7 +104,6 @@ ssh-server:
|
|||||||
cat tests/.ssh/test.pub >> /home/drone-scp/.ssh/authorized_keys
|
cat tests/.ssh/test.pub >> /home/drone-scp/.ssh/authorized_keys
|
||||||
chmod 600 /home/drone-scp/.ssh/authorized_keys
|
chmod 600 /home/drone-scp/.ssh/authorized_keys
|
||||||
chown -R drone-scp /home/drone-scp/.ssh
|
chown -R drone-scp /home/drone-scp/.ssh
|
||||||
# install ssh and start server
|
|
||||||
apk add --update openssh openrc
|
apk add --update openssh openrc
|
||||||
rm -rf /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_dsa_key
|
rm -rf /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_dsa_key
|
||||||
sed -i 's/^#PubkeyAuthentication yes/PubkeyAuthentication yes/g' /etc/ssh/sshd_config
|
sed -i 's/^#PubkeyAuthentication yes/PubkeyAuthentication yes/g' /etc/ssh/sshd_config
|
||||||
@@ -121,6 +113,54 @@ ssh-server:
|
|||||||
coverage:
|
coverage:
|
||||||
sed -i '/main.go/d' coverage.txt
|
sed -i '/main.go/d' coverage.txt
|
||||||
|
|
||||||
|
.PHONY: deps-backend
|
||||||
|
deps-backend:
|
||||||
|
$(GO) mod download
|
||||||
|
$(GO) install $(GXZ_PAGAGE)
|
||||||
|
$(GO) install $(XGO_PACKAGE)
|
||||||
|
|
||||||
|
.PHONY: release
|
||||||
|
release: release-linux release-darwin release-windows release-copy release-compress release-check
|
||||||
|
|
||||||
|
$(DIST_DIRS):
|
||||||
|
mkdir -p $(DIST_DIRS)
|
||||||
|
|
||||||
|
.PHONY: release-windows
|
||||||
|
release-windows: | $(DIST_DIRS)
|
||||||
|
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -buildmode exe -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets '$(WINDOWS_ARCHS)' -out $(EXECUTABLE)-$(VERSION) .
|
||||||
|
ifeq ($(CI),true)
|
||||||
|
cp -r /build/* $(DIST)/binaries/
|
||||||
|
endif
|
||||||
|
|
||||||
|
.PHONY: release-linux
|
||||||
|
release-linux: | $(DIST_DIRS)
|
||||||
|
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets '$(LINUX_ARCHS)' -out $(EXECUTABLE)-$(VERSION) .
|
||||||
|
ifeq ($(CI),true)
|
||||||
|
cp -r /build/* $(DIST)/binaries/
|
||||||
|
endif
|
||||||
|
|
||||||
|
.PHONY: release-darwin
|
||||||
|
release-darwin: | $(DIST_DIRS)
|
||||||
|
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '$(LDFLAGS)' -targets '$(DARWIN_ARCHS)' -out $(EXECUTABLE)-$(VERSION) .
|
||||||
|
ifeq ($(CI),true)
|
||||||
|
cp -r /build/* $(DIST)/binaries/
|
||||||
|
endif
|
||||||
|
|
||||||
|
.PHONY: release-copy
|
||||||
|
release-copy: | $(DIST_DIRS)
|
||||||
|
cd $(DIST); for file in `find . -type f -name "*"`; do cp $${file} ./release/; done;
|
||||||
|
|
||||||
|
.PHONY: release-check
|
||||||
|
release-check: | $(DIST_DIRS)
|
||||||
|
cd $(DIST)/release/; for file in `find . -type f -name "*"`; do echo "checksumming $${file}" && $(SHASUM) `echo $${file} | sed 's/^..//'` > $${file}.sha256; done;
|
||||||
|
|
||||||
|
.PHONY: release-compress
|
||||||
|
release-compress: | $(DIST_DIRS)
|
||||||
|
cd $(DIST)/release/; for file in `find . -type f -name "*"`; do echo "compressing $${file}" && $(GO) run $(GXZ_PAGAGE) -k -9 $${file}; done;
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(GO) clean -x -i ./...
|
$(GO) clean -x -i ./...
|
||||||
rm -rf coverage.txt $(EXECUTABLE) $(DIST)
|
rm -rf coverage.txt $(EXECUTABLE) $(DIST)
|
||||||
|
|
||||||
|
version:
|
||||||
|
@echo $(VERSION)
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
# drone-scp
|
# drone-scp
|
||||||
|
|
||||||
[](https://godoc.org/github.com/appleboy/drone-scp)
|
[](https://godoc.org/github.com/appleboy/drone-scp)
|
||||||
[](https://cloud.drone.io/appleboy/drone-scp)
|
[](https://github.com/appleboy/drone-scp/actions/workflows/lint.yml)
|
||||||
[](https://codecov.io/gh/appleboy/drone-scp)
|
[](https://codecov.io/gh/appleboy/drone-scp)
|
||||||
[](https://goreportcard.com/report/github.com/appleboy/drone-scp)
|
[](https://goreportcard.com/report/github.com/appleboy/drone-scp)
|
||||||
[](https://hub.docker.com/r/appleboy/drone-scp/)
|
[](https://hub.docker.com/r/appleboy/drone-scp/)
|
||||||
[](https://microbadger.com/images/appleboy/drone-scp "Get your own image badge on microbadger.com")
|
|
||||||
|
|
||||||
Copy files and artifacts via SSH using a binary, docker or [Drone CI](http://docs.drone.io/).
|
Copy files and artifacts via SSH using a binary, docker or [Drone CI](http://docs.drone.io/).
|
||||||
|
|
||||||
|
|||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
//go:build !windows
|
||||||
|
// +build !windows
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
func rmcmd(target string) string {
|
||||||
|
return "rm -rf " + target
|
||||||
|
}
|
||||||
|
|
||||||
|
func mkdircmd(target string) string {
|
||||||
|
return "mkdir -p " + target
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
//go:build windows
|
||||||
|
// +build windows
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
func rmcmd(target string) string {
|
||||||
|
return "DEL /F /S " + target
|
||||||
|
}
|
||||||
|
|
||||||
|
func mkdircmd(target string) string {
|
||||||
|
return "if not exist " + target + " mkdir " + target
|
||||||
|
}
|
||||||
@@ -1,12 +1,16 @@
|
|||||||
FROM plugins/base:linux-amd64
|
FROM alpine:3.17
|
||||||
|
|
||||||
|
ARG TARGETOS
|
||||||
|
ARG TARGETARCH
|
||||||
|
|
||||||
LABEL maintainer="Bo-Yi Wu <appleboy.tw@gmail.com>" \
|
LABEL maintainer="Bo-Yi Wu <appleboy.tw@gmail.com>" \
|
||||||
org.label-schema.name="Drone SCP" \
|
org.label-schema.name="Git SCP Plugin" \
|
||||||
org.label-schema.vendor="Bo-Yi Wu" \
|
org.label-schema.vendor="Bo-Yi Wu" \
|
||||||
org.label-schema.schema-version="1.0"
|
org.label-schema.schema-version="1.0"
|
||||||
|
|
||||||
RUN apk add --no-cache ca-certificates && \
|
RUN apk add --no-cache ca-certificates && \
|
||||||
rm -rf /var/cache/apk/*
|
rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
COPY release/linux/amd64/drone-scp /bin/
|
COPY release/${TARGETOS}/${TARGETARCH}/drone-scp /bin/
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/drone-scp"]
|
ENTRYPOINT ["/bin/drone-scp"]
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
FROM plugins/base:linux-arm
|
|
||||||
|
|
||||||
LABEL maintainer="Bo-Yi Wu <appleboy.tw@gmail.com>" \
|
|
||||||
org.label-schema.name="Drone SCP" \
|
|
||||||
org.label-schema.vendor="Bo-Yi Wu" \
|
|
||||||
org.label-schema.schema-version="1.0"
|
|
||||||
|
|
||||||
RUN apk add --no-cache ca-certificates && \
|
|
||||||
rm -rf /var/cache/apk/*
|
|
||||||
|
|
||||||
COPY release/linux/arm/drone-scp /bin/
|
|
||||||
ENTRYPOINT ["/bin/drone-scp"]
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
FROM plugins/base:linux-arm64
|
|
||||||
|
|
||||||
LABEL maintainer="Bo-Yi Wu <appleboy.tw@gmail.com>" \
|
|
||||||
org.label-schema.name="Drone SCP" \
|
|
||||||
org.label-schema.vendor="Bo-Yi Wu" \
|
|
||||||
org.label-schema.schema-version="1.0"
|
|
||||||
|
|
||||||
RUN apk add --no-cache ca-certificates && \
|
|
||||||
rm -rf /var/cache/apk/*
|
|
||||||
|
|
||||||
COPY release/linux/arm64/drone-scp /bin/
|
|
||||||
ENTRYPOINT ["/bin/drone-scp"]
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
FROM microsoft/nanoserver:10.0.14393.1884
|
|
||||||
|
|
||||||
LABEL maintainer="Bo-Yi Wu <appleboy.tw@gmail.com>" \
|
|
||||||
org.label-schema.name="Drone SCP" \
|
|
||||||
org.label-schema.vendor="Bo-Yi Wu" \
|
|
||||||
org.label-schema.schema-version="1.0"
|
|
||||||
|
|
||||||
COPY drone-scp.exe /drone-scp.exe
|
|
||||||
|
|
||||||
ENTRYPOINT [ "\\drone-scp.exe" ]
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
image: appleboy/drone-scp:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
|
||||||
{{#if build.tags}}
|
|
||||||
tags:
|
|
||||||
{{#each build.tags}}
|
|
||||||
- {{this}}
|
|
||||||
{{/each}}
|
|
||||||
{{/if}}
|
|
||||||
manifests:
|
|
||||||
-
|
|
||||||
image: appleboy/drone-scp:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
|
|
||||||
platform:
|
|
||||||
architecture: amd64
|
|
||||||
os: linux
|
|
||||||
-
|
|
||||||
image: appleboy/drone-scp:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
|
|
||||||
platform:
|
|
||||||
architecture: arm64
|
|
||||||
os: linux
|
|
||||||
variant: v8
|
|
||||||
-
|
|
||||||
image: appleboy/drone-scp:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
|
|
||||||
platform:
|
|
||||||
architecture: arm
|
|
||||||
os: linux
|
|
||||||
variant: v7
|
|
||||||
@@ -1,27 +1,27 @@
|
|||||||
module github.com/appleboy/drone-scp
|
module github.com/appleboy/drone-scp
|
||||||
|
|
||||||
go 1.18
|
go 1.20
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/appleboy/com v0.1.6
|
github.com/appleboy/com v0.1.6
|
||||||
github.com/appleboy/easyssh-proxy v1.3.9
|
github.com/appleboy/easyssh-proxy v1.3.9
|
||||||
github.com/fatih/color v1.9.0
|
github.com/fatih/color v1.14.1
|
||||||
github.com/joho/godotenv v1.4.0
|
github.com/joho/godotenv v1.5.1
|
||||||
github.com/stretchr/testify v1.7.0
|
github.com/stretchr/testify v1.8.1
|
||||||
github.com/urfave/cli/v2 v2.8.1
|
github.com/urfave/cli/v2 v2.24.4
|
||||||
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e
|
golang.org/x/crypto v0.6.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
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.1 // 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/dchest/bcrypt_pbkdf v0.0.0-20150205184540-83f37f9c154a // indirect
|
||||||
github.com/mattn/go-colorable v0.1.4 // indirect
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.11 // indirect
|
github.com/mattn/go-isatty v0.0.17 // indirect
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
|
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
|
||||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect
|
golang.org/x/sys v0.5.0 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,55 +1,62 @@
|
|||||||
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 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/com v0.1.6 h1:vP9ryTIbSFaXSrZcFTU7RRcgPbrpGJ0Oy5wpgEkQ2m8=
|
github.com/appleboy/com v0.1.6 h1:vP9ryTIbSFaXSrZcFTU7RRcgPbrpGJ0Oy5wpgEkQ2m8=
|
||||||
github.com/appleboy/com v0.1.6/go.mod h1:jnufjIC3opMlReyPPPye+8JqNvUzLm25o7h6SOy8nv0=
|
github.com/appleboy/com v0.1.6/go.mod h1:jnufjIC3opMlReyPPPye+8JqNvUzLm25o7h6SOy8nv0=
|
||||||
github.com/appleboy/easyssh-proxy v1.3.9 h1:b+sVSTz+cVFvfA23HQywMMpm0s5g3gH7jYdBcQqaCQI=
|
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/appleboy/easyssh-proxy v1.3.9/go.mod h1:G1eQomBEME7NWKA3hE49s5HsT44S5fn0aBxX7k9Yjug=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.1 h1:r/myEWzV9lfsM1tFLgDyu0atFtJ1fXn261LKYj/3DxU=
|
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
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.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 h1:saTgr5tMLFnmy/yg3qDTft4rE5DY2uJ/cCxCe3q0XTU=
|
||||||
github.com/dchest/bcrypt_pbkdf v0.0.0-20150205184540-83f37f9c154a/go.mod h1:Bw9BbhOJVNR+t0jCqx2GC6zv0TGBsShs56Y3gfSCvl0=
|
github.com/dchest/bcrypt_pbkdf v0.0.0-20150205184540-83f37f9c154a/go.mod h1:Bw9BbhOJVNR+t0jCqx2GC6zv0TGBsShs56Y3gfSCvl0=
|
||||||
github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s=
|
github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w=
|
||||||
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
|
github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg=
|
||||||
github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg=
|
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
|
||||||
github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
|
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
|
||||||
github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA=
|
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||||
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||||
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||||
github.com/mattn/go-isatty v0.0.11 h1:FxPOTFNqGkuDUGi3H/qkUbQO4ZiBa2brKq5r0l8TGeM=
|
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
|
||||||
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
|
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
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/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
||||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
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.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.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||||
github.com/urfave/cli/v2 v2.8.1 h1:CGuYNZF9IKZY/rfBe3lJpccSoIY1ytfvmgQT90cNOl4=
|
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
||||||
github.com/urfave/cli/v2 v2.8.1/go.mod h1:Z41J9TPoffeoqP0Iza0YbAhGvymRdZAd2uPmZ5JxRdY=
|
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||||
|
github.com/urfave/cli/v2 v2.24.4 h1:0gyJJEBYtCV87zI/x2nZCPyDxD51K6xM8SkwjHFCNEU=
|
||||||
|
github.com/urfave/cli/v2 v2.24.4/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc=
|
||||||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
|
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
|
||||||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
|
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
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-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-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.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc=
|
||||||
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
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-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/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-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-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-20200219091948-cb0a6d8edb6c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4=
|
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
|
||||||
|
golang.org/x/sys v0.5.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-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.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
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 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
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.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/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=
|
||||||
|
|||||||
@@ -36,24 +36,28 @@ func main() {
|
|||||||
app.Version = Version
|
app.Version = Version
|
||||||
app.Flags = []cli.Flag{
|
app.Flags = []cli.Flag{
|
||||||
&cli.StringSliceFlag{
|
&cli.StringSliceFlag{
|
||||||
Name: "host, H",
|
Name: "host",
|
||||||
|
Aliases: []string{"H"},
|
||||||
Usage: "Server host",
|
Usage: "Server host",
|
||||||
EnvVars: []string{"PLUGIN_HOST", "SCP_HOST", "SSH_HOST", "HOST", "INPUT_HOST"},
|
EnvVars: []string{"PLUGIN_HOST", "SCP_HOST", "SSH_HOST", "HOST", "INPUT_HOST"},
|
||||||
FilePath: ".host",
|
FilePath: ".host",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "port, P",
|
Name: "port",
|
||||||
|
Aliases: []string{"P"},
|
||||||
Value: "22",
|
Value: "22",
|
||||||
Usage: "Server port, default to 22",
|
Usage: "Server port, default to 22",
|
||||||
EnvVars: []string{"PLUGIN_PORT", "SCP_PORT", "SSH_PORT", "PORT", "INPUT_PORT"},
|
EnvVars: []string{"PLUGIN_PORT", "SCP_PORT", "SSH_PORT", "PORT", "INPUT_PORT"},
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "username, u",
|
Name: "username",
|
||||||
|
Aliases: []string{"u"},
|
||||||
Usage: "Server username",
|
Usage: "Server username",
|
||||||
EnvVars: []string{"PLUGIN_USERNAME", "PLUGIN_USER", "SCP_USERNAME", "SSH_USERNAME", "USERNAME", "INPUT_USERNAME"},
|
EnvVars: []string{"PLUGIN_USERNAME", "PLUGIN_USER", "SCP_USERNAME", "SSH_USERNAME", "USERNAME", "INPUT_USERNAME"},
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "password, p",
|
Name: "password",
|
||||||
|
Aliases: []string{"p"},
|
||||||
Usage: "Password for password-based authentication",
|
Usage: "Password for password-based authentication",
|
||||||
EnvVars: []string{"PLUGIN_PASSWORD", "SCP_PASSWORD", "SSH_PASSWORD", "PASSWORD", "INPUT_PASSWORD"},
|
EnvVars: []string{"PLUGIN_PASSWORD", "SCP_PASSWORD", "SSH_PASSWORD", "PASSWORD", "INPUT_PASSWORD"},
|
||||||
},
|
},
|
||||||
@@ -85,7 +89,8 @@ func main() {
|
|||||||
Value: 10 * time.Minute,
|
Value: 10 * time.Minute,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "ssh-key, k",
|
Name: "ssh-key",
|
||||||
|
Aliases: []string{"k"},
|
||||||
Usage: "ssh private key",
|
Usage: "ssh private key",
|
||||||
EnvVars: []string{"PLUGIN_SSH_KEY,", "PLUGIN_KEY", "SCP_KEY", "SSH_KEY", "KEY", "INPUT_KEY"},
|
EnvVars: []string{"PLUGIN_SSH_KEY,", "PLUGIN_KEY", "SCP_KEY", "SSH_KEY", "KEY", "INPUT_KEY"},
|
||||||
},
|
},
|
||||||
@@ -95,22 +100,26 @@ func main() {
|
|||||||
EnvVars: []string{"PLUGIN_SSH_PASSPHRASE", "PLUGIN_PASSPHRASE", "SSH_PASSPHRASE", "PASSPHRASE", "INPUT_PASSPHRASE"},
|
EnvVars: []string{"PLUGIN_SSH_PASSPHRASE", "PLUGIN_PASSPHRASE", "SSH_PASSPHRASE", "PASSPHRASE", "INPUT_PASSPHRASE"},
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "key-path, i",
|
Name: "key-path",
|
||||||
|
Aliases: []string{"i"},
|
||||||
Usage: "ssh private key path",
|
Usage: "ssh private key path",
|
||||||
EnvVars: []string{"PLUGIN_KEY_PATH", "SCP_KEY_PATH", "SSH_KEY_PATH", "INPUT_KEY_PATH"},
|
EnvVars: []string{"PLUGIN_KEY_PATH", "SCP_KEY_PATH", "SSH_KEY_PATH", "INPUT_KEY_PATH"},
|
||||||
},
|
},
|
||||||
&cli.StringSliceFlag{
|
&cli.StringSliceFlag{
|
||||||
Name: "target, t",
|
Name: "target",
|
||||||
|
Aliases: []string{"t"},
|
||||||
Usage: "Target path on the server",
|
Usage: "Target path on the server",
|
||||||
EnvVars: []string{"PLUGIN_TARGET", "SCP_TARGET", "TARGET", "INPUT_TARGET"},
|
EnvVars: []string{"PLUGIN_TARGET", "SCP_TARGET", "TARGET", "INPUT_TARGET"},
|
||||||
},
|
},
|
||||||
&cli.StringSliceFlag{
|
&cli.StringSliceFlag{
|
||||||
Name: "source, s",
|
Name: "source",
|
||||||
|
Aliases: []string{"s"},
|
||||||
Usage: "scp file list",
|
Usage: "scp file list",
|
||||||
EnvVars: []string{"PLUGIN_SOURCE", "SCP_SOURCE", "SOURCE", "INPUT_SOURCE"},
|
EnvVars: []string{"PLUGIN_SOURCE", "SCP_SOURCE", "SOURCE", "INPUT_SOURCE"},
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "rm, r",
|
Name: "rm",
|
||||||
|
Aliases: []string{"r"},
|
||||||
Usage: "remove target folder before upload data",
|
Usage: "remove target folder before upload data",
|
||||||
EnvVars: []string{"PLUGIN_RM", "SCP_RM", "RM", "INPUT_RM"},
|
EnvVars: []string{"PLUGIN_RM", "SCP_RM", "RM", "INPUT_RM"},
|
||||||
},
|
},
|
||||||
@@ -250,6 +259,11 @@ func main() {
|
|||||||
Usage: "use --overwrite flag with tar",
|
Usage: "use --overwrite flag with tar",
|
||||||
EnvVars: []string{"PLUGIN_OVERWRITE", "SCP_OVERWRITE", "INPUT_OVERWRITE"},
|
EnvVars: []string{"PLUGIN_OVERWRITE", "SCP_OVERWRITE", "INPUT_OVERWRITE"},
|
||||||
},
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "unlink.first",
|
||||||
|
Usage: "use --unlink-first flag with tar",
|
||||||
|
EnvVars: []string{"PLUGIN_UNLINK_FIRST", "SCP_UNLINK_FIRST", "INPUT_UNLINK_FIRST"},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Override a template
|
// Override a template
|
||||||
@@ -325,6 +339,7 @@ func run(c *cli.Context) error {
|
|||||||
TarExec: c.String("tar.exec"),
|
TarExec: c.String("tar.exec"),
|
||||||
TarTmpPath: c.String("tar.tmp-path"),
|
TarTmpPath: c.String("tar.tmp-path"),
|
||||||
Overwrite: c.Bool("overwrite"),
|
Overwrite: c.Bool("overwrite"),
|
||||||
|
UnlinkFirst: c.Bool("unlink.first"),
|
||||||
Ciphers: c.StringSlice("ciphers"),
|
Ciphers: c.StringSlice("ciphers"),
|
||||||
UseInsecureCipher: c.Bool("useInsecureCipher"),
|
UseInsecureCipher: c.Bool("useInsecureCipher"),
|
||||||
Proxy: easyssh.DefaultConfig{
|
Proxy: easyssh.DefaultConfig{
|
||||||
|
|||||||
@@ -1,228 +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: 'golang:1.18',
|
|
||||||
pull: 'always',
|
|
||||||
commands: [
|
|
||||||
'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,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,7 +3,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@@ -64,6 +63,7 @@ type (
|
|||||||
Proxy easyssh.DefaultConfig
|
Proxy easyssh.DefaultConfig
|
||||||
Debug bool
|
Debug bool
|
||||||
Overwrite bool
|
Overwrite bool
|
||||||
|
UnlinkFirst bool
|
||||||
Ciphers []string
|
Ciphers []string
|
||||||
UseInsecureCipher bool
|
UseInsecureCipher bool
|
||||||
}
|
}
|
||||||
@@ -152,7 +152,7 @@ func (p Plugin) log(host string, message ...interface{}) {
|
|||||||
|
|
||||||
func (p *Plugin) removeDestFile(ssh *easyssh.MakeConfig) error {
|
func (p *Plugin) removeDestFile(ssh *easyssh.MakeConfig) error {
|
||||||
p.log(ssh.Server, "remove file", p.DestFile)
|
p.log(ssh.Server, "remove file", p.DestFile)
|
||||||
_, errStr, _, err := ssh.Run(fmt.Sprintf("rm -rf %s", p.DestFile), p.Config.CommandTimeout)
|
_, errStr, _, err := ssh.Run(rmcmd(p.DestFile), p.Config.CommandTimeout)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -226,6 +226,10 @@ func (p *Plugin) buildArgs(target string) []string {
|
|||||||
args = append(args, "--overwrite")
|
args = append(args, "--overwrite")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if p.Config.UnlinkFirst {
|
||||||
|
args = append(args, "--unlink-first")
|
||||||
|
}
|
||||||
|
|
||||||
args = append(args,
|
args = append(args,
|
||||||
"-C",
|
"-C",
|
||||||
target,
|
target,
|
||||||
@@ -256,10 +260,7 @@ func (p *Plugin) Exec() error {
|
|||||||
p.DestFile = fmt.Sprintf("%s.tar", random.String(10))
|
p.DestFile = fmt.Sprintf("%s.tar", random.String(10))
|
||||||
|
|
||||||
// create a temporary file for the archive
|
// create a temporary file for the archive
|
||||||
dir, err := ioutil.TempDir("", "")
|
dir := os.TempDir()
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
tar := filepath.Join(dir, p.DestFile)
|
tar := filepath.Join(dir, p.DestFile)
|
||||||
|
|
||||||
// run archive command
|
// run archive command
|
||||||
@@ -321,20 +322,19 @@ func (p *Plugin) Exec() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, target := range p.Config.Target {
|
for _, target := range p.Config.Target {
|
||||||
// remove target before upload data
|
// remove target folder before upload data
|
||||||
if p.Config.Remove {
|
if p.Config.Remove {
|
||||||
p.log(host, "Remove target folder:", target)
|
p.log(host, "Remove target folder:", target)
|
||||||
|
|
||||||
_, _, _, err := ssh.Run(fmt.Sprintf("rm -rf %s", target), p.Config.CommandTimeout)
|
_, _, _, err := ssh.Run(rmcmd(target), p.Config.CommandTimeout)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errChannel <- err
|
errChannel <- err
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// mkdir path
|
|
||||||
p.log(host, "create folder", target)
|
p.log(host, "create folder", target)
|
||||||
_, errStr, _, err := ssh.Run(fmt.Sprintf("mkdir -p %s", target), p.Config.CommandTimeout)
|
_, errStr, _, err := ssh.Run(mkdircmd(target), p.Config.CommandTimeout)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errChannel <- err
|
errChannel <- err
|
||||||
return
|
return
|
||||||
|
|||||||
+22
-4
@@ -1,7 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
@@ -200,7 +199,7 @@ func TestWrongFingerprint(t *testing.T) {
|
|||||||
func getHostPublicKeyFile(keypath string) (ssh.PublicKey, error) {
|
func getHostPublicKeyFile(keypath string) (ssh.PublicKey, error) {
|
||||||
var pubkey ssh.PublicKey
|
var pubkey ssh.PublicKey
|
||||||
var err error
|
var err error
|
||||||
buf, err := ioutil.ReadFile(keypath)
|
buf, err := os.ReadFile(keypath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -639,8 +638,9 @@ func TestPlugin_buildArgs(t *testing.T) {
|
|||||||
name: "default command",
|
name: "default command",
|
||||||
fields: fields{
|
fields: fields{
|
||||||
Config: Config{
|
Config: Config{
|
||||||
Overwrite: false,
|
Overwrite: false,
|
||||||
TarExec: "tar",
|
UnlinkFirst: false,
|
||||||
|
TarExec: "tar",
|
||||||
},
|
},
|
||||||
DestFile: "foo.tar",
|
DestFile: "foo.tar",
|
||||||
},
|
},
|
||||||
@@ -654,6 +654,7 @@ func TestPlugin_buildArgs(t *testing.T) {
|
|||||||
fields: fields{
|
fields: fields{
|
||||||
Config: Config{
|
Config: Config{
|
||||||
Overwrite: false,
|
Overwrite: false,
|
||||||
|
UnlinkFirst: false,
|
||||||
TarExec: "tar",
|
TarExec: "tar",
|
||||||
StripComponents: 2,
|
StripComponents: 2,
|
||||||
},
|
},
|
||||||
@@ -671,6 +672,7 @@ func TestPlugin_buildArgs(t *testing.T) {
|
|||||||
TarExec: "tar",
|
TarExec: "tar",
|
||||||
StripComponents: 2,
|
StripComponents: 2,
|
||||||
Overwrite: true,
|
Overwrite: true,
|
||||||
|
UnlinkFirst: false,
|
||||||
},
|
},
|
||||||
DestFile: "foo.tar",
|
DestFile: "foo.tar",
|
||||||
},
|
},
|
||||||
@@ -679,6 +681,22 @@ func TestPlugin_buildArgs(t *testing.T) {
|
|||||||
},
|
},
|
||||||
want: []string{"tar", "-xf", "foo.tar", "--strip-components", "2", "--overwrite", "-C", "foo"},
|
want: []string{"tar", "-xf", "foo.tar", "--strip-components", "2", "--overwrite", "-C", "foo"},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "unlink first",
|
||||||
|
fields: fields{
|
||||||
|
Config: Config{
|
||||||
|
TarExec: "tar",
|
||||||
|
StripComponents: 2,
|
||||||
|
Overwrite: true,
|
||||||
|
UnlinkFirst: true,
|
||||||
|
},
|
||||||
|
DestFile: "foo.tar",
|
||||||
|
},
|
||||||
|
args: args{
|
||||||
|
target: "foo",
|
||||||
|
},
|
||||||
|
want: []string{"tar", "-xf", "foo.tar", "--strip-components", "2", "--overwrite", "--unlink-first", "-C", "foo"},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user