Page MenuHomePhabricator

helm env vars not set when running sudo -u mwpresync scap stage-train
Closed, ResolvedPublicBUG REPORT

Description

Running the command sudo -u mwpresync /usr/bin/scap stage-train -Dfull_image_build:True --yes auto, produced multiple Error: unknown command "diff" for "helm" errors.

The full stack trace is at P45285

We noticed that the helm environment variables haven't been set for the mwpresync user, which looks like the cause of this failure.

Event Timeline

We ran into this issue back in December, the reason of the problem being the K8s env is set for login shells only: https://phabricator.wikimedia.org/T324553

In that ticket ops recommended as a workaround to either source the env explicitly or preserve the env with -E when calling sudo: https://phabricator.wikimedia.org/T324553#8447006

Would be nice if we could source the K8s env for mwpresync as well though.

dancy renamed this task from helm env vars not set when running as mwpresync user to helm env vars not set when running sudo -u mwpresync scap stage-train.Mar 10 2023, 7:57 PM
dancy claimed this task.
dancy triaged this task as Medium priority.

dancy opened https://gitlab.wikimedia.org/repos/releng/scap/-/merge_requests/102

kubernetes.py: Extra HELM_* env vars from /etc/profile.d/kube-env.sh if available

jnuche merged https://gitlab.wikimedia.org/repos/releng/scap/-/merge_requests/102

kubernetes.py: Extract HELM_* env vars from /etc/profile.d/kube-env.sh if available

scap 4.46.0 has been deployed which includes the fix.

Change 900731 had a related patch set uploaded (by Ahmon Dancy; author: Ahmon Dancy):

[operations/puppet@production] profile::mediawiki::deployment::server: Don't pass HELM_* vars to train presync

https://gerrit.wikimedia.org/r/900731

Change 900731 merged by Clément Goubert:

[operations/puppet@production] profile::mediawiki::deployment::server: Don't pass HELM_* vars to train presync

https://gerrit.wikimedia.org/r/900731