Skip to content

Commit d1c6f96

Browse files
authored
Fix a few recent regressions to Autodeploy (#605)
## Overview ## Changes - README: remind the user to source control `env.local` securely as it may contains passwords. ## Fixes - Autodeploy broken due to new config variable precedence order. Broken since `2.18.8` (#600). Example breakage scenario: Autodeploy starts and calls `read_configs`, then git pull a newer version of `env.local` (which might modify `EXTRA_CONF_DIRS` to enable new components for example). But since the new var precedence locked all the values to the first call of `read_configs`, the new change to `EXTRA_CONF_DIRS` (or any vars in `env.local`) never went into effect at the end of the autodeploy process when we start the full stack. This is because `read_configs` returns all variables as environment variables and the new variable precedence order gives environment variables precedence higher than the values in `env.local`. So after the first call to `read_configs` (or `read_basic_configs_only`), all the values are "locked" for all child processes even if they try to call `read_configs` again to get the newest values from `env.local`. The fix is to avoid getting these config variables as environment variables which will avoid "locking" their values for child processes. - Autodeploy broken due to attempt to be compat with changing the location of `env.local` via `BIRDHOUSE_LOCAL_ENV`. Broken since `2.18.9` (#601). It was working for the first run of autodeploy but on the next run, the value of `BIRDHOUSE_LOCAL_ENV` in `optional-components/scheduler-job-autodeploy/config.yml` is wrong ! Good value in first run: `--volume /real/path/to/env.local:/tmp/birdhouse-local-env` Bad value in subsequent run: `--volume /tmp/birdhouse-local-env:/tmp/birdhouse-local-env` This is because we override `--env BIRDHOUSE_LOCAL_ENV=/tmp/birdhouse-local-env` in `optional-components/scheduler-job-autodeploy/config.yml.template` as env var so on the subsequent runs the bad value persists because it is an env var. This `BIRDHOUSE_LOCAL_ENV` is meant to be set "outside" the stack as env var so there is nothing in the stack that will fix this value if it is bad. The fix is to revert that attempt. So autodeploy only supports changing the location of `env.local` via symlink, or by manually adding the folder containing the file `env.local` to `BIRDHOUSE_AUTODEPLOY_EXTRA_REPOS` if `env.local` is set by `BIRDHOUSE_LOCAL_ENV` environment variable and not via symlink. - One feature of autodeploy is broken due to a missing mapping in back-compat config var name change. Broken since `2.4.0` but only if back-compat var name mode is required. The `AUTODEPLOY_CODE_OWNERSHIP` old name mapping is missing in `BIRDHOUSE_BACKWARDS_COMPATIBLE_VARIABLES`. Autodeploy is missing the `chown` step to the good code owner because it does not "see" the value of the old variable name since the mapping to the new variable name is missing. - Missing default value for `BIRDHOUSE_HTTP_ONLY` causing inconsistent behavior when the var is used in `env.local` then removed from `env.local`. The behavior never revert back as if it has never been initially used in `env.local`. See [discussion](#600 (comment)). ## CI Operations <!-- The test suite can be run using a different DACCS config with ``birdhouse_daccs_configs_branch: branch_name`` in the PR description. To globally skip the test suite regardless of the commit message use ``birdhouse_skip_ci`` set to ``true`` in the PR description. Using ``[<cmd>]`` (with the brackets) where ``<cmd> = skip ci`` in the commit message will override ``birdhouse_skip_ci`` from the PR description. Such commit command can be used to override the PR description behavior for a specific commit update. However, a commit message cannot 'force run' a PR which the description turns off the CI. To run the CI, the PR should instead be updated with a ``true`` value, and a running message can be posted in following PR comments to trigger tests once again. --> birdhouse_daccs_configs_branch: master birdhouse_skip_ci: false
2 parents ada56b4 + b7bd42c commit d1c6f96

File tree

13 files changed

+135
-37
lines changed

13 files changed

+135
-37
lines changed

.bumpversion.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tool.bumpversion]
2-
current_version = "2.18.14"
2+
current_version = "2.18.15"
33
commit = true
44
tag = false
55
tag_name = "{new_version}"

CHANGES.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,84 @@
1717

