mirror of
https://github.com/appleboy/drone-ssh.git
synced 2025-05-09 18:23:21 +08:00
feat: add drone config
This commit is contained in:
parent
3932e1a754
commit
31f65b5b86
78
.drone.yml
Normal file
78
.drone.yml
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
workspace:
|
||||||
|
base: /srv/app
|
||||||
|
path: src/github.com/appleboy/drone-ssh
|
||||||
|
|
||||||
|
pipeline:
|
||||||
|
clone:
|
||||||
|
image: plugins/git
|
||||||
|
tags: true
|
||||||
|
|
||||||
|
# restore the cache from an sftp server
|
||||||
|
restore_cache:
|
||||||
|
image: appleboy/drone-sftp-cache
|
||||||
|
restore: true
|
||||||
|
mount: [ .glide, vendor ]
|
||||||
|
ignore_branch: true
|
||||||
|
|
||||||
|
test:
|
||||||
|
image: appleboy/golang-testing
|
||||||
|
pull: true
|
||||||
|
environment:
|
||||||
|
TAGS: netgo
|
||||||
|
GOPATH: /srv/app
|
||||||
|
commands:
|
||||||
|
- make dep_install
|
||||||
|
- make vet
|
||||||
|
- make lint
|
||||||
|
- make test
|
||||||
|
- make coverage
|
||||||
|
- make build
|
||||||
|
# build binary for docker image
|
||||||
|
- make static_build
|
||||||
|
when:
|
||||||
|
event: [ push, tag, pull_request ]
|
||||||
|
|
||||||
|
release:
|
||||||
|
image: appleboy/golang-testing
|
||||||
|
pull: true
|
||||||
|
environment:
|
||||||
|
TAGS: netgo
|
||||||
|
GOPATH: /srv/app
|
||||||
|
commands:
|
||||||
|
- make release
|
||||||
|
when:
|
||||||
|
event: [ tag ]
|
||||||
|
branch: [ refs/tags/* ]
|
||||||
|
|
||||||
|
publish_tag:
|
||||||
|
image: plugins/docker
|
||||||
|
repo: ${DRONE_REPO}
|
||||||
|
tags: [ '${DRONE_TAG}' ]
|
||||||
|
when:
|
||||||
|
event: [ tag ]
|
||||||
|
branch: [ refs/tags/* ]
|
||||||
|
|
||||||
|
publish_latest:
|
||||||
|
image: plugins/docker
|
||||||
|
repo: ${DRONE_REPO}
|
||||||
|
tags: [ 'latest' ]
|
||||||
|
when:
|
||||||
|
event: [ push ]
|
||||||
|
branch: [ master ]
|
||||||
|
|
||||||
|
release:
|
||||||
|
image: plugins/github-release
|
||||||
|
files:
|
||||||
|
- dist/release/*
|
||||||
|
when:
|
||||||
|
event: [ tag ]
|
||||||
|
branch: [ refs/tags/* ]
|
||||||
|
|
||||||
|
# rebuild the cache on the sftp server
|
||||||
|
rebuild_cache:
|
||||||
|
image: appleboy/drone-sftp-cache
|
||||||
|
rebuild: true
|
||||||
|
mount: [ .glide, vendor ]
|
||||||
|
ignore_branch: true
|
||||||
|
when:
|
||||||
|
branch: master
|
88
.drone.yml.sig
Normal file
88
.drone.yml.sig
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
workspace:
|
||||||
|
base: /srv/app
|
||||||
|
path: src/github.com/appleboy/drone-scp
|
||||||
|
|
||||||
|
pipeline:
|
||||||
|
clone:
|
||||||
|
image: plugins/git
|
||||||
|
tags: true
|
||||||
|
|
||||||
|
# restore the cache from an sftp server
|
||||||
|
restore_cache:
|
||||||
|
image: appleboy/drone-sftp-cache
|
||||||
|
restore: true
|
||||||
|
mount: [ .glide, vendor ]
|
||||||
|
ignore_branch: true
|
||||||
|
|
||||||
|
test:
|
||||||
|
image: appleboy/golang-testing
|
||||||
|
pull: true
|
||||||
|
environment:
|
||||||
|
TAGS: netgo
|
||||||
|
GOPATH: /srv/app
|
||||||
|
commands:
|
||||||
|
- adduser -h /home/drone-scp -s /bin/bash -D -S drone-scp
|
||||||
|
- passwd -d drone-scp
|
||||||
|
- mkdir -p /home/drone-scp/.ssh
|
||||||
|
- chmod 700 /home/drone-scp/.ssh
|
||||||
|
- cp tests/.ssh/id_rsa.pub /home/drone-scp/.ssh/authorized_keys
|
||||||
|
- chown -R drone-scp /home/drone-scp/.ssh
|
||||||
|
# install ssh and start server
|
||||||
|
- apk update && apk add openssh openrc
|
||||||
|
- rm -rf /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_dsa_key
|
||||||
|
- ./tests/entrypoint.sh /usr/sbin/sshd -D &
|
||||||
|
- make dep_install
|
||||||
|
- make vet
|
||||||
|
- make lint
|
||||||
|
- make test
|
||||||
|
- make coverage
|
||||||
|
- make build
|
||||||
|
# build binary for docker image
|
||||||
|
- make static_build
|
||||||
|
when:
|
||||||
|
event: [ push, tag, pull_request ]
|
||||||
|
|
||||||
|
release:
|
||||||
|
image: appleboy/golang-testing
|
||||||
|
pull: true
|
||||||
|
environment:
|
||||||
|
TAGS: netgo
|
||||||
|
GOPATH: /srv/app
|
||||||
|
commands:
|
||||||
|
- make release
|
||||||
|
when:
|
||||||
|
event: [ tag ]
|
||||||
|
branch: [ refs/tags/* ]
|
||||||
|
|
||||||
|
docker:
|
||||||
|
image: plugins/docker
|
||||||
|
repo: ${DRONE_REPO}
|
||||||
|
tags: [ '${DRONE_TAG}' ]
|
||||||
|
when:
|
||||||
|
event: [ tag ]
|
||||||
|
branch: [ refs/tags/* ]
|
||||||
|
|
||||||
|
docker:
|
||||||
|
image: plugins/docker
|
||||||
|
repo: ${DRONE_REPO}
|
||||||
|
tags: [ 'latest' ]
|
||||||
|
when:
|
||||||
|
event: [ push ]
|
||||||
|
branch: [ master ]
|
||||||
|
|
||||||
|
github:
|
||||||
|
image: plugins/github-release
|
||||||
|
files:
|
||||||
|
- dist/release/*
|
||||||
|
when:
|
||||||
|
event: [ tag ]
|
||||||
|
branch: [ refs/tags/* ]
|
||||||
|
|
||||||
|
# rebuild the cache on the sftp server
|
||||||
|
rebuild_cache:
|
||||||
|
image: appleboy/drone-sftp-cache
|
||||||
|
rebuild: true
|
||||||
|
mount: [ .glide, vendor ]
|
||||||
|
ignore_branch: true
|
||||||
|
when:
|
||||||
|
branch: master
|
Loading…
Reference in New Issue
Block a user