【问题标题】:Using helm commands inside the rpmspec file在 rpmspec 文件中使用 helm 命令
【发布时间】:2022-01-18 08:38:09
【问题描述】:

我正在尝试在安装 rpm 文件时在其中运行 helm 脚本。 helm 安装在该机器中。同样的命令在 shell 中运行时也能正常工作。但是在rpm安装期间 我收到“helm: command not found”错误。

这些是帖子部分中的命令。

helm init
helm list 
helm install app_name helm_folder_location
helm uninstall app_name

这是 rpmspec 文件中 %post 部分的格式。

%post
#some pre-functions like image loading
is_kube_installed=$(helm list|grep app_name)
if[ ! -z "is_kube_installed" ];then 
    helm uninstall app_name
fi

helm install app_name helm_folder_location

这是错误

> /var/tmp/rpm-tmp.jzqB04: line 4: helm: command not found
> /var/tmp/rpm-tmp.jzqB04: line 4: helm: command not found
> /var/tmp/rpm-tmp.jzqB04: line 4: helm: command not found

会有什么问题?如何解决?

【问题讨论】:

    标签: kubernetes-helm rpm rpmbuild rpm-spec


    【解决方案1】:

    使用 helm location 的完整路径解决了这个问题。

    %post
    #some pre-functions like image loading
    is_kube_installed=$(/usr/local/bin/helm list|grep app_name)
    if[ ! -z "is_kube_installed" ];then 
        /usr/local/bin/helm uninstall app_name
    fi
    
    /usr/local/bin/helm install app_name helm_folder_location
    

    【讨论】:

    • 您还需要添加 Requires(post): /usr/local/bin/helm 。除非helm 由RPM 安装,否则这将不起作用;因为它在/usr/local,所以可能不是。
    猜你喜欢
    • 2021-07-13
    • 1970-01-01
    • 2020-11-14
    • 2020-10-16
    • 2023-02-13
    • 2022-01-12
    • 2020-12-21
    • 2021-09-14
    • 2020-06-11
    相关资源
    最近更新 更多