From: "'Felix Moessbauer' via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: jan.kiszka@siemens.com, Felix Moessbauer <felix.moessbauer@siemens.com>
Subject: [PATCH 1/1] kas-container: propagate timezone information into container
Date: Fri, 6 Jun 2025 13:42:41 +0200 [thread overview]
Message-ID: <20250606114241.1450107-1-felix.moessbauer@siemens.com> (raw)
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.
next reply other threads:[~2025-06-06 11:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-06 11:42 'Felix Moessbauer' via isar-users [this message]
2025-06-06 11:55 ` 'MOESSBAUER, Felix' via isar-users
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250606114241.1450107-1-felix.moessbauer@siemens.com \
--to=isar-users@googlegroups.com \
--cc=felix.moessbauer@siemens.com \
--cc=jan.kiszka@siemens.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox