Skip to content

Commit e13299e

Browse files
committed
CI: remove passphrase key requirements
The github way to leverage an ssh-agent is through webfactory and they insist that since the key is uploaded to github that suffices. The passphrase is not supported so remove it. [0] https://github.com/webfactory/ssh-agent Signed-off-by: Luis Chamberlain <[email protected]>
1 parent 9e581a6 commit e13299e

File tree

3 files changed

+0
-142
lines changed

3 files changed

+0
-142
lines changed

.github/workflows/fstests.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ jobs:
3737
uses: webfactory/[email protected]
3838
with:
3939
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
40-
ssh-passphrase: ${{ secrets.SSH_PASSPHRASE }}
4140

4241
- name: Build our kdevops archive results
4342
if: always() # This ensures the step runs even if previous steps failed

playbooks/roles/kdevops_archive/defaults/main.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@ kdevops_results_archive_dir: "{{ topdir_path }}/../{{ kdevops_results_name }}"
1111
kdevops_archive_mirror_present: false
1212
kdevops_archive_host: "{{ kdevops_results_repo_path.split(':')[0] }}"
1313
kdevops_archive: "/mirror/{{ kdevops_results_name }}.git"
14-
kdevops_archive_key_loaded: False
15-
kdevops_archive_key_name: "kdevops_archive"
16-
kdevops_archive_identity_file: "/home/gh/.ssh/{{ kdevops_archive }}"
17-
kdevops_archive_key_detected: False
18-
kdevops_archive_key_fingerprint: ""
19-
kdevops_archive_key_has_passphrase: False
2014
kdevops_archive_demo: False
2115
bootlinux_tree_set_by_cli: False
2216
kdevops_archive_base: "selftests/gh/linux-modules-kpd/20241021"

playbooks/roles/kdevops_archive/tasks/main.yml

Lines changed: 0 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -126,141 +126,6 @@
126126
format: zip
127127
remove: no
128128

