Move settings from Bash scripts to YAML config files#305
Open
lfdebrux wants to merge 7 commits into
Open
Conversation
Make it easier to understand what's happening if you run one of the bin scripts that try to load environment variables from AWS parameter store but forget to run with AWS credentials available.
`bin/dockerfile_test.sh` was saving environment variables needed to run the end to end tests in a file to be able to pass them to Docker; this is less than ideal because some of the values of the environment variables should be kept secret. We only need to pass the names of the environment variables to the Docker CLI, it can retrieve the values itself; this commit updates the Dockerfile test script to cut out the values before they are saved.
Add Active Support to our Gemfile so we can use some of the core extensions in our code.
Renames the file for settings for running the tests against a local development server to "local", to distinguish it from the "dev" development environment in AWS. This matches what we call `Settings.forms_env` for local development in forms-admin [[1]]. Note that we also update the default for the environment name so that local development is the still the default environment, so this change shouldn't affect people unless they are explicitly setting the environment to `development` for some reason. [1]: https://github.com/govuk-forms/forms-admin/blob/354f8053d60794a75ddae50941b4b87d738ac25c/config/settings.yml#L110
Add files with configuration for end to end tests for each environment
in AWS.
The files are named `aws_#{environment_name}`, with the environment name
retrieved from `SETTINGS__FORMS_ENV`, which is normally set by
forms-deploy or the scripts in the bin folder.
Now that most of the configuration settings needed to run the end to end tests are in settings files (see previous commit), we can reduce the amount of Bash needed in the bin scripts and focus on loading just secrets from AWS parameter store.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this pull request solve?
Add settings files for each environment in AWS with the configuration settings that are currently stored in the
bin/load_env_vars.shBash script; this should hopefully make it easier to maintain the settings and make the configuration of these tests more like the other GOV.UK Forms repos.The Bash script is still used to load secrets from AWS parameter store, but it is much shorter at least, and in future we could look at getting the parameters from parameter store directly from the Ruby code.
While we're at it we also stop using the legacy configuration environment variables (doing https://trello.com/c/tIYmMZ3e/3457-remove-backwards-compatibility-for-legacy-e2e-test-env-vars), and fix some snags about the bin scripts.
Note that apart from
bin/dockerfile_test.sh, the bin scripts are not used in our deployment pipelines, and all configuration is provided via environment variables, so these changes hopefully shouldn't affect our automated tests.Things to consider when reviewing