-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MDBF-876 - Remove BuildBot configuration code needed for systemd setup #674
MDBF-876 - Remove BuildBot configuration code needed for systemd setup #674
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall ok, a few nitpicks. Perhaps the sed command can be removed in validate masters.
@RazvanLiviuVarzaru Please push once you make the agreed upon changes. I'll be building on top of this one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor cleanup items.
--env-file behaves differently between docker-compose and docker run. 1. docker run --env-file cannot handle white-spaces and new-line Reference: moby/moby#12997 Workaround: -> used one-liners for multi-line variable values -> removed unnecessary whitespaces 2. docker run --env-file will preserve single/double quotes Reference: docker/cli#3630 Workaround: -> in validate_master script use --env-file <(sed "s/='\([^']*\)'/=\1/" $ENVFILE) to remove the single quotes -> modified .env files to be quote consistent. Single quotes for variable value. Double quotes for JSON structures inside variable value Test: - ./validate_master_cfg.sh -e PROD - ./validate_master_cfg.sh -e DEV - run docker-compose and check variable values The sample master private file was changed for two reasons: 1. If you want to run buildbot locally, MariaDB Server (docker) will run by default with --skip-name-resolve thus using 127.0.0.1 is mandatory to allow buildbot to connect to the database 2. bb-rhel9-docker entry was added because now the validation scripts load the specific Dev environment variables for which there's a different workername for the docker builder
4e07bd7
to
986076f
Compare
Both BuildBot environments now run in containers so we can get rid of the default="" in << os.getenv >>. To check that the variable is defined and to prevent typos use os.environ which would raise a key error if the variable does not exist. PORT is a special case, because it's defined in docker-compose generation script and is not present in the .env and .env.dev files, hence the hardcoded value in the validation script. Keep os.environ for PORT because the correct value will be passed by docker-compose during initialization (docker-compose --env-file .env up)
This was the "systemd" approach on BuildBot services for getting the PORT number. Now that both environments run in docker containers, the port variable is exposed to the container environment via docker-compose.
986076f
to
cdcf7c8
Compare
@cvicentiu |
Previously when the BuildBot Production environment was running on
systemd services
, we couldn't use the.env
files defined in the project tree because they were specifically designed for usage indocker-compose
.This led to hard coding variable defaults in the buildbot code, in the form of
os.getenv(#env_variable_for_containers#, default=#default_for_systemd#)
In this task:
-> switch to a fail proof approach of loading variables using
os.environ
which will raise akey not found exception
if the environment variable is not defined-> adapt the GitHub CI script
validate_masters
to load the environment variables for each environment << dev , prod >>-> remove "systemd" approach of loading PORTS for masters.
This PR was tested using:
./validate_master_cfg.sh -e {PROD,DEV}
- run docker-compose with .env files
Please see the commit messages for more details.