Skip to content

Commit

Permalink
Merge pull request #4215 from freedomofpress/upgrade-boxes-for-0.12.0…
Browse files Browse the repository at this point in the history
…-trusty

Adds Upgrade scenario boxes for 0.12.0 (Trusty)
  • Loading branch information
emkll authored Mar 6, 2019
2 parents e144529 + cd0b172 commit 89836b7
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 7 deletions.
4 changes: 4 additions & 0 deletions devops/scripts/vagrant_package.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#!/bin/bash
# Wrapper script to create Vagrant boxes for use with the "upgrade"
# scenario.

molecule test -s vagrant_packager && \
# Unfortunately since we need to prompt the user for sudo creds..
# I had to break the actual vagrant package logic outside of molecule
molecule/vagrant_packager/package.py && \
molecule destroy -s vagrant_packager


8 changes: 4 additions & 4 deletions molecule/upgrade/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ lint:

platforms:
- name: app-staging
box: fpf/securedrop-app
box_url: "../vagrant_packager/box_files/app_metadata.json"
box: fpf/securedrop-app-trusty
box_url: "../vagrant_packager/box_files/app_trusty_metadata.json"
instance_raw_config_args:
- "ssh.insert_key = false"
provider_override_args:
Expand All @@ -24,8 +24,8 @@ platforms:
- staging

- name: mon-staging
box: fpf/securedrop-mon
box_url: "../vagrant_packager/box_files/mon_metadata.json"
box: fpf/securedrop-mon-trusty
box_url: "../vagrant_packager/box_files/mon_trusty_metadata.json"
instance_raw_config_args:
- "ssh.insert_key = false"
provider_override_args:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "fpf/securedrop-app",
"name": "fpf/securedrop-app-trusty",
"description": "This box contains securedrop app server.",
"versions": [
{
Expand Down Expand Up @@ -56,6 +56,17 @@
"checksum": "e832c4940ef10e8d999033271454f7220c85f4b0a89f378906895d4a82478eee"
}
]
},
{
"version": "0.12.0",
"providers": [
{
"name": "libvirt",
"url": "https://s3.amazonaws.com/securedrop-vagrant/app-staging-trusty_0.12.0.box",
"checksum_type": "sha256",
"checksum": "db9f077d0b9f960c5d36a8a804a791151271009c7490fe3a4c715b71998afcd8"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "fpf/securedrop-mon",
"name": "fpf/securedrop-mon-trusty",
"description": "This box contains securedrop monitor server.",
"versions": [
{
Expand Down Expand Up @@ -56,6 +56,17 @@
"checksum": "bbc8ed55fab20ed96c3b090126b69baabbd41e95faa60676dff72bc69af67376"
}
]
},
{
"version": "0.12.0",
"providers": [
{
"name": "libvirt",
"url": "https://s3.amazonaws.com/securedrop-vagrant/mon-staging-trusty_0.12.0.box",
"checksum_type": "sha256",
"checksum": "0ac7538f52b3450a1791a06b8a02fe81b65637da92bb00a61b669beccef87f8d"
}
]
}
]
}
10 changes: 9 additions & 1 deletion molecule/vagrant_packager/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@ def main():
SCENARIO_PATH = os.path.dirname(os.path.realpath(__file__))
BOX_PATH = join(SCENARIO_PATH, "build")
EPHEMERAL_DIRS = {}
TARGET_VERSION_FILE = os.path.join(SCENARIO_PATH, os.path.pardir, "shared", "stable.ver")
with open(TARGET_VERSION_FILE, 'r') as f:
TARGET_VERSION = f.read().strip()
try:
TARGET_PLATFORM = os.environ['SECUREDROP_TARGET_PLATFORM']
except KeyError:
msg = "Set SECUREDROP_TARGET_PLATFORM env var to 'trusty' or 'xenial'"
raise Exception(msg)

for srv in ["app-staging", "mon-staging"]:

Expand Down Expand Up @@ -174,7 +182,7 @@ def main():
join(EPHEMERAL_DIRS['build'], 'Vagrantfile'))

print("Creating tar file")
box_file = join(BOX_PATH, srv+".box")
box_file = join(BOX_PATH, "{}-{}_{}.box".format(srv, TARGET_PLATFORM, TARGET_VERSION))
with tarfile.open(box_file, "w|gz") as tar:
for boxfile in ["box.img", "Vagrantfile", "metadata.json"]:
tar.add(join(EPHEMERAL_DIRS["build"], boxfile),
Expand Down
9 changes: 9 additions & 0 deletions molecule/vagrant_packager/playbook.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
---
- name: Prepare servers for installation
hosts: securedrop
gather_facts: no
max_fail_percentage: 0
any_errors_fatal: yes
become: yes
roles:
- { role: prepare-servers }

- name: Add FPF apt repository and install base packages.
hosts: securedrop
max_fail_percentage: 0
Expand Down

0 comments on commit 89836b7

Please sign in to comment.