Skip to content

Commit 364ddd1

Browse files
committed
Re-do repo fetching logic to be closer to dev docs
The previous set up diverged a bit from the docs at dev.securedrop.org: - it downloaded a repo via github's zip instead of 'make clone' - it installed the bootstrap RPM which may no longer be necessary (at least on the OpenQA side of things) This PR addresses this limitations by using 'make clone' in 'dev' environment, but while still downloading the repo for the makefile to still be available in other environments.
1 parent 27bf324 commit 364ddd1

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

tests/securedrop/install_workstation.pm

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ sub download_repo {
2020
# Assumes terminal window is open
2121
# Assumes "curl_via_netvm"
2222

23-
# Building SecureDrop Workstation RPM and installing it in dom0
23+
# Fetch the repo without the need of "sd-dev" and "make clone"
2424
assert_script_run('sudo qubes-dom0-update -y make unzip');
2525

2626
# Download source from git commit reference
@@ -50,15 +50,18 @@ sub qubes_contrib_keyring_bootstrap {
5050
sub install {
5151
my ($environment) = @_;
5252

53-
download_repo();
54-
55-
# Install prod keyring package through Qubes-contrib to simulate end-user
56-
# path, regardless of environment. This should be OK because staging / dev
57-
# packages will override any prod packages due to higher version numbers
58-
qubes_contrib_keyring_bootstrap($environment);
5953

6054
if ($environment eq "dev") {
61-
build_rpm();
55+
# Create a dev environment and sync to dom0 (allows building local RPMs)
56+
make_clone();
57+
} else {
58+
# Fetch repository to access Makefile, etc. (but no need to build RPMs)
59+
download_repo();
60+
61+
# Install prod keyring package through Qubes-contrib to simulate end-user
62+
# path, regardless of environment. This should be OK because staging
63+
# packages will override any prod packages due to higher version numbers
64+
qubes_contrib_keyring_bootstrap($environment);
6265
}
6366

6467
my $installation_cmd;
@@ -101,9 +104,9 @@ sub copy_config {
101104
};
102105

103106

104-
sub build_rpm {
105-
# Assumes terminal window is open
107+
sub make_clone {
106108

109+
# Assumes terminal window is open
107110

108111
assert_script_run('qvm-check sd-dev || qvm-create --label gray sd-dev --class StandaloneVM --template debian-12-xfce');
109112

@@ -126,13 +129,11 @@ sub build_rpm {
126129
assert_script_run('qvm-run -p sd-dev "sudo usermod -aG docker \$USER"');
127130
assert_script_run('qvm-shutdown --wait sd-dev && qvm-start sd-dev'); # Restart for groupadd to take effect
128131

129-
# Also copy to dom0 to run tests later, but no need to configure env vars for future `make clone`.
132+
# First repo cloning (does not build RPM)
130133
assert_script_run("qvm-run --pass-io sd-dev 'tar -c -C /home/user/ securedrop-workstation' | tar xvf -", timeout=>300);
131-
assert_script_run("ls");
132134

133-
assert_script_run('qvm-run -p sd-dev "cd securedrop-workstation && make build-rpm"', timeout => 1000);
134-
assert_script_run("mkdir -p /home/user/securedrop-workstation/rpm-build/RPMS/noarch/");
135-
assert_script_run("qvm-run --pass-io sd-dev 'cat /home/user/securedrop-workstation/rpm-build/RPMS/noarch/*.rpm' > /home/user/securedrop-workstation/rpm-build/RPMS/noarch/sdw.rpm");
135+
# Re-clone, this time with RPM being built and copied to dom0 in the process
136+
assert_script_run('cd securedrop-workstation && make clone', timeout => 1000);
136137
};
137138

138139

0 commit comments

Comments
 (0)