DemocracyClub / UK-Polling-Stations

:earth_africa: A website to help people find their UK polling station
https://wheredoivote.co.uk/
BSD 3-Clause "New" or "Revised" License
33 stars 30 forks source link

Keep LAST_IMPORT_SHA on master for development env #8169

Closed GeoWill closed 9 hours ago

GeoWill commented 6 days ago

This should fix and issue we were having where dev deploys would 'fail' CI because the 'LAST_IMPORT_SHA' in parameter store had been updated to a value which wasn't in the tree anymore, meaning we couldn't git diff against it.

symroe commented 6 days ago

Two quick thoughts on this, I've not thought either through fully:

  1. Can we set the DC_ENVIRONMENT in settings rather than passing it through the application like you're doing? e.g we look for it here, so we could just set it there as well, and then see if settings.DC_ENVIRONMENT is set elsewhere?
  2. What you've done here is basically disable the feature in dev. Is that right? It means we'll never be able to test that it's working in that environment. Would it be better to catch a missing Git SHA and revert to master when on dev? I don't think I fully understand the situation, so please ignore this if that's not a good idea
GeoWill commented 5 days ago

Good points. This does what you suggest, which is also easier to test! I changed the region we use in tests to eu-west-2 which meant touching the wdiv-s3-trigger tests too.

coveralls commented 5 days ago

Coverage Status

coverage: 71.571% (+0.1%) from 71.444% when pulling a72b2139e5c99ea82363568b3e5ac16e1f2dac11 on hotfix/keep-dev-import-sha-as-master into b94d4d29697c590d25df15dbd1075ec3bf2d79ec on master.

GeoWill commented 15 hours ago

Few more tidy ups. Now when the command tries to get the LAST_IMPORT_SHA from parameter store it checks if the sha exists in the tree. If it doesn't and the environment is development it just returns the sha for the HEAD of master branch. If the sha doesn't exist in the tree and the environment is something else, it throws an error.