Skip to content

.Event.Error is not populated for cleanup global hooks #1041

Description

@felipecrs

Operating system

Ubuntu 22.04 LTS

Helmfile Version

0.157.0

Helm Version

3.12.3

Bug description

.Event.Error is properly being populated for postsync release hooks when a release fails, but it is not being set for cleanup global hooks. Its value is always <nil> no matter if there was an error or not.

Notice the line hook[cleanup] logs | error is '<nil>' in the logs below.

Example helmfile.yaml

hooks:
  - name: global-level
    events:
      - cleanup
    showlogs: true
    command: echo
    args:
      - "error is '{{`{{.Event.Error}}`}}'"

releases:
  - name: raw
    chart: https://github.com/dysnix/charts/releases/download/raw-v0.3.2/raw-v0.3.2.tgz
    wait: true
    timeout: 10
    values:
      - resources:
          - apiVersion: v1
            kind: Pod
            metadata:
              name: raw
            spec:
              containers:
                - name: raw
                  image: non-existing-image
    hooks:
      - name: release-level
        events:
          - postsync
        showlogs: true
        command: echo
        args:
          - "error is '{{`{{.Event.Error}}`}}'"

Error message you've seen (if any)

helmfile sync
Upgrading release=raw, chart=https://github.com/dysnix/charts/releases/download/raw-v0.3.2/raw-v0.3.2.tgz

hook[postsync] logs | error is 'failed processing release raw: command "/home/linuxbrew/.linuxbrew/bin/helm" exited with non-zero status:
hook[postsync] logs | 
hook[postsync] logs | PATH:
hook[postsync] logs |   /home/linuxbrew/.linuxbrew/bin/helm
hook[postsync] logs | 
hook[postsync] logs | ARGS:
hook[postsync] logs |   0: helm (4 bytes)
hook[postsync] logs |   1: upgrade (7 bytes)
hook[postsync] logs |   2: --install (9 bytes)
hook[postsync] logs |   3: raw (3 bytes)
hook[postsync] logs |   4: https://github.com/dysnix/charts/releases/download/raw-v0.3.2/raw-v0.3.2.tgz (76 bytes)
hook[postsync] logs |   5: --wait (6 bytes)
hook[postsync] logs |   6: --timeout (9 bytes)
hook[postsync] logs |   7: 10s (3 bytes)
hook[postsync] logs |   8: --create-namespace (18 bytes)
hook[postsync] logs |   9: --values (8 bytes)
hook[postsync] logs |   10: /tmp/helmfile3372358405/raw-values-5d4cbff5b7 (45 bytes)
hook[postsync] logs |   11: --reset-values (14 bytes)
hook[postsync] logs |   12: --history-max (13 bytes)
hook[postsync] logs |   13: 10 (2 bytes)
hook[postsync] logs | 
hook[postsync] logs | ERROR:
hook[postsync] logs |   exit status 1
hook[postsync] logs | 
hook[postsync] logs | EXIT STATUS
hook[postsync] logs |   1
hook[postsync] logs | 
hook[postsync] logs | STDERR:
hook[postsync] logs |   Error: UPGRADE FAILED: context deadline exceeded
hook[postsync] logs | 
hook[postsync] logs | COMBINED OUTPUT:
hook[postsync] logs |   Error: UPGRADE FAILED: context deadline exceeded'
hook[postsync] logs | 

FAILED RELEASES:
NAME   CHART                                                                          VERSION
raw    https://github.com/dysnix/charts/releases/download/raw-v0.3.2/raw-v0.3.2.tgz          


hook[cleanup] logs | error is '<nil>'
hook[cleanup] logs | 
in ./helmfile.yaml: failed processing release raw: command "/home/linuxbrew/.linuxbrew/bin/helm" exited with non-zero status:

PATH:
  /home/linuxbrew/.linuxbrew/bin/helm

ARGS:
  0: helm (4 bytes)
  1: upgrade (7 bytes)
  2: --install (9 bytes)
  3: raw (3 bytes)
  4: https://github.com/dysnix/charts/releases/download/raw-v0.3.2/raw-v0.3.2.tgz (76 bytes)
  5: --wait (6 bytes)
  6: --timeout (9 bytes)
  7: 10s (3 bytes)
  8: --create-namespace (18 bytes)
  9: --values (8 bytes)
  10: /tmp/helmfile3372358405/raw-values-5d4cbff5b7 (45 bytes)
  11: --reset-values (14 bytes)
  12: --history-max (13 bytes)
  13: 10 (2 bytes)

ERROR:
  exit status 1

EXIT STATUS
  1

STDERR:
  Error: UPGRADE FAILED: context deadline exceeded

COMBINED OUTPUT:
  Error: UPGRADE FAILED: context deadline exceeded

Steps to reproduce

N/A

Working Helmfile Version

N/A

Relevant discussion

N/A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions