Compare commits

..

9 commits

Author SHA1 Message Date
Andreas Mieke cbaf75ab09 Merge branch 'release/1.0.2'
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-12-29 14:04:15 +01:00
Andreas Mieke afd86aa76c docs: Add CI badge
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-12-29 14:04:02 +01:00
Andreas Mieke b62205be18 docs: Add ReadMe
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-12-29 13:58:04 +01:00
Andreas Mieke 2648c4c9a5 fix: Make scp verbose, so progress can be tracked
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-12-29 13:28:13 +01:00
Andreas Mieke b54f434cb2 fix: Remove ambigious chmod for directory
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-12-29 13:25:32 +01:00
Andreas Mieke 8a083f992d fix: Add leading zero
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-12-29 13:20:31 +01:00
Andreas Mieke 4e2763d775 fix: SSH file permissions
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-12-29 13:18:39 +01:00
Andreas Mieke ecdecec5c6 ci: Disable build step on develop and master
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Since build is inlcuded in publish jobs.
2023-12-29 13:02:20 +01:00
Andreas Mieke 13ed7c73a4 Merge tag '1.0.1' into develop
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Version 1.0.1

Fixes to test CI
2023-12-29 12:55:21 +01:00
3 changed files with 50 additions and 1 deletions

View file

@ -6,6 +6,10 @@ steps:
repo: git.merp.digital/${CI_REPO_OWNER}/woodpecker-scp
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x
registry: git.merp.digital
when:
- event: push
branch:
exclude: [develop, master]
publish-nightly:
image: woodpeckerci/plugin-docker-buildx

43
README.md Normal file
View file

@ -0,0 +1,43 @@
# woodpecker-scp
[![status-badge](https://ci.merp.digital/api/badges/2/status.svg)](https://ci.merp.digital/repos/2)
woodpecker-scp is a small plugin for weoodpecker, which allows users to upload diretories and files to any server that supports scp.
## Usage
To use woodpecker-scp use the following entries in your `.woodpecker.yml`:
```yaml
publish:
image: git.merp.digital/eranmorkon/woodpecker-scp:latest
settings:
ssh_key:
from_secret: ssh_key
ssh_known_hosts:
from_secret: ssh_known_hosts
extra_flags: -r
source: local-path
destination: "user@server:remote-path"
```
The plugin is published in the `git.merp.digital` oci registry, the `latest` tag is always the latest release, addidtionally release tags in the format `x.y.z` point to the specified releases. The `develop` tag always holds the latest commit to the develop branch and can therefore be seen as nighty, it is definitely not stable however.
## Settings
### ssh_key
The SSH key holds the private key scp will use to connect to the server, I would recommend to generate a new private/public key pair for your CI job and add the contents of your private key file as secret. The add the public key to the server's `~/.ssh/authorized_keys` file as usual.
### ssh_known_hosts
This should be the content of the `~/.ssh/known_hosts` file. This is used to let scp verify the identity of the remote server. If you skip this step the transfer will not work, as scp can not verify that the server you are connecting to is actually the server you want to connect to. You can disable this behaviour using `extra_flags` but I highly recommend to not do that, and instead add the `known_hosts` entry.
### extra_flags
This setting is used to add extra flags to the scp command. Per default scp will be executed with the `-Bv` flags, for `batch mode` and `verbose` so you can see some output from scp in the CI log. You can add any flag that scp supports, for example `-r` for a recursive copy.
### source
The source directory scp will copy the data from, this can be in the CI container, or on a remote server, however the later one is untested at the moment.
### destination
The destination directory scp will copy the data to, this can be on a remote server, or in the CI container, however the later one is untested at the moment.
## License
Licensed under the [MIT](https://choosealicense.com/licenses/mit/) license.
`SPDX-License-Identifier: MIT`

View file

@ -2,5 +2,7 @@
mkdir -p /root/.ssh
echo "${PLUGIN_SSH_KEY}" > "/root/.ssh/id_rsa"
chmod 0600 /root/.ssh/id_rsa
echo "${PLUGIN_SSH_KNOWN_HOSTS}" > "/root/.ssh/known_hosts"
scp -B ${PLUGIN_EXTRA_FLAGS} ${PLUGIN_SOURCE} ${PLUGIN_DESTINATION}
chmod 0600 /root/.ssh/known_hosts
scp -Bv ${PLUGIN_EXTRA_FLAGS} ${PLUGIN_SOURCE} ${PLUGIN_DESTINATION}