Commit Graph

377 Commits

Author SHA1 Message Date
appleboy
b16a10d30e
build: improve efficiency and release process with optimizations
- Add `.dockerignore` file to exclude all files except those in the `release/` directory

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2025-04-11 23:43:50 +08:00
appleboy
7df1147156
build: optimize and upgrade dependencies for improved performance
- Update the base image in Dockerfile from alpine:3.20 to alpine:3.21

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2025-04-11 23:43:22 +08:00
appleboy
0ec46c4fd2
chore: update and streamline linting configuration and error formatting
- 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>
2025-03-29 09:39:55 +08:00
appleboy
07c75984e5
ci: update GitHub actions and improve project configurations
- Update golangci-lint action to version 7
- Update codecov action to version 5

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2025-03-29 09:35:49 +08:00
appleboy
37b95a017d
chore: upgrade Go and dependencies to improve compatibility
- 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>
2025-03-09 21:43:05 +08:00
appleboy
1fabfc4f97
chore: implement debug functionality with godump integration
- 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>
2025-03-09 21:42:02 +08:00
Bo-Yi Wu
883f947b4f
chore(log): remove prefix out: and err: prefix (#287)
- 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>
2024-11-17 14:48:14 +08:00
appleboy
2c52afb7fd
fix: improve script file handling and testing robustness
- Add a check to verify if the script file exists before reading it

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2024-11-17 14:32:06 +08:00
appleboy
d56db7a5b3
chore(deps): update dependencies to latest versions
- 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>
2024-11-17 14:18:47 +08:00
appleboy
67cd964f13
ci(github): improve CI workflows and API integration
- Add `fetch-depth: 0` to the `actions/checkout` step in the `goreleaser` GitHub workflow

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2024-11-16 10:05:31 +08:00
appleboy
2519a9a894
ci(golangci): enable comprehensive linting and update variable initialization
- 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>
2024-11-16 09:58:21 +08:00
appleboy
1edb4744ca
feat(envs): support drone plugin
- Add `PLUGIN_SCRIPT_FILE` to the environment variables list in the main function

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2024-10-27 22:22:23 +08:00
Kyle Leonhard
43270d582c
chore: add support for passing commands via a file (#285) 2024-10-24 09:56:07 +08:00
Lukáš Tesař
dc927a6123
fix: typo in success message (#283)
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.
2024-10-13 09:00:20 +08:00
Bo-Yi Wu
ceb4e12d92
chore: update base image to Alpine 3.20
- Update base image from alpine version 3.17 to 3.20

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2024-09-07 15:15:40 +08:00
Bo-Yi Wu
2041794fd5
ci: update Go version and enhance GitHub Actions workflow
- Update Go version in GitHub Actions workflow from 1.21 to 1.22

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2024-07-14 15:42:01 +08:00
Bo-Yi Wu
a2d37cbc1d
chore: update dependencies and improve test coverage
- Update Go version from 1.18 to 1.22 in go.mod

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2024-07-14 15:35:48 +08:00
Bo-Yi Wu
aa872a30be
style: refactor import aliases for easyssh library
- 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>
2024-07-14 15:30:53 +08:00
Bo-Yi Wu
c049944302
chore: update Go dependencies to latest versions
- 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>
2024-07-14 15:25:54 +08:00
Bo-Yi Wu
0914cd212b
test: enable comprehensive debugging in plugin execution (#278)
* test: enable comprehensive debugging in plugin execution

- Add debug logging to `exec` function in `plugin.go`
- Enable debug mode in `TestCommandOutput` and `TestSudoCommand` tests
- Remove redundant command blocks from multiple tests in `plugin_test.go`

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* test: refactor codebase to improve performance and readability

- Remove debug command block from `TestSudoCommand` test

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* refactor: refactor test environment setup and command markers

- Add environment markers to `TestCommandOutput` for localhost and 127.0.0.1
- Remove command markers from `TestFingerprint`

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* fix: improve environment variable handling in debug mode

- Add a check for non-empty environment variables when debug mode is enabled
- Remove redundant environment variable output in tests

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

---------

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2024-07-14 15:24:36 +08:00
Bo-Yi Wu
e28acf4f3b
ci: update Docker actions and remove ARM build step
- 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>
2024-07-14 14:23:53 +08:00
Bo-Yi Wu
c0e111cbef
ci: update GoReleaser action to version 6
- Update GoReleaser action from version 5 to version 6

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2024-06-12 15:06:46 +08:00
Bo-Yi Wu
50e34882a3
chore: update Go dependencies to latest versions
- 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>
2024-06-05 13:31:31 +08:00
appleboy
31607874dc
chore: update dependencies to latest versions
- 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>
2024-06-01 10:08:07 +08:00
appleboy
591c6c9f77
ci: update GitHub workflows and improve test configurations
- Update golangci-lint-action from v4 to v6 in GitHub workflow

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2024-06-01 09:54:06 +08:00
appleboy
be0b134f0a
ci: optimize CI/CD pipeline with Docker build cache
- Add Docker build cache configuration to GitHub Actions workflow

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2024-06-01 09:53:09 +08:00
Bo-Yi Wu
dc026ac547
feat: refactor configuration handling in main function (#275)
- Add `FilePath` attribute with value `.host` to the configuration in `main` function

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2024-06-01 09:50:16 +08:00
Bo-Yi Wu
2e8030ff52
build: improve system compatibility and performance (#274)
- Add `tzdata` package to the Dockerfile

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2024-06-01 09:29:39 +08:00
Bo-Yi Wu
5401378058
chore: refine Changelog Generation Process
- 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>
2024-04-19 10:27:48 +08:00
Bo-Yi Wu
046c21368d
chore: update dependencies to latest versions
- 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>
2024-04-18 08:22:08 +08:00
Bo-Yi Wu
e8a39a16a6
chore: refactor release process configuration
- Change the changelog configuration in `.goreleaser.yaml` from using GitHub to using git.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2024-04-02 15:58:52 +08:00
Bo-Yi Wu
f8b1db2997
chore: refine goreleaser configuration and output
- 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>
2024-04-02 14:57:44 +08:00
Bo-Yi Wu
f37c5b3557
ci: refactor CI workflows and update actions
- 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>
2024-04-02 14:10:03 +08:00
appleboy
2c5e17dd2e
docs: update badge
Signed-off-by: appleboy <appleboy.tw@gmail.com>
2024-03-16 13:00:11 +08:00
appleboy
42f9adb1b5
test: rename the workflow 2024-03-16 12:58:52 +08:00
Bo-Yi Wu
cafc139713
test: enhance testing and internal API robustness (#269)
* test: support ipv6

* chore: update

Signed-off-by: appleboy <appleboy.tw@gmail.com>

* chore: update

Signed-off-by: appleboy <appleboy.tw@gmail.com>

---------

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2024-03-16 11:29:44 +08:00
appleboy
7d0a886109
refactor: remove unnecessary line setting FilePath field to .host
- Remove the line that sets the `FilePath` field to `.host`

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2024-01-27 11:22:04 +08:00
Bo-Yi Wu
a83bebeafe
refactor: refactor environment variable naming
- Rename environment variables to include `_PROXY_` in their names

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2024-01-21 09:35:37 +08:00
Bo-Yi Wu
a41d4afc40
chore(protocol): improve IPv6 address. (#268)
* 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>
2024-01-21 09:27:49 +08:00
Bo-Yi Wu
91fd4f8071
chore: update golang.org/x/crypto to v0.18.0 in go.mod file
- Update golang.org/x/crypto from v0.17.0 to v0.18.0 in the go.mod file

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2024-01-11 20:53:31 +08:00
Bo-Yi Wu
b34fffdbd3
feat: update plugin functionality in main.go and plugin.go files
- 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>
2024-01-07 17:44:54 +08:00
Bo-Yi Wu
d217773bac
test: increase test coverage for SudoCommand function
- Add a test for the SudoCommand function

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2024-01-07 17:40:23 +08:00
Bo-Yi Wu
ae023d7aa6
chore: update sudoers file for improved security and permissions management
- 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>
2024-01-07 17:21:59 +08:00
Bo-Yi Wu
222545746b
chore: refactor build and deployment processes
- Add `sudo` to the apk add command in the lint workflow
- Add SSH server setup to the Makefile

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2024-01-07 17:13:16 +08:00
Bo-Yi Wu
a5f89304fd
chore: update golang.org/x/sys to v0.16.0 in go.mod file
- Update the version of `golang.org/x/sys` from `v0.15.0` to `v0.16.0` in the `go.mod` file

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2024-01-07 13:38:54 +08:00
Bo-Yi Wu
a9cfc0c134
chore: update external dependencies to latest versions
- 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>
2024-01-01 13:53:45 +08:00
Bo-Yi Wu
13ba21acf6
chore: update dependencies to latest versions
- 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>
2023-12-26 13:33:32 +08:00
Bo-Yi Wu
e270b033d1
ci: update dependencies and workflows
- Update the Golang version in the lint workflow from `1.19-alpine` to `1.21-alpine`

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2023-12-26 13:29:44 +08:00
Bo-Yi Wu
aa9314a009
chore: add default user for enhanced security (#267)
- 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>
2023-12-26 13:29:22 +08:00
Bo-Yi Wu
037e0231ac
chore: update dependencies to latest versions
- 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>
2023-11-06 11:20:51 +08:00