Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test tor packages from tor-apt-test in release branches #2941

Merged
merged 5 commits into from
Jan 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ jobs:
- store_artifacts:
path: /root/sd/raw-test-output

- store_artifacts:
path: /root/sd/.tor_version

workflows:
version: 2
securedrop_ci:
Expand Down
30 changes: 30 additions & 0 deletions molecule/aws/securedrop_test.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----

mQENBFhPGZsBCACzn00s3+i5HdGIldDGYXxY2HKL9Qhk0DhiRrNPaQemhNijuFlC
geCeKN/smDAUyM5mfEoxmWy3V7n8SEQUpqI4dIS2AohReLkyKEKiIpTuXW7F9kO3
vcXHgrTka+8B4ZQxDuTHNFJLmBwJnP24LrL6BzkDIUNeQFwM0EFTDOJlW1QV6qkm
9WGizo2sR0VBJJabfRWrTWd8llYOVcc+LptErVNADPaX6iqb+QnZVJ/nYmCTgABj
lD3aZ4EPZ+ioVOcOxbgBkAX76COObUUw/XahBGwj4fJ5kyzvDSBCHHlRzN39LKpM
Y+HfSc1scAOWN+Dd0N/joIa0j0U4SGHo1NdzABEBAAG0MVNlY3VyZURyb3AgVEVT
VElORyBrZXkgPHNlY3VyZWRyb3BAZnJlZWRvbS5wcmVzcz6JAU4EEwEIADgWIQRO
15zDNi19EoNwRgJKO+SpIhGwPAUCWE8ZmwIbAwULCQgHAgYVCAkKCwIEFgIDAQIe
AQIXgAAKCRBKO+SpIhGwPCb9B/9SuVoxbe3nLlU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GHSz7ws+5M6Zbk6oNJEwQZ4cR+81qCfXE5X5LW1KlAL8wDl7dfS
=fYUi
-----END PGP PUBLIC KEY BLOCK-----
8 changes: 8 additions & 0 deletions molecule/aws/side_effect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
# WHEN REINSTATING REBOOT
- include: reboot_and_wait.yml
when: "false"
- include: tor_apt_test.yml
when: (lookup('env','CIRCLE_BRANCH')|default('na')).startswith('release')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@msheiny Assigning defaults to env lookups often leads to surprises. I believe it's currently not possible to override an undefined env var with |default, but the lookup will return an empty string, which will satisfies the conditional logic here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohhh shit you are totally right @conorsch - thanks for pointing that out

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Older versions of Ansible threw an uncatchable exception in the event of an undefined env var lookup, so the behavior has improved somewhat, but the silent ignore of |default warrants careful attention. Still, good to go here. 👌

handlers:
- name: update tor
apt:
name: tor
state: latest
update_cache: yes

- name: Setup junit env first
hosts: localhost
Expand Down
39 changes: 39 additions & 0 deletions molecule/aws/tor_apt_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
- name: Add apt SD test public key
apt_key:
data: "{{ lookup('file','securedrop_test.pub') }}"
state: present

- name: Temporary fix for GH issue 2938
file:
state: absent
path: "/etc/apt/sources.list.d/tor_apt_freedom_press.list"

- name: Switch apt repo URLs to staging.
replace:
dest: "/etc/apt/sources.list.d/tor.apt.freedom.press.list"
replace: "tor-apt-test.freedom.press"
regexp: '//tor-apt\.freedom\.press'
ignore_errors: "yes"
notify: update tor

- name: Force possible tor update
meta: flush_handlers

- name: Squash testinfra failure for packages needing update
apt:
upgrade: safe

- name: Extract latest tor version
shell: |
apt-cache policy tor | sed -e 's/^\s*Installed:\ \(\S*\)/\1/g;tx;d;:x'
changed_when: false
register: extract_tor_version

- name: Dump Tor version to file (for reporting)
copy:
dest: "{{ playbook_dir }}/../../.tor_version"
content: "{{ extract_tor_version.stdout }}"
delegate_to: localhost
run_once: true
become: "no"
4 changes: 4 additions & 0 deletions testinfra/common/test_tor_mirror.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import os
import pytest


@pytest.mark.skipif(
os.environ.get('CIRCLE_BRANCH', 'na').startswith('release'),
reason="Release branches will use tor-apt-test repo")
def test_tor_mirror_present(host):
"""
Ensure the FPF mirror of the Tor apt repo, tor-apt.freedom.press,
Expand Down