129-
- name: Get SSH configuration for the kdevops archive repo
130-
ansible.builtin.command: ssh -G {{ kdevops_results_repo_url_user }}@{{ kdevops_results_repo_path }}
131-
register: ssh_archive_config_repo
132-
changed_when: false
133-
134-
- name: Extract kdevops archive repo IdentityFile
135-
vars:
136-
identity_file_lines: "{{ ssh_archive_config_repo.stdout_lines | select('match', '^identityfile ') }}"
137-
identity_file_raw: "{{ identity_file_lines | first | regex_replace('^identityfile (.*)$', '\\1') }}"
138-
ansible.builtin.set_fact:
139-
kdevops_archive_identity_file: "{{ identity_file_raw | regex_replace('^~', lookup('env', 'HOME')) }}"
140-
141-
- name: Check if the key used for the kdevops archive repo is installed
142-
ansible.builtin.set_fact:
143-
kdevops_archive_key_detected: "{{ kdevops_archive_key_name in (kdevops_archive_identity_file | basename) }}"
144-
145-
- name: Inform user of how to set up the kdevops archive repo key
146-
ansible.builtin.debug:
147-
msg: |
148-
ssh key archive test for {{ kdevops_results_repo_url }}:
149-
We ran:
150-
151-
ssh -G {{ kdevops_results_repo_url_user }}@{{ kdevops_results_repo_path }} | grep identityfile
152-
153-
Missing key name: '{{ kdevops_archive_key_name }}'
154-
Current IdentityFile:
155-
{{ kdevops_archive_identity_file }}
156-
157-
To set up automatic kdevops repo archiving install something like
158-
the following key for host {{ kdevops_archive_host }}:
159-
160-
Host {{ kdevops_results_repo_path }}
161-
User {{ kdevops_results_repo_url_user }}
162-
Hostname {{ kdevops_archive_host }}
163-
IdentityFile {{ lookup('env', 'HOME') }}/.ssh/{{ kdevops_archive_key_name }}
164-
165-
166-
Create the key first with something like:
167-
168-
ssh-keygen -t ed25519 -C "{{ kdevops_results_repo_url_user}}@{{ kdevops_results_repo_path }}" -f {{ lookup('env', 'HOME') }}/.ssh/{{ kdevops_archive_key_name }}
169-
170-
Then install it as deploy key for {{ kdevops_results_repo_path}}:
171-
172-
https://docs.github.com/en/authentication/connecting-to-github-with-ssh/managing-deploy-keys#deploy-keys
173-
174-
And then add the above to your {{ lookup('env', 'HOME') }}/.ssh/config
175-
176-
when:
177-
- 'not kdevops_archive_key_detected|bool'
178-
- 'bootlinux_tree_set_by_cli|bool'
179-
180-
- name: Gracefully end if key is not found for automatic kdevops archiving
181-
meta: end_play
182-
when:
183-
- not kdevops_archive_key_detected
184-
185-
- name: Check if the detected kdevops archive repo key exists
186-
ansible.builtin.stat:
187-
path: "{{ kdevops_archive_identity_file }}"
188-
register: ssh_key_file_lookup
189-
190-
- name: Inform user of configured but not created key
191-
ansible.builtin.debug:
192-
msg: |
193-
Key to be used missing: {{ kdevops_archive_identity_file }}
194-
Create the key with something like:
195-
ssh-keygen -t ed25519 -C "{{ kdevops_results_repo_url_user}}@{{ kdevops_results_repo_path }}" -f {{ lookup('env', 'HOME') }}/.ssh/{{ kdevops_archive_key_name }}
196-
when:
197-
- not ssh_key_file_lookup.stat.exists
198-
199-
- name: Gracefully end if key does not exist
200-
meta: end_play
201-
when:
202-
- not ssh_key_file_lookup.stat.exists
203-
204-
- name: Check if kdevops results archive ssh key has a passphrase
205-
ansible.builtin.command:
206-
cmd: "ssh-keygen -y -f {{ kdevops_archive_identity_file }}"
207-
register: ssh_key_check
208-
ignore_errors: yes
209-
changed_when: false
210-
failed_when: false
211-
no_log: true
212-
213-
- name: Set fact about SSH key passphrase status
214-
ansible.builtin.set_fact:
215-
kdevops_archive_key_has_passphrase: "{{ ssh_key_check.rc != 0 }}"
216-
217-
- name: Inform user if key did not have a passphrase
218-
ansible.builtin.debug:
219-
msg: |
220-
ssh key archive {{ kdevops_archive_identity_file }} for {{ kdevops_results_repo_url }}
221-
does not have a passphrase. This not secure and not allowed. Giving up.
222-
when:
223-
- 'not kdevops_archive_key_has_passphrase|bool'
224-
225-
- name: End if key did not have passphrase set up
226-
meta: end_play
227-
when:
228-
- 'not kdevops_archive_key_has_passphrase|bool'
229-
230-
- name: Gracefully end if the user did not set up a kdevops archive repo key
231-
meta: end_play
232-
when: not kdevops_archive_key_detected
233-
234-
- name: Get fingerprint of the identity file for {{ kdevops_archive_key_name }}
235-
ansible.builtin.command: ssh-keygen -lf "{{ kdevops_archive_identity_file }}"
236-
register: kdevops_archive_fingerprint_output
237-
changed_when: false
238-
when:
239-
- 'kdevops_archive_key_detected|bool'
240-
241-
- name: Extract the {{ kdevops_archive_key_name }} fingerprint
242-
ansible.builtin.set_fact:
243-
kdevops_archive_key_fingerprint: "{{ kdevops_archive_fingerprint_output.stdout.split()[1] }}"
244-
when:
245-
- 'kdevops_archive_key_detected|bool'
246-
247-
- name: List keys in ssh-agent
248-
ansible.builtin.command: ssh-add -l
249-
register: kdevops_archive_ssh_add_list
250-
changed_when: false
251-
when:
252-
- 'kdevops_archive_key_detected|bool'
253-
254-
- name: Check if key is loaded in ssh-agent
255-
ansible.builtin.set_fact:
256-
kdevops_archive_key_loaded: "{{ kdevops_archive_key_fingerprint in kdevops_archive_ssh_add_list.stdout }}"
257-
258-
- name: Inform when we are achiving
259-
ansible.builtin.debug:
260-
msg: "Achievement unlocked: kdevops archive key set up, automatic kdevops archiving enabled."
261-
when:
262-
- 'kdevops_archive_key_loaded|bool'
263-
264129
- name: Check if kdevops-results-archive directory exists
265130
stat:
266131
path: "{{ kdevops_results_archive_dir }}"

0 commit comments

Comments
 (0)