diff --git a/cmd/check/main.go b/cmd/check/main.go index 508fc6b..5141d38 100644 --- a/cmd/check/main.go +++ b/cmd/check/main.go @@ -35,7 +35,7 @@ func main() { response = append(response, *req.Version) } else if !req.Source.NoInitialVersion { response = append(response, resource.Version{ - Version: "mirror", + Version: req.Source.InitialVersion(), }) } diff --git a/types.go b/types.go index f15aaae..eed8c62 100644 --- a/types.go +++ b/types.go @@ -1,13 +1,27 @@ package resource +const DefaultInitialVersion = "mirror" + type Source struct { // fetch the resource itself as an image MirrorSelf bool `json:"mirror_self"` + // initial version that the mirrored resource image should emit from /check + // (default: 'mirror') + RawInitialVersion string `json:"mirrored_version"` + // don't emit an initial version; useful for testing pipeline triggering NoInitialVersion bool `json:"no_initial_version"` } +func (s Source) InitialVersion() string { + if s.RawInitialVersion == "" { + return DefaultInitialVersion + } + + return s.RawInitialVersion +} + type Version struct { Version string `json:"version"` }