Skip to content

Commit b40b0da

Browse files
authored
Merge pull request #7334 from freedomofpress/stg-upgrade-check
Add a basic noble migration check script
2 parents cc9bea3 + 7f8479a commit b40b0da

File tree

15 files changed

+1838
-181
lines changed

15 files changed

+1838
-181
lines changed

Cargo.lock

+428-77
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[workspace]
22

33
members = [
4+
"noble-migration",
45
"redwood",
56
]
67

builder/build-debs-securedrop.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ set -euxo pipefail
1111

1212
# Make a copy of the source tree since we do destructive operations on it
1313
cp -R /src/securedrop /srv/securedrop
14-
cp -R /src/redwood /srv/redwood
15-
cp /src/Cargo.lock /srv/redwood/
14+
mkdir /srv/rust
15+
cp -R /src/noble-migration /srv/rust/noble-migration
16+
cp -R /src/redwood /srv/rust/redwood
17+
cp /src/Cargo.{toml,lock} /srv/rust/
1618
cd /srv/securedrop/
1719

1820
# Control the version of setuptools used in the default construction of virtual environments

install_files/ansible-base/group_vars/securedrop_application_server.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ip_info:
77
### Used by the install_local_deb_pkgs role ###
88
local_deb_packages:
99
- "securedrop-keyring_0.2.2+{{ securedrop_version }}+{{ securedrop_target_distribution }}_all.deb"
10-
- "securedrop-config_{{ securedrop_version }}+{{ securedrop_target_distribution }}_all.deb"
10+
- "securedrop-config_{{ securedrop_version }}+{{ securedrop_target_distribution }}_amd64.deb"
1111
- "securedrop-ossec-agent_3.6.0+{{ securedrop_version }}+{{ securedrop_target_distribution }}_all.deb"
1212
- "{{ securedrop_app_code_deb }}.deb"
1313
- "ossec-agent_3.6.0+{{ securedrop_target_distribution }}_amd64.deb"

install_files/ansible-base/group_vars/securedrop_monitor_server.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ip_info:
77
### Used by the install_local_deb_pkgs role ###
88
local_deb_packages:
99
- "securedrop-keyring_0.2.2+{{ securedrop_version }}+{{ securedrop_target_distribution }}_all.deb"
10-
- "securedrop-config_{{ securedrop_version }}+{{ securedrop_target_distribution }}_all.deb"
10+
- "securedrop-config_{{ securedrop_version }}+{{ securedrop_target_distribution }}_amd64.deb"
1111
- "securedrop-ossec-server_3.6.0+{{ securedrop_version }}+{{ securedrop_target_distribution }}_all.deb"
1212
- ossec-server_3.6.0+{{ securedrop_target_distribution }}_amd64.deb
1313

molecule/testinfra/common/test_release_upgrades.py

+41
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import json
2+
import time
3+
4+
import pytest
15
import testutils
26

37
test_vars = testutils.securedrop_test_vars
@@ -27,3 +31,40 @@ def test_release_manager_upgrade_channel(host):
2731
_, channel = raw_output.split("=")
2832

2933
assert channel == "never"
34+
35+
36+
def test_migration_check(host):
37+
"""Verify our migration check script works"""
38+
if host.system_info.codename != "focal":
39+
pytest.skip("only applicable/testable on focal")
40+
41+
with host.sudo():
42+
# remove state file so we can see if it works
43+
if host.file("/etc/securedrop-noble-migration.json").exists:
44+
host.run("rm /etc/securedrop-noble-migration.json")
45+
cmd = host.run("systemctl start securedrop-noble-migration-check")
46+
assert cmd.rc == 0
47+
while host.service("securedrop-noble-migration-check").is_running:
48+
time.sleep(1)
49+
50+
# JSON state file was created
51+
assert host.file("/etc/securedrop-noble-migration.json").exists
52+
53+
cmd = host.run("cat /etc/securedrop-noble-migration.json")
54+
assert cmd.rc == 0
55+
56+
contents = json.loads(cmd.stdout)
57+
print(contents)
58+
# The script did not error out
59+
if "error" in contents:
60+
# Run the script manually to get the error message
61+
cmd = host.run("securedrop-noble-migration-check")
62+
print(cmd.stdout)
63+
# We'll fail in the next line after this
64+
assert "error" not in contents
65+
# staging CI jobs don't have enough free space, so just check
66+
# that it returned a value for it
67+
assert "free_space" in contents
68+
del contents["free_space"]
69+
# All the values should be True
70+
assert all(contents.values())

noble-migration/Cargo.toml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
name = "noble-migration"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[dependencies]
7+
anyhow = "1.0.93"
8+
rustix = { version = "0.38.40", features = ["process"] }
9+
serde = { version = "1.0.215", features = ["derive"] }
10+
serde_json = "1.0.132"
11+
url = "2.5.3"
12+
walkdir = "2.5.0"

0 commit comments

Comments
 (0)