Skip to content

Commit 72bafe6

Browse files
committed
Merge pull request #1 from gkiki90/new_yml_format
New yml format
2 parents e343bda + 5572549 commit 72bafe6

File tree

6 files changed

+65
-33
lines changed

6 files changed

+65
-33
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.bitrise*
2+
ssh/

_tests/test_ok.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
THIS_SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
88
cd "${THIS_SCRIPTDIR}"
99

10-
export SSH_RSA_PRIVATE_KEY=$(<testkey_ok)
11-
export SSH_KEY_SAVE_PATH="$(PWD)/testsave"
12-
export IS_REMOVE_OTHER_IDENTITIES="true"
10+
export ssh_rsa_private_key=$(<testkey_ok)
11+
export ssh_key_save_path="$(PWD)/testsave"
12+
export is_remove_other_identities="true"
1313

1414
bash ../step.sh
1515
if [ $? -ne 0 ] ; then

_tests/test_wrong.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
THIS_SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
88
cd "${THIS_SCRIPTDIR}"
99

10-
export SSH_RSA_PRIVATE_KEY=$(<testkey_wrong)
11-
export SSH_KEY_SAVE_PATH="$(PWD)/testsave"
12-
export IS_REMOVE_OTHER_IDENTITIES="true"
10+
export ssh_rsa_private_key=$(<testkey_wrong)
11+
export ssh_key_save_path="$(PWD)/testsave"
12+
export is_remove_other_identities="true"
1313

1414
bash ../step.sh
1515
if [ $? -eq 0 ] ; then

bitrise.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
format_version: 0.9.10
2+
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
3+
4+
app:
5+
envs:
6+
# define these in your .bitrise.secrets.yml
7+
- TEST_SSH_RSA_PRIVATE_KEY:
8+
9+
workflows:
10+
test:
11+
steps:
12+
- path::./:
13+
run_if: true
14+
inputs:
15+
- ssh_rsa_private_key: $TEST_SSH_RSA_PRIVATE_KEY
16+
- ssh_key_save_path: "$HOME/.ssh/bitrise_step_activate_ssh_key"
17+
- is_remove_other_identities: "true"

step.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ function CLEANUP_ON_ERROR_FN {
1515
CONFIG_ssh_key_file_path="$HOME/.ssh/steplib_ssh_step_id_rsa"
1616
CONFIG_is_remove_other_identities="true"
1717

18-
if [ -z "${SSH_RSA_PRIVATE_KEY}" ] ; then
18+
if [ -z "${ssh_rsa_private_key}" ] ; then
1919
write_section_to_formatted_output "# Error"
20-
write_section_start_to_formatted_output '* Required input `$SSH_RSA_PRIVATE_KEY` not provided!'
20+
write_section_start_to_formatted_output '* Required input `$ssh_rsa_private_key` not provided!'
2121
exit 1
2222
fi
2323

24-
if [ ! -z "${SSH_KEY_SAVE_PATH}" ] ; then
25-
CONFIG_ssh_key_file_path="${SSH_KEY_SAVE_PATH}"
24+
if [ ! -z "${ssh_key_save_path}" ] ; then
25+
CONFIG_ssh_key_file_path="${ssh_key_save_path}"
2626
fi
2727

28-
if [ ! -z "${IS_REMOVE_OTHER_IDENTITIES}" ] ; then
29-
if [[ "${IS_REMOVE_OTHER_IDENTITIES}" == "false" ]] ; then
28+
if [ ! -z "${is_remove_other_identities}" ] ; then
29+
if [[ "${is_remove_other_identities}" == "false" ]] ; then
3030
CONFIG_is_remove_other_identities="false"
3131
fi
3232
fi
@@ -37,7 +37,7 @@ echo_string_to_formatted_output "* Should remove other identities from the ssh-a
3737

3838
dir_path_of_key_file=$(dirname "${CONFIG_ssh_key_file_path}")
3939
print_and_do_command_exit_on_error mkdir -p "${dir_path_of_key_file}"
40-
echo "${SSH_RSA_PRIVATE_KEY}" > "${CONFIG_ssh_key_file_path}"
40+
echo "${ssh_rsa_private_key}" > "${CONFIG_ssh_key_file_path}"
4141
if [ $? -ne 0 ] ; then
4242
write_section_to_formatted_output "# Error"
4343
echo_string_to_formatted_output "* Failed to write the SSH key to the provided path"

step.yml

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
---
2-
name: |
3-
Activate SSH key (RSA private key)
4-
description: |
1+
title: Activate SSH key (RSA private key)
2+
summary: Activate SSH key (RSA private key)
3+
description: |-
54
Saves the provided **RSA private SSH key** to file
65
and then loads it into the user's ssh-agent with `ssh-add`.
76
@@ -12,25 +11,39 @@ description: |
1211
1312
It will start the ssh-agent if it can't connect to the agent.
1413
website: https://github.com/bitrise-io/steps-activate-ssh-key
15-
source:
16-
git: https://github.com/bitrise-io/steps-activate-ssh-key.git
14+
source_code_url: https://github.com/bitrise-io/steps-activate-ssh-key
15+
support_url: https://github.com/bitrise-io/steps-activate-ssh-key/issues
1716
host_os_tags:
1817
- osx-10.9
18+
project_type_tags:
19+
- ios
1920
type_tags:
2021
- ssh
2122
requires_admin_user: false
22-
23+
is_always_run: false
24+
is_skippable: false
25+
run_if: ".IsCI"
2326
inputs:
24-
- title: |
25-
SSH private key in RSA format
26-
mapped_to: SSH_RSA_PRIVATE_KEY
27-
is_expand: false
28-
- title: |
29-
(Optional) path to save the private key. Default is: $HOME/.ssh/steplib_ssh_step_id_rsa
30-
mapped_to: SSH_KEY_SAVE_PATH
31-
is_expand: true
32-
- title: |
33-
(Optional) Remove other, previously loaded keys and restart ssh-agent?
34-
Options: true and false. Default: true.
35-
mapped_to: IS_REMOVE_OTHER_IDENTITIES
36-
is_expand: false
27+
- ssh_rsa_private_key: "$SSH_RSA_PRIVATE_KEY"
28+
opts:
29+
title: SSH private key in RSA format
30+
is_expand: true
31+
is_dont_change_value: true
32+
- ssh_key_save_path: "$HOME/.ssh/bitrise_step_activate_ssh_key"
33+
opts:
34+
title: |-
35+
(Optional) path to save the private key. Default is: $HOME/.ssh/steplib_ssh_step_id_rsa
36+
is_expand: true
37+
is_dont_change_value: true
38+
- is_remove_other_identities: "true"
39+
opts:
40+
description: |-
41+
(Optional) Remove other, previously loaded keys and restart ssh-agent?
42+
43+
Options:
44+
45+
* "true"
46+
* "false"
47+
is_expand: false
48+
value_options: ["true", "false"]
49+
is_dont_change_value: true

0 commit comments

Comments
 (0)