83b2d68a91
-quick-start steps are modified and fit more to what a reader would do -quick-start test code is mainly splitted into 2 files, one which is a setup part as a role, the second one starts with cloning the test repository, just like all followings tutorial will do -some elementary steps when manipulating or checking gerrit are being added as roles tutorial ssh config: test ssh configuration has been modified to allow using a known_hosts file for both someone executing localtest and opendev.org's zuul. A reader executing the tutorial would still have to accept the fingerprint. To do so, commit-msg hook is fetched manually, otherwise it would be downloaded by git-review throught scp. Alas, git-review doesn't allow to pass options to scp to provide a new known_hosts file. User's ssh key is used if ~/.ssh/id_rsa.pub is available, otherwise use a generated one. - "to_json | from_json | json_query" in test is due to an issue between ansible and jmespath [1] [1] https://github.com/ansible-collections/community.general/issues/320 Change-Id: Id5c669537ff5afc7468352139980ebade167d534
35 lines
1.2 KiB
YAML
35 lines
1.2 KiB
YAML
- hosts: localhost
|
|
vars:
|
|
workspace: /tmp/tutorial-zuul
|
|
local: true
|
|
ssh_public_key: "{{ lookup('file', '~/.ssh/id_rsa.pub', errors='ignore') }}"
|
|
ssh_agent:
|
|
stdout: ''
|
|
environment:
|
|
GIT_SSH_COMMAND: "ssh -o UserKnownHostsFile={{ workspace }}/known_hosts"
|
|
tasks:
|
|
- block:
|
|
- name: Run tutorial
|
|
include_tasks: run-tutorial.yaml
|
|
always:
|
|
- name: Stop ssh-agent
|
|
when: stop_ssh_agent is defined
|
|
shell:
|
|
executable: /bin/bash
|
|
cmd: |
|
|
{{ ssh_agent.stdout }}
|
|
ssh-agent -k
|
|
- name: Print SSH command
|
|
debug:
|
|
msg:
|
|
- Use GIT_SSH_COMMAND='ssh -o UserKnownHostsFile={{ workspace }}/known_hosts'
|
|
- to make further test using /tmp/tutorial-zuul/test1
|
|
|
|
when: stop_ssh_agent is not defined
|
|
- name: Print SSH command using temp id_rsa
|
|
debug:
|
|
msg:
|
|
- Use GIT_SSH_COMMAND='ssh -o UserKnownHostsFile={{ workspace }}/known_hosts -i {{ workspace }}/id_rsa'
|
|
- to make further test using /tmp/tutorial-zuul/test1
|
|
when: stop_ssh_agent is defined
|