diff --git a/test/integration/credentials.template b/test/integration/credentials.template index 61d5d6e38fc..b183e469381 100644 --- a/test/integration/credentials.template +++ b/test/integration/credentials.template @@ -18,9 +18,6 @@ gce_project_id: azure_subscription_id: "{{ lookup('env', 'AZURE_SUBSCRIPTION_ID') }}" azure_cert_path: "{{ lookup('env', 'AZURE_CERT_PATH') }}" -# GITHUB SSH private key - a path to a SSH private key for use with github.com -github_ssh_private_key: "{{ lookup('env','HOME') }}/.ssh/id_rsa" - # Cloudflare Credentials cloudflare_api_token: cloudflare_email: diff --git a/test/integration/targets/git/tasks/missing_hostkey.yml b/test/integration/targets/git/tasks/missing_hostkey.yml index c58b5834f08..1de79a6a185 100644 --- a/test/integration/targets/git/tasks/missing_hostkey.yml +++ b/test/integration/targets/git/tasks/missing_hostkey.yml @@ -1,15 +1,10 @@ --- -- name: remove known_host files - file: - state: absent - path: '{{ item }}' - with_items: "{{known_host_files}}" - - name: checkout ssh://git@github.com repo without accept_hostkey (expected fail) git: repo: '{{ repo_format2 }}' dest: '{{ checkout_dir }}' + ssh_opts: '-o UserKnownHostsFile={{ output_dir }}/known_hosts' register: git_result ignore_errors: true @@ -23,19 +18,20 @@ dest: '{{ checkout_dir }}' accept_hostkey: true key_file: '{{ github_ssh_private_key }}' + ssh_opts: '-o UserKnownHostsFile={{ output_dir }}/known_hosts' register: git_result when: github_ssh_private_key is defined - assert: that: - 'git_result.changed' - when: not git_result|skipped - + when: github_ssh_private_key is defined - name: clear checkout_dir file: state: absent path: '{{ checkout_dir }}' + when: github_ssh_private_key is defined - name: checkout ssh://git@github.com repo with accept_hostkey (expected pass) git: @@ -44,10 +40,11 @@ version: 'master' accept_hostkey: false # should already have been accepted key_file: '{{ github_ssh_private_key }}' + ssh_opts: '-o UserKnownHostsFile={{ output_dir }}/known_hosts' register: git_result when: github_ssh_private_key is defined - assert: that: - 'git_result.changed' - when: not git_result|skipped + when: github_ssh_private_key is defined diff --git a/test/integration/targets/git/vars/main.yml b/test/integration/targets/git/vars/main.yml index 1a3b6dbe04b..f4364bc4814 100644 --- a/test/integration/targets/git/vars/main.yml +++ b/test/integration/targets/git/vars/main.yml @@ -18,3 +18,5 @@ known_host_files: - '/etc/ssh/ssh_known_hosts' git_version_supporting_depth: 1.9.1 git_version_supporting_ls_remote: 1.7.5 +# path to a SSH private key for use with github.com (tests skipped if undefined) +# github_ssh_private_key: "{{ lookup('env', 'HOME') }}/.ssh/id_rsa"