Skip to content

Commit

Permalink
fix(executor): Fix kubectl permission error (argoproj#6091)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Collins <[email protected]>
  • Loading branch information
alexec committed Jun 7, 2021
1 parent 7dc6515 commit 00b56e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ RUN if [ $(arch.sh) = ppc64le ] || [ $(arch.sh) = s390x ]; then \
fi && \
tar --extract --file docker.tgz --strip-components 1 --directory /usr/local/bin/ && \
rm docker.tgz
RUN curl -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/$(os.sh)/$(arch.sh)/kubectl
RUN curl -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/$(os.sh)/$(arch.sh)/kubectl && \
chmod +x /usr/local/bin/kubectl
RUN rm /bin/arch.sh /bin/os.sh

COPY hack/ssh_known_hosts /etc/ssh/
Expand Down
9 changes: 6 additions & 3 deletions workflow/executor/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,12 @@ func (we *WorkflowExecutor) ExecResource(action string, manifestPath string, fla

out, err := cmd.Output()
if err != nil {
exErr := err.(*exec.ExitError)
errMsg := strings.TrimSpace(string(exErr.Stderr))
return "", "", "", errors.New(errors.CodeBadRequest, errMsg)
if exErr, ok := err.(*exec.ExitError); ok {
errMsg := strings.TrimSpace(string(exErr.Stderr))
return "", "", "", errors.New(errors.CodeBadRequest, errMsg)
} else {
return "", "", "", errors.New(errors.CodeBadRequest, err.Error())
}
}
if action == "delete" {
return "", "", "", nil
Expand Down

0 comments on commit 00b56e5

Please sign in to comment.