1818
[//]: # (list changes here, using '-' for each new entry, remove this when items are added)
1919

20+
[2.18.15](https://github.com/bird-house/birdhouse-deploy/tree/2.18.15) (2025-12-01)
21+
------------------------------------------------------------------------------------------------------------------
22+
23+
## Changes
24+
25+
- README: remind the user to source control `env.local` securely as it may contains passwords.
26+
27+
## Fixes
28+
29+
- Autodeploy broken due to new config variable precedence order.
30+
31+
Broken since `2.18.8` (https://github.com/bird-house/birdhouse-deploy/pull/600).
32+
33+
Example breakage scenario:
34+
35+
Autodeploy starts and calls `read_configs`, then git pull a newer
36+
version of `env.local` (which might modify `EXTRA_CONF_DIRS` to enable
37+
new components for example). But since the new var precedence locked
38+
all the values to the first call of `read_configs`, the new change to
39+
`EXTRA_CONF_DIRS` (or any vars in `env.local`) never went into
40+
effect at the end of the autodeploy process when we start the full
41+
stack.
42+
43+
This is because `read_configs` returns all variables as environment
44+
variables and the new variable precedence order gives environment
45+
variables precedence higher than the values in `env.local`. So after
46+
the first call to `read_configs` (or `read_basic_configs_only`), all the
47+
values are "locked" for all child processes even if they try to call
48+
`read_configs` again to get the newest values from `env.local`.
49+
50+
The fix is to avoid getting these config variables as environment
51+
variables which will avoid "locking" their values for child processes.
52+
53+
- Autodeploy broken due to attempt to be compat with changing the location of `env.local` via `BIRDHOUSE_LOCAL_ENV`.
54+
55+
Broken since `2.18.9` (https://github.com/bird-house/birdhouse-deploy/pull/601).
56+
57+
It was working for the first run of autodeploy but on the next run, the value of
58+
`BIRDHOUSE_LOCAL_ENV` in `optional-components/scheduler-job-autodeploy/config.yml`
59+
is wrong !
60+
61+
Good value in first run:
62+
63+
`--volume /real/path/to/env.local:/tmp/birdhouse-local-env`
64+
65+
Bad value in subsequent run:
66+
67+
`--volume /tmp/birdhouse-local-env:/tmp/birdhouse-local-env`
68+
69+
This is because we override `--env BIRDHOUSE_LOCAL_ENV=/tmp/birdhouse-local-env` in
70+
`optional-components/scheduler-job-autodeploy/config.yml.template` as env var so on
71+
the subsequent runs the bad value persists because it is an env var.
72+
73+
This `BIRDHOUSE_LOCAL_ENV` is meant to be set "outside" the stack as env var
74+
so there is nothing in the stack that will fix this value if it is bad.
75+
76+
The fix is to revert that attempt. So autodeploy only supports changing the
77+
location of `env.local` via symlink, or by manually adding the folder
78+
containing the file `env.local` to `BIRDHOUSE_AUTODEPLOY_EXTRA_REPOS` if
79+
`env.local` is set by `BIRDHOUSE_LOCAL_ENV` environment variable and not via
80+
symlink.
81+
82+
- One feature of autodeploy is broken due to a missing mapping in back-compat config var name change.
83+
84+
Broken since `2.4.0` but only if back-compat var name mode is required.
85+
86+
The `AUTODEPLOY_CODE_OWNERSHIP` old name mapping is missing in `BIRDHOUSE_BACKWARDS_COMPATIBLE_VARIABLES`.
87+
88+
Autodeploy is missing the `chown` step to the good code owner because it does
89+
not "see" the value of the old variable name since the mapping to the new
90+
variable name is missing.
91+
92+
- Missing default value for `BIRDHOUSE_HTTP_ONLY` causing inconsistent behavior
93+
when the var is used in `env.local` then removed from `env.local`. The
94+
behavior never revert back as if it has never been initially used in
95+
`env.local`. See [discussion](https://github.com/bird-house/birdhouse-deploy/pull/600#issuecomment-3528058708).
96+
97+
2098
[2.18.14](https://github.com/bird-house/birdhouse-deploy/tree/2.18.14) (2025-12-01)
2199
------------------------------------------------------------------------------------------------------------------
22100

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ override BIRDHOUSE_MAKE_DIR := $(shell realpath -P $$(dirname $(BIRDHOUSE_MAKE_C
88
# Generic variables
99
override SHELL := bash
1010
override APP_NAME := birdhouse-deploy
11-
override APP_VERSION := 2.18.14
11+
override APP_VERSION := 2.18.15
1212

1313
# utility to remove comments after value of an option variable
1414
override clean_opt = $(shell echo "$(1)" | $(_SED) -r -e "s/[ '$'\t'']+$$//g")

README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ for a full-fledged production platform.
1818
* - citation
1919
- | |citation|
2020

21-
.. |commits-since| image:: https://img.shields.io/github/commits-since/bird-house/birdhouse-deploy/2.18.14.svg
21+
.. |commits-since| image:: https://img.shields.io/github/commits-since/bird-house/birdhouse-deploy/2.18.15.svg
2222
:alt: Commits since latest release
23-
:target: https://github.com/bird-house/birdhouse-deploy/compare/2.18.14...master
23+
:target: https://github.com/bird-house/birdhouse-deploy/compare/2.18.15...master
2424

25-
.. |latest-version| image:: https://img.shields.io/badge/tag-2.18.14-blue.svg?style=flat
25+
.. |latest-version| image:: https://img.shields.io/badge/tag-2.18.15-blue.svg?style=flat
2626
:alt: Latest Tag
27-
:target: https://github.com/bird-house/birdhouse-deploy/tree/2.18.14
27+
:target: https://github.com/bird-house/birdhouse-deploy/tree/2.18.15
2828

2929
.. |readthedocs| image:: https://readthedocs.org/projects/birdhouse-deploy/badge/?version=latest
3030
:alt: ReadTheDocs Build Status (latest version)

RELEASE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.18.14 2025-12-01T15:42:49Z
1+
2.18.15 2025-12-01T18:03:36Z

birdhouse/README.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,11 @@ If autodeploy scheduler job is enabled, the folder containing the `env.local` fi
114114

115115
To follow infrastructure-as-code, it is encouraged to source control the above
116116
`env.local` file and any override needed to customized this Birdhouse deployment
117-
for your organization. For an example of possible override, see how the `emu service <optional-components/emu/docker-compose-extra.yml>`_ (:download:`download </birdhouse/optional-components/emu/docker-compose-extra.yml>`)
117+
for your organization. Note this `env.local` file might contains **sensitive**
118+
infos like passwords so it should be in a limitted access private source control
119+
repo, idealy not on the internet.
120+
121+
For an example of possible override, see how the `emu service <optional-components/emu/docker-compose-extra.yml>`_ (:download:`download </birdhouse/optional-components/emu/docker-compose-extra.yml>`)
118122
(`README <optional-components/README.rst#emu-wps-service-for-testing>`_) can be optionally added to the deployment via the `override mechanism <https://docs.docker.com/compose/extends/>`_.
119123
Ouranos specific override can be found in this `birdhouse-deploy-ouranos <https://github.com/bird-house/birdhouse-deploy-ouranos>`_ repo.
120124

birdhouse/components/canarie-api/docker_configuration.py.template

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ SERVICES = {
108108
# NOTE:
109109
# Below version and release time auto-managed by 'make VERSION=x.y.z bump'.
110110
# Do NOT modify it manually. See 'Tagging policy' in 'birdhouse/README.rst'.
111-
'version': '2.18.14',
112-
'releaseTime': '2025-12-01T15:42:49Z',
111+
'version': '2.18.15',
112+
'releaseTime': '2025-12-01T18:03:36Z',
113113
'institution': '${BIRDHOUSE_INSTITUTION}',
114114
'researchSubject': '${BIRDHOUSE_SUBJECT}',
115115
'supportEmail': '${BIRDHOUSE_SUPPORT_EMAIL}',
@@ -141,8 +141,8 @@ PLATFORMS = {
141141
# NOTE:
142142
# Below version and release time auto-managed by 'make VERSION=x.y.z bump'.
143143
# Do NOT modify it manually. See 'Tagging policy' in 'birdhouse/README.rst'.
144-
'version': '2.18.14',
145-
'releaseTime': '2025-12-01T15:42:49Z',
144+
'version': '2.18.15',
145+
'releaseTime': '2025-12-01T18:03:36Z',
146146
'institution': '${BIRDHOUSE_INSTITUTION}',
147147
'researchSubject': '${BIRDHOUSE_SUBJECT}',
148148
'supportEmail': '${BIRDHOUSE_SUPPORT_EMAIL}',

birdhouse/components/proxy/default.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export PROXY_IMAGE="nginx:1.23.4"
66
# Any WPS processes taking longer than this should use async mode.
77
export PROXY_READ_TIMEOUT_VALUE="240s"
88

9+
export BIRDHOUSE_HTTP_ONLY="False"
910
export BIRDHOUSE_PROXY_SCHEME='$([ x"$BIRDHOUSE_HTTP_ONLY" = x"True" ] && echo http || echo https )'
1011
export BIRDHOUSE_ALLOW_UNSECURE_HTTP='$([ x"$BIRDHOUSE_HTTP_ONLY" = x"True" ] && echo True || echo )'
1112
export PROXY_INCLUDE_HTTPS='$([ x"$BIRDHOUSE_HTTP_ONLY" = x"True" ] || echo "include /etc/nginx/conf.d/https.include;" )'

birdhouse/default.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ BIRDHOUSE_BACKWARDS_COMPATIBLE_VARIABLES="
215215
AUTODEPLOY_PLATFORM_FREQUENCY=BIRDHOUSE_AUTODEPLOY_PLATFORM_FREQUENCY
216216
AUTODEPLOY_NOTEBOOK_FREQUENCY=BIRDHOUSE_AUTODEPLOY_NOTEBOOK_FREQUENCY
217217
AUTODEPLOY_EXTRA_SCHEDULER_JOBS=BIRDHOUSE_AUTODEPLOY_EXTRA_SCHEDULER_JOBS
218+
AUTODEPLOY_CODE_OWNERSHIP=BIRDHOUSE_AUTODEPLOY_CODE_OWNERSHIP
218219
LOGROTATE_DATA_DIR=BIRDHOUSE_LOGROTATE_DATA_DIR
219220
ALLOW_UNSECURE_HTTP=BIRDHOUSE_ALLOW_UNSECURE_HTTP
220221
DOCKER_NOTEBOOK_IMAGES=JUPYTERHUB_DOCKER_NOTEBOOK_IMAGES

birdhouse/deployment/deploy.sh

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,24 @@ BIRDHOUSE_LOCAL_ENV="${1:-${BIRDHOUSE_LOCAL_ENV:-"${COMPOSE_DIR}/env.local"}}"
7474
# container and manually from the host.
7575
cd "${COMPOSE_DIR}" || exit
7676

77-
. "${COMPOSE_DIR}/read-configs.include.sh"
78-
79-
# Read BIRDHOUSE_AUTODEPLOY_EXTRA_REPOS
80-
read_basic_configs_only
77+
set -x
78+
BIRDHOUSE_EXE="${COMPOSE_DIR}/../bin/birdhouse"
79+
BIRDHOUSE_EXE_CONFIGS_OPTS="--backwards-compatible --quiet configs --basic --command"
80+
81+
# Similar to "read_basic_configs_only" but only get the vars we will need, not
82+
# everything like the full "read_basic_configs_only".
83+
# Note: NEVER turn these vars into env var because this will "lock" these
84+
# vars for all subsequent "read_configs" even if the env.local changes. This
85+
# is because of the new variable precedence that gives higher precedence to env
86+
# var than env.local. This will break the last step when we bring up the stack
87+
# that will have to read and use all the latest values of any changed vars.
88+
CONFIG_VARS_TO_EVAL="$("${BIRDHOUSE_EXE}" ${BIRDHOUSE_EXE_CONFIGS_OPTS} '
89+
echo "BIRDHOUSE_LOG_DIR=\"${BIRDHOUSE_LOG_DIR}\"";
90+
echo "BIRDHOUSE_AUTODEPLOY_EXTRA_REPOS=\"${BIRDHOUSE_AUTODEPLOY_EXTRA_REPOS}\"";
91+
echo "BIRDHOUSE_AUTODEPLOY_DEPLOY_KEY_ROOT_DIR=\"${BIRDHOUSE_AUTODEPLOY_DEPLOY_KEY_ROOT_DIR}\"";
92+
')"
93+
eval "${CONFIG_VARS_TO_EVAL}"
94+
set +x
8195

8296
if [ ! -z "${AUTODEPLOY_SILENT}" ]; then
8397
LOG_FILE="${BIRDHOUSE_LOG_DIR}/autodeploy.log"
@@ -132,10 +146,6 @@ done
132146

133147
cd "${COMPOSE_DIR}" || exit
134148

135-
set +x # avoid excessive forced logging
136-
read_basic_configs_only
137-
set -x
138-
139149
# stop all to force reload any changed config that are volume-mount into the containers
140150
"${BIRDHOUSE_COMPOSE}" stop
141151

@@ -176,14 +186,10 @@ done
176186

177187
cd "${COMPOSE_DIR}" || exit
178188

179-
# reload again after git pull because this file could be changed by the pull
180-
. "${COMPOSE_DIR}/read-configs.include.sh"
181-
182-
set +x # avoid excessive forced logging
183-
# reload again after default.env since env.local can override default.env
184-
# (ex: JUPYTERHUB_USER_DATA_DIR)
185-
read_basic_configs_only
186-
set -x
189+
# NOTE: if other operations are needed at this point, re-read again the config
190+
# vars because both the code and the env.local could have changed after git pull.
191+
# And NEVER turn these vars into env var, see explanation at the first config
192+
# var read earlier in this file.
187193

188194
# restart everything, only changed containers will be destroyed and recreated
189195
"${BIRDHOUSE_COMPOSE}" up -d

0 commit comments

Comments
 (0)