* [PATCH 1/1] kas-container: propagate timezone information into container
@ 2025-06-06 11:42 'Felix Moessbauer' via isar-users
2025-06-06 11:55 ` 'MOESSBAUER, Felix' via isar-users
0 siblings, 1 reply; 2+ messages in thread
From: 'Felix Moessbauer' via isar-users @ 2025-06-06 11:42 UTC (permalink / raw)
To: isar-users; +Cc: jan.kiszka, Felix Moessbauer
Currently the timezone inside the container is UTC. By that, the logs
have timestamps in UTC but not in the local time of the caller.
We fix this by forwarding the timezone information into the container.
Closes: #157
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
Changes since RFC:
- remove trailing spaces (we really need a check for that...)
- document forwarding of TZ variable
- remove erronous comment about not expanding the TZ variable
Best regards,
Felix
docs/command-line/environment-variables.inc | 2 ++
kas-container | 11 ++++++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/docs/command-line/environment-variables.inc b/docs/command-line/environment-variables.inc
index aa22894b0..10c720435 100644
--- a/docs/command-line/environment-variables.inc
+++ b/docs/command-line/environment-variables.inc
@@ -137,6 +137,8 @@ overwritten using the ``env`` section of the config file.
| ``TERM`` | The terminal options used in the `shell` plugin. |
| (C,K,E) | |
+--------------------------+--------------------------------------------------+
+| ``TZ`` (C) | Timezone settings. |
++--------------------------+--------------------------------------------------+
| ``AWS_CONFIG_FILE`` | Path to the awscli configuration and credentials |
| |aws_cred| | files that are copied to the kas home dir. |
| (K,C) | |
diff --git a/kas-container b/kas-container
index 8a044c0e8..48bbfa11e 100755
--- a/kas-container
+++ b/kas-container
@@ -686,9 +686,18 @@ if [ -n "${SSTATE_MIRRORS}" ]; then
set -- "$@" -e "SSTATE_MIRRORS=${SSTATE_MIRRORS}"
fi
+# propagate timezone information
+if [ -f "/etc/localtime" ]; then
+ set -- "$@" -v "$(realpath -e "/etc/localtime")":/etc/localtime:ro
+fi
+if [ -f "/etc/timezone" ]; then
+ set -- "$@" -v "$(realpath -e "/etc/timezone")":/etc/timezone:ro
+fi
+
for var in TERM KAS_DISTRO KAS_MACHINE KAS_TARGET KAS_TASK KAS_CLONE_DEPTH \
KAS_PREMIRRORS DISTRO_APT_PREMIRRORS BB_NUMBER_THREADS PARALLEL_MAKE \
- GIT_CREDENTIAL_USEHTTPPATH; do
+ GIT_CREDENTIAL_USEHTTPPATH \
+ TZ; do
if [ -n "$(eval echo \$${var})" ]; then
set -- "$@" -e "${var}=$(eval echo \"\$${var}\")"
fi
--
2.49.0
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20250606114241.1450107-1-felix.moessbauer%40siemens.com.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] kas-container: propagate timezone information into container
2025-06-06 11:42 [PATCH 1/1] kas-container: propagate timezone information into container 'Felix Moessbauer' via isar-users
@ 2025-06-06 11:55 ` 'MOESSBAUER, Felix' via isar-users
0 siblings, 0 replies; 2+ messages in thread
From: 'MOESSBAUER, Felix' via isar-users @ 2025-06-06 11:55 UTC (permalink / raw)
To: isar-users; +Cc: Kiszka, Jan
Wrong ML! Sorry.
On Fri, 2025-06-06 at 13:42 +0200, Felix Moessbauer wrote:
> Currently the timezone inside the container is UTC. By that, the logs
> have timestamps in UTC but not in the local time of the caller.
>
> We fix this by forwarding the timezone information into the
> container.
>
> Closes: #157
> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> ---
> Changes since RFC:
>
> - remove trailing spaces (we really need a check for that...)
> - document forwarding of TZ variable
> - remove erronous comment about not expanding the TZ variable
>
> Best regards,
> Felix
>
> docs/command-line/environment-variables.inc | 2 ++
> kas-container | 11 ++++++++++-
> 2 files changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/docs/command-line/environment-variables.inc
> b/docs/command-line/environment-variables.inc
> index aa22894b0..10c720435 100644
> --- a/docs/command-line/environment-variables.inc
> +++ b/docs/command-line/environment-variables.inc
> @@ -137,6 +137,8 @@ overwritten using the ``env`` section of the
> config file.
> | ``TERM`` | The terminal options used in the
> `shell` plugin. |
> | (C,K,E)
> | |
> +--------------------------+----------------------------------------
> ----------+
> +| ``TZ`` (C) | Timezone
> settings. |
> ++--------------------------+----------------------------------------
> ----------+
> | ``AWS_CONFIG_FILE`` | Path to the awscli configuration and
> credentials |
> | |aws_cred| | files that are copied to the kas home
> dir. |
> | (K,C)
> | |
> diff --git a/kas-container b/kas-container
> index 8a044c0e8..48bbfa11e 100755
> --- a/kas-container
> +++ b/kas-container
> @@ -686,9 +686,18 @@ if [ -n "${SSTATE_MIRRORS}" ]; then
> set -- "$@" -e "SSTATE_MIRRORS=${SSTATE_MIRRORS}"
> fi
>
> +# propagate timezone information
> +if [ -f "/etc/localtime" ]; then
> + set -- "$@" -v "$(realpath -e
> "/etc/localtime")":/etc/localtime:ro
> +fi
> +if [ -f "/etc/timezone" ]; then
> + set -- "$@" -v "$(realpath -e
> "/etc/timezone")":/etc/timezone:ro
> +fi
> +
> for var in TERM KAS_DISTRO KAS_MACHINE KAS_TARGET KAS_TASK
> KAS_CLONE_DEPTH \
> KAS_PREMIRRORS DISTRO_APT_PREMIRRORS BB_NUMBER_THREADS
> PARALLEL_MAKE \
> - GIT_CREDENTIAL_USEHTTPPATH; do
> + GIT_CREDENTIAL_USEHTTPPATH \
> + TZ; do
> if [ -n "$(eval echo \$${var})" ]; then
> set -- "$@" -e "${var}=$(eval echo \"\$${var}\")"
> fi
--
Siemens AG
Linux Expert Center
Friedrich-Ludwig-Bauer-Str. 3
85748 Garching, Germany
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/f24a06d3c28ee9e8c48d9c0972271272a9b79aa8.camel%40siemens.com.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-06-06 11:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-06 11:42 [PATCH 1/1] kas-container: propagate timezone information into container 'Felix Moessbauer' via isar-users
2025-06-06 11:55 ` 'MOESSBAUER, Felix' via isar-users
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox