From f3b767cf60d58be979ba6bb61112907032912fb5 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Mon, 7 Feb 2022 17:04:33 -0800 Subject: [PATCH] Test pushes into gitea over ssh Gerrit replicates to gitea via ssh, but our current testing only checks that we can push over https. Test that pushing over ssh works properly as this is what we actually need to work in production. Change-Id: I0f7764a6d07e7d413a5b07a7f3ba8a9be7b4f0e3 --- playbooks/test-gitea.yaml | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/playbooks/test-gitea.yaml b/playbooks/test-gitea.yaml index 990794d16d..323594a89f 100644 --- a/playbooks/test-gitea.yaml +++ b/playbooks/test-gitea.yaml @@ -20,11 +20,34 @@ fail: msg: Zuul description was not updated when: '"Zuuls new description" not in zuul_content.content' + - name: Configure ssh for pushing into test gitea + shell: | + ssh-keyscan -t rsa -p 222 localhost >> .ssh/known_hosts + ssh-keygen -t ed25519 -f /home/zuul/.ssh/id_ed25519 -C giteagerrittest -P '' + - name: Register new gitea gerrit pubkey value + slurp: + src: /home/zuul/.ssh/id_ed25519.pub + register: slurped_gitea_gerrit_pubkey + - name: Set testing key on gerrit account in gitea + no_log: true + uri: + user: root + password: "{{ gitea_root_password }}" + force_basic_auth: true + url: "https://localhost:3000/api/v1/admin/users/gerrit/keys" + validate_certs: false + method: POST + status_code: 201 + body_format: json + body: + key: "{{ slurped_gitea_gerrit_pubkey['content'] | b64decode }}" + read_only: false + title: "Gerrit testing key" - name: Push system-config into our test gitea for testing shell: | cd /home/zuul/src/opendev.org/opendev/system-config - git remote add test-gitea https://gerrit:{{ gitea_gerrit_password }}@localhost:3000/opendev/system-config - GIT_SSL_NO_VERIFY=1 git push -f test-gitea master + git remote add test-gitea ssh://git@localhost:222/opendev/system-config + GIT_SSH_COMMAND='ssh -i /home/zuul/.ssh/id_ed25519' git push -f test-gitea master - name: Run rename playbook import_playbook: rename_repos.yaml