mirror of
https://github.com/tektoncd/catalog.git
synced 2024-11-23 06:08:46 +00:00
Add remote-scp new task
feat: update minVersion Add remote-scp new task
This commit is contained in:
parent
c76eaf1ecb
commit
2552043d66
111
task/remote-scp/0.1/README.md
Normal file
111
task/remote-scp/0.1/README.md
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
# Remote SCP
|
||||||
|
Remote SCP is a simple tool to copy files from a remote local machine to your server.
|
||||||
|
|
||||||
|
## Install the Task
|
||||||
|
```
|
||||||
|
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/remote-scp/0.1/raw
|
||||||
|
```
|
||||||
|
## Parameters
|
||||||
|
HOST: The server host to which you want to connect. (Required)
|
||||||
|
USERNAME: Connect as an user. (Required)
|
||||||
|
PORT: Port number to connect (default: 22).
|
||||||
|
TO_PATH: The path to which you want to copy the file. (Required)
|
||||||
|
LOCAL_PATH: The path of the file to be copied. (Required)
|
||||||
|
|
||||||
|
## Workspaces
|
||||||
|
- credentials: The workspace contains secrets can be used to authenticate with the HOST.
|
||||||
|
Secrets
|
||||||
|
id_rsa: The private key of the user.
|
||||||
|
- storage: The workspace contains the file to be copied.
|
||||||
|
PersistentVolumeClaim
|
||||||
|
## Platforms
|
||||||
|
The Task can be run on linux/amd64 platform.
|
||||||
|
## Usage
|
||||||
|
1. Create the Secret by putting in the required values
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
type: Opaque
|
||||||
|
metadata:
|
||||||
|
name: remote-scp-secret
|
||||||
|
data:
|
||||||
|
id_rsa: |
|
||||||
|
<base64 encoded private key>
|
||||||
|
```
|
||||||
|
2. Create the PVC
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: test-pv
|
||||||
|
spec:
|
||||||
|
storageClassName: manual
|
||||||
|
capacity:
|
||||||
|
storage: 2Gi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteMany
|
||||||
|
persistentVolumeReclaimPolicy: Retain
|
||||||
|
nfs:
|
||||||
|
path: /nfs/path/
|
||||||
|
server: 127.0.0.1
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: test-pvc
|
||||||
|
spec:
|
||||||
|
storageClassName: manual
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteMany
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 2Gi
|
||||||
|
```
|
||||||
|
3. Create Test File
|
||||||
|
```bash
|
||||||
|
touch /nfs/path/test.txt
|
||||||
|
```
|
||||||
|
4. Create the TaskRun
|
||||||
|
```yaml
|
||||||
|
apiVersion: tekton.dev/v1beta1
|
||||||
|
kind: TaskRun
|
||||||
|
metadata:
|
||||||
|
name: remote-scp-run
|
||||||
|
spec:
|
||||||
|
taskRef:
|
||||||
|
name: remote-scp
|
||||||
|
workspaces:
|
||||||
|
- name: credentials
|
||||||
|
secret:
|
||||||
|
secretName: remote-scp-secret
|
||||||
|
- name: storage
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: test-pvc
|
||||||
|
params:
|
||||||
|
- name: HOST
|
||||||
|
value: "server.boychai.xyz"
|
||||||
|
- name: PORT
|
||||||
|
value: "45"
|
||||||
|
- name: USERNAME
|
||||||
|
value: "root"
|
||||||
|
- name: TO_PATH
|
||||||
|
value: "/temp/"
|
||||||
|
- name: LOCAL_PATH
|
||||||
|
value: "test.txt"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Output
|
||||||
|
```text
|
||||||
|
drone-scp version: v1.6.14
|
||||||
|
tar all files into /tmp/OUGGuOpyIt.tar.gz
|
||||||
|
remote server os type is unix
|
||||||
|
scp file to server.
|
||||||
|
create folder /temp/
|
||||||
|
remove file OUGGuOpyIt.tar.gz
|
||||||
|
untar file OUGGuOpyIt.tar.gz
|
||||||
|
===================================================
|
||||||
|
✅ Successfully executed transfer data to all host
|
||||||
|
===================================================
|
||||||
|
```
|
45
task/remote-scp/0.1/remote-scp.yaml
Normal file
45
task/remote-scp/0.1/remote-scp.yaml
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
apiVersion: tekton.dev/v1
|
||||||
|
kind: Task
|
||||||
|
metadata:
|
||||||
|
name: remote-scp
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/version: "0.1"
|
||||||
|
annotations:
|
||||||
|
tekton.dev/pipelines.minVersion: "0.50.0"
|
||||||
|
tekton.dev/categories: Developer Tools
|
||||||
|
tekton.dev/tags: scp,remote
|
||||||
|
tekton.dev/displayName: "scp remote"
|
||||||
|
tekton.dev/platforms: "linux/amd64"
|
||||||
|
spec:
|
||||||
|
description: >-
|
||||||
|
The following tasks can be used to remotely upload files.
|
||||||
|
workspaces:
|
||||||
|
- name: credentials
|
||||||
|
description: >-
|
||||||
|
SSH private key
|
||||||
|
- name: storage
|
||||||
|
description: >-
|
||||||
|
External storage
|
||||||
|
params:
|
||||||
|
- name: HOST
|
||||||
|
type: string
|
||||||
|
description: Remote host to connect
|
||||||
|
- name: USERNAME
|
||||||
|
type: string
|
||||||
|
description: SSH username
|
||||||
|
- name: PORT
|
||||||
|
type: string
|
||||||
|
description: SSH port, default is 22
|
||||||
|
default: "22"
|
||||||
|
- name: TO_PATH
|
||||||
|
type: string
|
||||||
|
description: upload to path
|
||||||
|
- name: LOCAL_PATH
|
||||||
|
type: string
|
||||||
|
description: local path
|
||||||
|
steps:
|
||||||
|
- name: put
|
||||||
|
image: docker.io/appleboy/drone-scp:1.6.14@sha256:0e0597678b948b0aa09888c66ac75af904cce81baf6af955208527d259c61818
|
||||||
|
script: |
|
||||||
|
cd "$(workspaces.storage.path)" || exit
|
||||||
|
drone-scp --host "$(params.HOST)" --port "$(params.PORT)" --username "$(params.USERNAME)" --key-path "$(workspaces.credentials.path)/id_rsa" --target "$(params.TO_PATH)" --source "$(params.LOCAL_PATH)"
|
23
task/remote-scp/0.1/samples/run.yaml
Normal file
23
task/remote-scp/0.1/samples/run.yaml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
apiVersion: tekton.dev/v1beta1
|
||||||
|
kind: TaskRun
|
||||||
|
metadata:
|
||||||
|
name: remote-scp-run
|
||||||
|
spec:
|
||||||
|
taskRef:
|
||||||
|
name: remote-scp
|
||||||
|
workspaces:
|
||||||
|
- name: credentials
|
||||||
|
secret:
|
||||||
|
secretName: remote-scp-secret
|
||||||
|
- name: storage
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: test-pvc
|
||||||
|
params:
|
||||||
|
- name: HOST
|
||||||
|
value: "127.0.0.1"
|
||||||
|
- name: USERNAME
|
||||||
|
value: "user"
|
||||||
|
- name: TO_PATH
|
||||||
|
value: "/temp/"
|
||||||
|
- name: LOCAL_PATH
|
||||||
|
value: "local_PATH"
|
7
task/remote-scp/0.1/samples/secrets.yaml
Normal file
7
task/remote-scp/0.1/samples/secrets.yaml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
type: Opaque
|
||||||
|
metadata:
|
||||||
|
name: remote-scp-secret
|
||||||
|
data:
|
||||||
|
id_rsa: your private ssh key in base64
|
27
task/remote-scp/0.1/samples/storage.yaml
Normal file
27
task/remote-scp/0.1/samples/storage.yaml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: test-pv
|
||||||
|
spec:
|
||||||
|
storageClassName: manual
|
||||||
|
capacity:
|
||||||
|
storage: 2Gi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteMany
|
||||||
|
persistentVolumeReclaimPolicy: Retain
|
||||||
|
nfs:
|
||||||
|
path: /nfs/path/
|
||||||
|
server: 127.0.0.1
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: test-pvc
|
||||||
|
spec:
|
||||||
|
storageClassName: manual
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteMany
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 2Gi
|
Loading…
Reference in New Issue
Block a user