mirror of
https://github.com/hashicorp/packer.git
synced 2026-06-08 16:22:15 -04:00
fix: ensure {{timestamp}} returns consistent value across build lifecycle
Fixes #13506. The timestamp is now computed once at build start and reused in post-processors. Made-with: Cursor
This commit is contained in:
parent
e29c0afb8d
commit
0d0df12b46
1 changed files with 2 additions and 1 deletions
|
|
@ -22,12 +22,13 @@ func init() {
|
|||
}
|
||||
|
||||
// TimestampFunc constructs a function that returns a string representation of the current date and time.
|
||||
// It uses initTime so the value remains constant across the entire build, including post-processors.
|
||||
var TimestampFunc = function.New(&function.Spec{
|
||||
Params: []function.Parameter{},
|
||||
Type: function.StaticReturnType(cty.String),
|
||||
RefineResult: refineNotNull,
|
||||
Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) {
|
||||
return cty.StringVal(time.Now().UTC().Format(time.RFC3339)), nil
|
||||
return cty.StringVal(initTime.Format(time.RFC3339)), nil
|
||||
},
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue