cloud-builders-community icon indicating copy to clipboard operation
cloud-builders-community copied to clipboard

$HOME env is changed for helmfile builder

Open yashbhutwala opened this issue 3 years ago • 1 comments

Affected builder image

(e.g., gcr.io/cloud-builders-community/helm) gcr.io/cloud-builders-community/helmfile

Expected Behavior

helm diff plugin is installed and works out of the box.

Actual Behavior

err 2: command "/builder/helmfile/helm" exited with non-zero status:

PATH:
  /builder/helmfile/helm

ARGS:
  0: helm (4 bytes)
  1: diff (4 bytes)
  2: upgrade (7 bytes)
  3: --reset-values (14 bytes)
  4: --allow-unreleased (18 bytes)
  5: webapp (6 bytes)
  6: rimusz/gcloud-sqlproxy (22 bytes)
  7: --version (9 bytes)
  8: ~0.20.6 (7 bytes)
  9: --namespace (11 bytes)
  10: default (7 bytes)
  11: --values (8 bytes)
  12: /tmp/helmfile633672291/default-webapp-values-5764c7f8cd (55 bytes)
  13: --set (5 bytes)
  14: cloudsql.instances[0].instance=webapp (37 bytes)

ERROR:
  exit status 1

EXIT STATUS
  1

STDERR:
  Error: unknown command "diff" for "helm"
  Run 'helm --help' for usage.

COMBINED OUTPUT:
  Error: unknown command "diff" for "helm"
  Run 'helm --help' for usage.

Steps to Reproduce the Problem

  1. gcloud builds submit --config cloudbuild.yaml .

  2. yaml

  - name: "gcr.io/$PROJECT_ID/helmfile"
    # entrypoint: "bash"
    # args:
    # - '-eEuox'
    # - 'pipefail'
    # - '-c'
    # - |-
    #   whoami
    #   env
    #   helm plugin list
    #   helm env
    #   # helm plugin install https://github.com/databus23/helm-diff
    #   # helm plugin list
    args:
      [
        "--file",
        "gcloud/development/helmfile.yaml",
        "diff",
        "--context",
        "1",
      ]

Not sure if there is something weird with the image or whether a bug with GCP CloudBuild, since it changes the home from /root to /builders/home and as a result helm cannot see that the plugin is downloaded.

yashbhutwala avatar Aug 17 '21 17:08 yashbhutwala

hmh, the same just happens to me

solved, probably in a bad way but I did not have a lot of time.

added the following to the beginning of the entrypoint helmfile.bash

mkdir -p $HOME/.local/share/helm ln -s /root/.local/share/helm/plugins $HOME/.local/share/helm/plugins

sadoMasupilami avatar Sep 14 '21 21:09 sadoMasupilami