Files
zeekayandHanzo Dev 446e343a3d cd: annotations are cd.hanzo.ai, API group is apps.hanzo.ai
Two corrections on top of the naming pass, both found by checking the live
cluster rather than the source.

The rename had silently changed the user-facing annotation key from
argocd.argoproj.io/sync-wave to cd.argoproj.io/sync-wave — 63 live
Applications carry the old key, so deploying that would have ignored every
sync-wave and broken fleet deploy ordering. The key is now cd.hanzo.ai/*,
and universe 575650286 moves the ApplicationSet template that stamps it, so
the controller regenerates all 63 consistently.

The API group in code said argoproj.io/v1alpha1 in 157 places while the
cluster has served apps.hanzo.ai/v1alpha1 since 2026-07-23 (the CRDs are
applications.apps.hanzo.ai). Code now matches what is actually served.

The legacy applications.argoproj.io/app-name label had ZERO live users, so it
went with the rest. foo.argoproj.io test fixtures became foo.example.com —
arbitrary test domains should not carry a vendor name.

go build ./... exit 0.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-28 16:32:14 -07:00

4.6 KiB

time

Time related functions.

Configuring the local timezone

The time functions can be used in both notification templates and triggers.

When converting a time value to local time using .Local(), Hanzo CD Notifications uses the local timezone configured for the cd-notifications-controller container.

You can configure this timezone by setting the TZ environment variable on the cd-notifications-controller container:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: cd-notifications-controller
spec:
  template:
    spec:
      containers:
      - name: cd-notifications-controller
        env:
        - name: TZ
          value: Asia/Tokyo

For example, a notification template can format an application timestamp in the configured local timezone:

{{ (call .time.Parse .app.status.operationState.startedAt).Local.Format "2006-01-02T15:04:05Z07:00" }}

**`time.Now() Time`**

Executes function built-in Golang time.Now function. Returns an instance of Golang Time.


**`time.Parse(val string) Time`**

Parses specified string using RFC3339 layout. Returns an instance of Golang Time.


Time related constants.

Durations

	time.Nanosecond   = 1
	time.Microsecond  = 1000 * Nanosecond
	time.Millisecond  = 1000 * Microsecond
	time.Second       = 1000 * Millisecond
	time.Minute       = 60 * Second
	time.Hour         = 60 * Minute

Timestamps

Used when formatting time instances as strings (e.g. time.Now().Format(time.RFC3339)).

	time.Layout      = "01/02 03:04:05PM '06 -0700" // The reference time, in numerical order.
	time.ANSIC       = "Mon Jan _2 15:04:05 2006"
	time.UnixDate    = "Mon Jan _2 15:04:05 MST 2006"
	time.RubyDate    = "Mon Jan 02 15:04:05 -0700 2006"
	time.RFC822      = "02 Jan 06 15:04 MST"
	time.RFC822Z     = "02 Jan 06 15:04 -0700" // RFC822 with numeric zone
	time.RFC850      = "Monday, 02-Jan-06 15:04:05 MST"
	time.RFC1123     = "Mon, 02 Jan 2006 15:04:05 MST"
	time.RFC1123Z    = "Mon, 02 Jan 2006 15:04:05 -0700" // RFC1123 with numeric zone
	time.RFC3339     = "2006-01-02T15:04:05Z07:00"
	time.RFC3339Nano = "2006-01-02T15:04:05.999999999Z07:00"
	time.Kitchen     = "3:04PM"
	// Handy time stamps.
	time.Stamp      = "Jan _2 15:04:05"
	time.StampMilli = "Jan _2 15:04:05.000"
	time.StampMicro = "Jan _2 15:04:05.000000"
	time.StampNano  = "Jan _2 15:04:05.000000000"

strings

String related functions.


**`strings.ReplaceAll() string`**

Executes function built-in Golang strings.ReplaceAll function.


**`strings.ToUpper() string`**

Executes function built-in Golang strings.ToUpper function.


**`strings.ToLower() string`**

Executes function built-in Golang strings.ToLower function.

sync


**`sync.GetInfoItem(app map, name string) string`** Returns the `info` item value by given name stored in the Hanzo CD App sync operation.

repo

Functions that provide additional information about Application source repository.


**`repo.RepoURLToHTTPS(url string) string`**

Transforms given GIT URL into HTTPs format.


**`repo.FullNameByRepoURL(url string) string`**

Returns repository URL full name (<owner>/<repoName>). Currently supports only Github, GitLab and Bitbucket.


**`repo.QueryEscape(s string) string`**

QueryEscape escapes the string, so it can be safely placed inside a URL

Example:

/projects/{{ call .repo.QueryEscape (call .repo.FullNameByRepoURL .app.status.RepoURL) }}/merge_requests

**`repo.GetCommitMetadata(sha string) CommitMetadata`**

Returns commit metadata. The commit must belong to the application source repository. CommitMetadata fields:

  • Message string commit message
  • Author string - commit author
  • Date time.Time - commit creation date
  • Tags []string - Associated tags

**`repo.GetAppDetails() AppDetail`**

Returns application details. AppDetail fields:

  • Type string - AppDetail type
  • Helm HelmAppSpec - Helm details
    • Fields :
      • Name string
      • ValueFiles []string
      • Parameters []*v1alpha1.HelmParameter
      • Values string
      • FileParameters []*v1alpha1.HelmFileParameter
    • Methods :
      • GetParameterValueByName(Name string) Retrieve value by name in Parameters field
      • GetFileParameterPathByName(Name string) Retrieve path by name in FileParameters field
  • Kustomize *apiclient.KustomizeAppSpec - Kustomize details
  • Directory *apiclient.DirectoryAppSpec - Directory details