Move ENV debug logging before appending scriptCommands to env slice,
so ======ENV====== only appears when Envs are configured and only
contains export statements, matching v1.8.2 behavior.
- revert TestCommandOutput: remove ENV section (no Envs configured)
- revert TestEnvOutput: remove echo commands from ENV section
- normalize \r\n to \n in unindent to handle TTY output from RequireTty tests
- add script commands to ======ENV====== expected section in TestEnvOutput
- bump actions/checkout to v6
- bump actions/setup-go to v6
- bump actions/cache to v5
- bump goreleaser/goreleaser-action to v7
- bump golangci/golangci-lint-action to v9
- bump github/codeql-action/* to v4
- bump codecov/codecov-action to v5
- bump docker/build-push-action to v7
- bump docker/login-action to v4
- bump docker/metadata-action to v6
- bump docker/setup-buildx-action to v4
- bump docker/setup-qemu-action to v4
- bump hadolint/hadolint-action to v3.3.0
- bump aquasecurity/trivy-action to v0.35.0
- Upgrade docker/docker from v28.0.1 to v28.5.2 to fix AuthZ bypass
- Upgrade testcontainers-go from v0.36.0 to v0.41.0
- Update all transitive dependencies to latest compatible versions
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Bump minimum Go version from 1.24 to 1.25
- Update CI test matrix to Go 1.25 and 1.26, drop 1.24
- Upgrade easyssh-proxy to v1.5.2, urfave/cli to v2.27.7
- Upgrade golang.org/x/crypto to v0.49.0 and other x/ packages
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add getWriter method to centralize writer-nil-check logic
- Replace inline writer initialization in log and Exec methods
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Replace interface{} with any and fix value receiver mutation in log method
- Use fmt.Fprintln instead of forbidden fmt.Println in Exec output
- Fix appendAssign by splitting append and assignment into two lines
- Replace assert.Nil/NotNil with assert.NoError/Error for error checks
- Upgrade error assertions to require when followed by dependent assertions
- Replace os.Setenv with t.Setenv in all test functions
- Restructure TestFindEnvs to use t.Setenv with unique prefixes
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove Trivy vulnerability scanning and upload of scan results to GitHub Security tab from the workflow
Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Add gpg to the list of installed packages for testing
- Specify Codecov upload flags based on Go version
Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Enable testing across Go 1.24 and 1.25 using a matrix strategy
- Update the container image to dynamically use the selected Go version
Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Add golines to the list of golangci-lint formatters
- Format multi-line env variable declarations for CLI flags for consistency
- Split string slice initializations onto multiple lines for improved readability in tests
- Use multi-line function calls for better readability in plugin and test code
- Improve readability of script command appends in logic and tests
Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Add explicit permissions for contents, packages, and security-events to the Docker GitHub Actions workflow
- Integrate Trivy vulnerability scanning and results upload into the Docker workflow
- Add a dedicated GitHub Actions workflow for Trivy security scanning of both repository files and Docker images, with scheduled, push, and pull request triggers
- Ensure Trivy SARIF results are uploaded to the GitHub Security tab after scans
Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Update Go version requirement from 1.23.0 to 1.24.0
- Upgrade golang.org/x/crypto dependency to v0.45.0
- Upgrade golang.org/x/sys dependency to v0.38.0
Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Refactor SSH-related integration tests to use a reusable SSHTestConfig struct and a new runSSHContainerTest helper function
- Support testing both key-based and password-based authentication by passing configuration via SSHTestConfig
- Move duplicated test setup code for containerized SSH server to the helper function
- Update assertions to check outputs against configurable expected values for each test
- Add test for password-based authentication in addition to existing sudo command test
Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Remove USER_PASSWORD from test environment setup
- Update comment to correctly state that password authentication is disabled
Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Disable password authentication by setting PASSWORD_ACCESS to false in TestSudoCommand
- Remove the use of direct password authentication in favor of key-based authentication in TestSudoCommand
Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Add a test that dynamically starts an OpenSSH server in a Docker container for integration testing.
- Configure the container with test credentials, allow password and sudo access, and inject the public key.
- Update the test to use the actual Docker container's hostname, dynamic port, username, and password.
- Improve error handling and test skipping if the Docker environment is not available.
Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Remove unused import of strconv
- Remove environment variables PUID and PGID from the test container setup
- Enable UseInsecureCipher in SSH options for compatibility
Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Update several dependencies to newer versions, including urfave/cli, x/crypto, ScaleFT/sshkeys, go-md2man, and x/sys
Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Add a Table of Contents section to the English, Simplified Chinese, and Traditional Chinese README files
Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Improve and clarify English wording and formatting throughout the documentation for better readability
- Update section titles and add missing punctuation for consistency
- Revise build instructions and descriptions for accuracy and clarity
- Enhance phrasing in Chinese (Simplified and Traditional) documentation for clarity and consistency
- Remove outdated explanatory comments and improve example references in all README files
Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Add links to Traditional and Simplified Chinese README files, and label English as the default language
- Fix formatting for the list of supported platforms in the main README
- Add a Simplified Chinese version of the README with equivalent content and instructions
- Add a Traditional Chinese version of the README with equivalent content and instructions
Signed-off-by: appleboy <appleboy.tw@gmail.com>
* chore: enhance testing with updated libraries and new test cases
- Update `testify` library from `v1.8.4` to `v1.10.0`
- Add dependency for `testcontainers-go` library
- Add various indirect dependencies
- Include `context` and `fmt` packages in test file
- Add test for SSH connection using `testcontainers` library
Signed-off-by: appleboy <appleboy.tw@gmail.com>
* refactor: improve performance by optimizing string conversions
- Add the `strconv` import.
- Replace `fmt.Sprintf` with `strconv.Itoa` for converting UID and GID to string.
Signed-off-by: appleboy <appleboy.tw@gmail.com>
* test: switch to alternative image source for SSH testing
- Update image name in the SSH test from `lscr.io/linuxserver/openssh-server:latest` to `linuxserver/openssh-server:latest`.
Signed-off-by: appleboy <appleboy.tw@gmail.com>
---------
Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Update `.golangci.yaml` to version 2 and streamline settings
- Remove specific linters from `.golangci.yaml` configuration
- Add exclusion and formatter settings to `.golangci.yaml`
- Change error message formatting in `plugin.go` to lowercase
- Use `strings.ReplaceAll` instead of `strings.Replace` for better readability and performance in `plugin.go` and `plugin_test.go`
Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Update Go version from 1.22 to 1.23
- Upgrade golang.org/x/crypto from version 0.29.0 to 0.36.0
- Upgrade golang.org/x/sys from version 0.27.0 to 0.31.0
- Change Docker image in GitHub Actions from golang:1.22-alpine to golang:1.23-alpine
Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Add a new dependency on `github.com/yassinebenaid/godump`
- Include `godump` in the import statements
- Add a new environment variable `DEBUG` to the existing list
- Implement a debug dump of the plugin if debugging is enabled
Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Simplify log output by removing "out:" and "err:" prefixes in `plugin.go`
- Update test expectations to match the new log output format
Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Update `github.com/urfave/cli/v2` to version `2.27.5`
- Update `golang.org/x/crypto` to version `0.29.0`
- Update `github.com/cpuguy83/go-md2man/v2` to version `2.0.5`
- Update `golang.org/x/sys` to version `0.27.0`
Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Add a `.golangci.yaml` configuration file with various linters enabled and specific settings for `gosec` and `perfsprint`.
- Change `isTimeout` from being initialized to `true` to being declared as a `bool` variable without an initial value in `plugin.go`.
Signed-off-by: appleboy <appleboy.tw@gmail.com>
My OCD just kicks in :)) This has bothered me for a long time. Will also update README in https://github.com/appleboy/ssh-action to reflect this change.
- Alias `github.com/appleboy/easyssh-proxy` import as `easyssh` in `main.go`
- Alias `github.com/appleboy/easyssh-proxy` import as `easyssh` in `plugin.go`
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
- Update `golang.org/x/crypto` dependency from `v0.24.0` to `v0.25.0`
- Update `golang.org/x/sys` dependency from `v0.21.0` to `v0.22.0`
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
- Remove `make build_linux_arm` step
- Update `docker/setup-qemu-action` from v2 to v3
- Update `docker/setup-buildx-action` from v2 to v3
- Update `docker/login-action` from v2 to v3
- Update `docker/metadata-action` from v4 to v5
- Update `docker/build-push-action` from v4 to v6
- Remove `linux/arm` from the platforms list
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
- Update `golang.org/x/crypto` dependency from v0.23.0 to v0.24.0
- Update `golang.org/x/sys` dependency from v0.20.0 to v0.21.0
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
- Update `github.com/urfave/cli/v2` to version `2.27.2`
- Update `golang.org/x/crypto` to version `0.23.0`
- Update `github.com/xrash/smetrics` to version `0.0.0-20240521201337-686a1a2994c1`
- Update `golang.org/x/sys` to version `0.20.0`
Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Change the changelog generation from using git to using GitHub
- Add custom changelog sections for build process and documentation updates with specific regex patterns and order
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
- Update `golang.org/x/crypto` from `v0.18.0` to `v0.22.0`
- Update `github.com/cpuguy83/go-md2man/v2` from `v2.0.3` to `v2.0.4`
- Update `github.com/xrash/smetrics` to a newer commit
- Update `golang.org/x/sys` from `v0.16.0` to `v0.19.0`
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
- Change the name template in `.goreleaser.yaml` from single to double quotes
- Add a changelog configuration to `.goreleaser.yaml` with categorized groups for features, bug fixes, enhancements, refactor, and others
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
- Update GitHub Actions to use newer versions (checkout to v4, codeql-action to v3, setup-go to v5, goreleaser-action to v5, golangci-lint-action to v4, codecov-action to v4)
- Remove specific Go version pinning in favor of using the version specified in go.mod
- Enable checking for the latest Go version in setup-go action
- Replace `release --rm-dist` argument with `release --clean` in goreleaser action
- Reorder steps and remove redundant checkout step in testing workflow
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* docs: improve documentation and configuration handling
- Clarify valid values for the IP protocol in usage messages for both main application and proxy settings
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* test: improve IPv6 command execution tests
- Add a new test function `TestCommandWithIPv6` to check command execution with an IPv6 address
- Initialize test variables and expected output for the IPv6 command test
- Set up a `Plugin` struct with IPv6 host, user, port, key path, script, and command timeout for testing
- Verify that `plugin.Exec()` returns `nil` (no error) in the IPv6 test
- Assert that the output of the command execution matches the expected output in the IPv6 test
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* test: enhance test suite and CI robustness
- Add support for IPv6 protocol in `TestCommandWithIPv6` test case in `plugin_test.go`
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* update
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* update
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* update
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* update
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* update2
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* update3
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* update4
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* update5
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* update5
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* update5
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
---------
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
- Add a new flag to the main.go file
- Add a new field to the Plugin type in the plugin.go file
- Remove two lines from the plugin_test.go file
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
- Add `requiretty` to the `Defaults` in sudoers
- Allow `drone-scp` to run commands without password prompt
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
- Update the version of `github.com/appleboy/easyssh-proxy` from `v1.4.1-0.20231106031702-5666e2ea5156` to `v1.5.0`
- Update the version of `github.com/urfave/cli/v2` from `v2.26.0` to `v2.27.1`
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
- Update `github.com/urfave/cli` dependency from `v2.25.7` to `v2.26.0`
- Upgrade `golang.org/x/crypto` from `v0.14.0` to `v0.17.0`
- Bump `github.com/cpuguy83/go-md2man` from `v2.0.2` to `v2.0.3`
- Update `github.com/xrash/smetrics` to a newer commit
- Update `golang.org/x/sys` from `v0.14.0` to `v0.15.0`
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
- Add a new `.hadolint.yaml` configuration file with specific rule ignores
- Update the Dockerfile to install `ca-certificates` without a fixed version
- Add commands to create a `deploy` user and group with UID and GID `1000`, set home directory, and set ownership
- Set the Docker container to run as the `deploy` user with UID and GID `1000`
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
- Update the `go-version` in the lint.yml file from `^1` to `^1.21`
- Update the version of `github.com/appleboy/easyssh-proxy` in the go.mod file from `v1.4.0` to `v1.4.1-0.20231106031702-5666e2ea5156`
- Update the version of `golang.org/x/crypto` in the go.mod file from `v0.10.0` to `v0.14.0`
- Update the version of `golang.org/x/sys` in the go.mod file from `v0.9.0` to `v0.14.0`
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
- Fix a typo in the cron expression for the codeql.yml workflow
- Change the language specification from ['go'] to ['go'] in the codeql.yml workflow
- Change the version specification from 'v*' to 'v*' in the docker.yml workflow
- Change the branch specification from 'master' to 'master' in the docker.yml workflow
- Change the go-version specification from '^1' to '^1.21' in the docker.yml workflow
- Remove the name "Set up QEMU" in the docker.yml workflow
- Remove the name "Set up Docker Buildx" in the docker.yml workflow
- Remove the name "Login to Docker Hub" in the docker.yml workflow
- Remove the name "Login to GitHub Container Registry" in the docker.yml workflow
- Remove the name "Docker meta" in the docker.yml workflow
- Remove the name "Build and push" in the docker.yml workflow
- Change the version specification from '*' to '*' in the goreleaser.yml workflow
- Remove the name "Checkout" in the goreleaser.yml workflow
- Remove the name "Setup go" in the goreleaser.yml workflow
- Change the go-version specification from '^1' to '^1' in the goreleaser.yml workflow
- Remove the name "Run GoReleaser" in the goreleaser.yml workflow
- Change the go-version specification from '^1' to '^1' in the lint.yml workflow
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
- Add a new flag `allenvs` to pass all environment variables to the shell script
- Implement the `AllEnvs` functionality in the `exec` function
- Add a new function `findEnvs` to find all environment variables with specified prefixes
- Add tests for the `findEnvs` function and the `AllEnvs` functionality
- Add a comment to clarify the purpose of the `format` function
- Add a comment to clarify the purpose of the `log` function
- Modify the `log` function to always print the message, removing the previous conditional statement
Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Update urfave/cli/v2 from v2.25.5 to v2.25.7
- Update golang.org/x/crypto from v0.9.0 to v0.10.0
- Update golang.org/x/sys from v0.8.0 to v0.9.0 (indirect)
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
- Add `bin` to .gitignore
- Change output path for the executable in Makefile
- Update `github.com/stretchr/testify` to v1.8.4
- Update `github.com/urfave/cli/v2` to v2.25.5
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
- Update `github.com/urfave/cli/v2` dependency from `v2.25.3` to `v2.25.4`
- Update `golang.org/x/crypto` dependency from `v0.8.0` to `v0.9.0`
Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Update `github.com/urfave/cli/v2` from `v2.25.1` to `v2.25.3`
- Update `golang.org/x/sys` from `v0.7.0` to `v0.8.0` (indirect)
Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Add an option to include extra pre-existing files in the release with a specified file format (`.xz`)
Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Add `INPUT_ENVS_FORMAT` to the list of environment variables in `main.go`
- Define `envsFormat` variable in `plugin.go`
- Add default value for `Config.EnvsFormat` in `plugin.go` `Exec()` function
fix https://github.com/appleboy/drone-ssh/pull/235
**Reason:**
I have to use drone-ssh to work with Windows SSH. Initially, drone-ssh is written so that it transmits environment variables through the `export` command. Which makes it unsuitable for working with Power Shell.
**Solution:**
I have added a new option to configure environment variable commands formatting, with default value: `export {NAME}={VALUE}`. When I use drone-ssh with PowerShell I set this option like this: `$env:{NAME} = {VALUE}`.
- Upgrade easyssh-proxy from v1.3.9 to v1.3.10
- Upgrade testify from v1.8.1 to v1.8.2
- Upgrade crypto from v0.7.0 to v0.8.0
- Upgrade sys from v0.6.0 to v0.7.0
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
- Modify the `EnvVars` slice to include `INPUT_` prefix when needed
- Remove unused environment variables from the `EnvVars` slice
- Update the `EnvVars` slice to include `PROXY_` prefix when needed
- Modify the `EnvVars` slice to include `PLUGIN_SSH_CIPHERS` as `PROXY_SSH_CIPHERS`
- Modify the `EnvVars` slice to include `PLUGIN_PROXY_USE_INSECURE_CIPHER` as `PROXY_SSH_USE_INSECURE_CIPHER`
- Modify the `EnvVars` slice to include `PLUGIN_PROXY_FINGERPRINT` as `PROXY_SSH_FINGERPRINT`
- Remove the environment variable `PROXY_HOST`
- Modify the `EnvVars` slice to include `PLUGIN_DEBUG` as `INPUT_DEBUG`
* https://github.com/appleboy/ssh-action/issues/53#issuecomment-1184700432
* https://github.com/appleboy/ssh-action/issues/32#issuecomment-1184700363
* https://github.com/appleboy/ssh-action/issues/213
- Add `trimValues` function for cleaning up slice values
- Remove unused `wg.Done()` call
- Modify `Exec` function to launch goroutines for each host in `Config.Host`
- Add test for `ScriptStop` with multiple hosts and sync mode
refer to: https://github.com/appleboy/ssh-action/issues/233
- Add Open Container Initiative labels for image source, description, and licenses
- Update `apk` command to include specific version of `ca-certificates`
Signed-off-by: Bo-Yi.Wu <appleboy.tw@gmail.com>
- Update the `image` field to use `ghcr.io/appleboy/drone-ssh` in DOCS.md
- Update the `image` field to use `ghcr.io/appleboy/drone-ssh` in README.md
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
- Update urfave/cli to version 2.25.1
- Update golang.org/x/crypto to version 0.7.0
- Update golang.org/x/sys to version 0.6.0 (indirect)
Signed-off-by: Bo-Yi.Wu <appleboy.tw@gmail.com>
- Add a new file `.goreleaser.yaml`
- Configure builds for multiple operating systems and architectures
- Set flags and ldflags for the builds
- Add a binary name template for the builds
- Add an archive format
- Add a checksum template
- Add a snapshot template
Signed-off-by: Bo-Yi.Wu <appleboy.tw@gmail.com>
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 "*"`;doecho"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 "*"`;doecho"compressing $${file}"&&$(GO) run $(GXZ_PAGAGE) -k -9 $${file};done;
[](https://github.com/appleboy/drone-ssh/actions/workflows/testing.yml)
A Drone plugin for executing commands on remote hosts via SSH. For usage instructions and a list of available options, please refer to [the documentation](http://plugins.drone.io/appleboy/drone-ssh/).
**Note: Please update your Drone image config path to `appleboy/drone-ssh`. The `plugins/ssh` image is no longer maintained.**

## Table of Contents
- [drone-ssh](#drone-ssh)
- [Table of Contents](#table-of-contents)
- [Breaking Changes](#breaking-changes)
- [Build or Download a Binary](#build-or-download-a-binary)
- [Docker](#docker)
- [Usage](#usage)
- [Mount Key from File Path](#mount-key-from-file-path)
- [Configuration](#configuration)
## Breaking Changes
As of `v1.5.0`, the command timeout flag has changed to use the `Duration` format. See the following example:
```diff
pipeline:
scp:
image: ghcr.io/appleboy/drone-ssh
settings:
host:
- example1.com
- example2.com
username: ubuntu
password:
from_secret: ssh_password
port: 22
- command_timeout: 120
+ command_timeout: 2m
script:
- echo "Hello World"
```
go build
go test
## Build or Download a Binary
Pre-compiled binaries are available on the [releases page](https://github.com/appleboy/drone-ssh/releases), supporting the following operating systems:
- Windows amd64/386
- Linux arm/amd64/386
- macOS (Darwin) amd64/386
If you have `Go` installed:
```sh
go install github.com/appleboy/drone-ssh@latest
```
Or build the binary manually with the following commands:
```sh
exportGOOS=linux
exportGOARCH=amd64
exportCGO_ENABLED=0
exportGO111MODULE=on
go test -cover ./...
go build -v -a -tags netgo -o release/linux/amd64/drone-ssh .
```
## Docker
Build the docker image with the following commands:
Build the Docker image with the following command:
```
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -tags netgo
docker build -t appleboy/drone-ssh .
```
Please note incorrectly building the image for the correct x64 linux and with
GCO disabled will result in an error when running the Docker image:
```
docker: Error response from daemon: Container command
'/bin/drone-ssh' not found or does not exist..
```sh
make docker
```
## Usage
Execute from the working directory:
Run from your working directory:
```sh
docker run --rm \
-e PLUGIN_HOST=foo.com \
-e PLUGIN_USER=root \
-e PLUGIN_USERNAME=root \
-e PLUGIN_KEY="$(cat ${HOME}/.ssh/id_rsa)"\
-e PLUGIN_SCRIPT=whoami \
-v $(pwd):$(pwd)\
-w $(pwd)\
appleboy/drone-ssh
ghcr.io/appleboy/drone-ssh
```
## Mount Key from File Path
Make sure to enable `trusted` mode in your project settings (for [Drone 0.8 version](https://0-8-0.docs.drone.io/)).

Mount the private key in the `volumes` section of your `.drone.yml` config:
```diff
pipeline:
ssh:
image: ghcr.io/appleboy/drone-ssh
host: xxxxx.com
username: deploy
+ volumes:
+ - /root/drone_rsa:/root/ssh/drone_rsa
key_path: /root/ssh/drone_rsa
script:
- echo "test ssh"
```
See details in [this issue comment](https://github.com/appleboy/drone-ssh/issues/51#issuecomment-336732928).
## Configuration
See [DOCS.md](./DOCS.md) for examples and full configuration options.
Configuration options are loaded from multiple sources:
0. Hardcoded drone-ssh defaults. See [main.go CLI Flags](https://github.com/appleboy/drone-ssh/blob/6d9d6acc6aef1f9166118c6ba8bd214d3a582bdb/main.go#L39) for more information.
1. From a dotenv file at a path specified by the `PLUGIN_ENV_FILE` environment variable.
2. From your `.drone.yml` Drone configuration.
Later sources override earlier ones. For example, if `PORT` is set in an `.env` file committed in the repository or created by previous test steps, it will override the default set in `main.go`.
[](https://github.com/appleboy/drone-ssh/actions/workflows/testing.yml)
[](https://github.com/appleboy/drone-ssh/actions/workflows/testing.yml)
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.