Commit Graph

390 Commits

Author SHA1 Message Date
appleboy
4a649cfe45
refactor: refactor SSH authentication handling with switch statement
- Refactor if-else logic to a switch statement for handling SSH authentication methods

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2025-04-27 09:46:02 +08:00
appleboy
1849c53ed5
test: refactor SSH integration tests with reusable config and helpers
- 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>
2025-04-27 09:31:46 +08:00
appleboy
798fc4fa72
test: remove password authentication from test environment
- 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>
2025-04-27 09:25:49 +08:00
appleboy
0d02cbb190
refactor: migrate TestSudoCommand to key-based authentication
- 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>
2025-04-27 09:24:52 +08:00
appleboy
ff79cee470
test: enable insecure cipher suites for test compatibility
- Enable insecure ciphers in test configuration for compatibility

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2025-04-27 09:10:09 +08:00
appleboy
412193b000
test: add dynamic OpenSSH server integration tests using Docker
- 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>
2025-04-27 09:09:46 +08:00
appleboy
e899efd3c6
refactor: simplify test setup and improve SSH compatibility
- 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>
2025-04-26 23:17:37 +08:00
appleboy
3fd8cd5cc0
chore: upgrade core dependencies to latest supported versions
- 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>
2025-04-26 23:10:13 +08:00
appleboy
1dfeaffef3
docs: add Table of Contents to all language README files
- Add a Table of Contents section to the English, Simplified Chinese, and Traditional Chinese README files

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2025-04-26 22:00:28 +08:00
appleboy
734d4df2c8
docs: refine and unify documentation wording and formatting
- 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>
2025-04-26 21:58:19 +08:00
appleboy
6b748335c1
docs: localize README with Simplified and Traditional Chinese translations
- 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>
2025-04-26 21:51:44 +08:00
appleboy
15f08d99ca
test: adjust configuration parameters for system integrations
- Change `SUDO_ACCESS` value from `true` to `false` in SSH with Testcontainers test

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2025-04-12 23:02:59 +08:00
Bo-Yi Wu
13ee47326a
chore: enhance testing with updated libraries and new test cases (#288)
* 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>
2025-04-12 22:21:42 +08:00
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