Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdf1c03f

Browse files
added page for SSH keys (#246)
* added page for SSH keys* added title and url to nav.yml for "using-ssh-keys"* updated document* fixed links* fixed links
1 parent2896357 commitdf1c03f

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

‎_data/nav.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,8 @@
534534
url:"/validation-port-warnings"
535535
-title:Forbidden Cluster Resources
536536
url:"/forbidden-cluster-resources"
537+
-title:How to use SSH keys in freestyle steps
538+
url:"using-ssh-keys"
537539
-title:Failed to get accounts clusters during workflow
538540
url:"/failed-to-get-accounts-clusters-during-workflow"
539541
-title:API Paging issues
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
title:"How to use SSH keys in freestyle steps"
3+
description:"Running commands remotely from Codefresh Pipeline"
4+
group:troubleshooting
5+
sub_group:common-issues
6+
toc:true
7+
---
8+
9+
You can easily connect to external servers in Codefresh pipelines and run commands with them via SSH.
10+
11+
First, you need to create or find a Docker image with the SSH client. A good choice is[https://hub.docker.com/r/praqma/network-multitool](https://hub.docker.com/r/praqma/network-multitool) as it has several other networking tools inside.
12+
13+
Then create a freestyle step in your pipeline like this:
14+
15+
16+
{% highlight yaml %}
17+
{% raw %}
18+
ssh:
19+
title: "Executing command over SSH"
20+
type: "freestyle"
21+
image: "praqma/network-multitool"
22+
commands:
23+
- mkdir /root/.ssh
24+
- echo ${{SSH_KEY}} | base64 -d > /root/.ssh/id_rsa ## Value of ${{SSH_KEY}} is base64 encoded
25+
- chmod 600~/.ssh/id_rsa
26+
- eval $(ssh-agent -s)
27+
- ssh-add~/.ssh/id_rsa
28+
- ssh -o "StrictHostKeyChecking no" user@host
29+
- ssh user@host 'command'
30+
{% endraw %}
31+
{% endhighlight %}
32+
33+
34+
The pipeline expects a[variable]({{site.baseurl}}/docs/codefresh-yaml/variables/) called “SSH” that you can enter directly or fetch from[shared configuration]({{site.baseurl}}/docs/configure-ci-cd-pipeline/shared-configuration/).
35+
36+
Replace user, host, and command with your own values.
37+
38+
##What to read next
39+
40+
*[How to use SSH keys with GIT]({{site.baseurl}}/docs/docs/integrations/git-providers/#ssh-keys)
41+
*[How to deploy with SCP]({{site.baseurl}}/docs/docs/yaml-examples/examples/deploy-to-tomcat-via-scp/)
42+
*[How to deploy with FTP]({{site.baseurl}}/docs/docs/yaml-examples/examples/transferring-php-ftp/)
43+
44+
45+
46+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp