Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Commit

Permalink
fix auto generation of version
Browse files Browse the repository at this point in the history
  • Loading branch information
n0rad committed Jul 30, 2015
1 parent 051082f commit ef7c28c
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions builder/cnt.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,19 @@ func (cnt *Cnt) readManifest(manifestPath string) {
}

cnt.manifest.Aci.Name.Set(string(cnt.manifest.Name))
changeVersion(&cnt.manifest.Aci.Labels, cnt.manifest.Version)

labels := cnt.manifest.Aci.Labels.ToMap()
labels["version"] = cnt.manifest.Version
if newLabels, err := types.LabelsFromMap(labels); err != nil {
log.Get().Trace("Cnt manifest : ", cnt.manifest.Aci.Name, cnt.manifest, cnt.manifest.Aci.App)
}

func changeVersion(labels *types.Labels, version string) {
labelMap := labels.ToMap()
labelMap["version"] = version
if newLabels, err := types.LabelsFromMap(labelMap); err != nil {
log.Get().Panic(err)
} else {
cnt.manifest.Aci.Labels = newLabels
*labels = newLabels
}

log.Get().Trace("Cnt manifest : ", cnt.manifest.Aci.Name, cnt.manifest, cnt.manifest.Aci.App)
}

func (cnt *Cnt) Install() {
Expand Down Expand Up @@ -330,8 +333,8 @@ func (cnt *Cnt) writeBuildScript() {

func (cnt *Cnt) writeRktManifest() {
log.Get().Debug("Writing aci manifest")
if val, _ := cnt.manifest.Aci.Labels.Get("version"); val == "0.0.0" {
cnt.manifest.Aci.Labels.UnmarshalJSON([]byte("{\"version\":\"" + utils.GenerateVersion() + "\"}"))
if val, _ := cnt.manifest.Aci.Labels.Get("version"); val == "" {
changeVersion(&cnt.manifest.Aci.Labels, utils.GenerateVersion())
}
version, _ := cnt.manifest.Aci.Labels.Get("version")
utils.WriteImageManifest(&cnt.manifest.Aci, cnt.target + "/manifest", cnt.manifest.Aci.Name, version)
Expand Down

0 comments on commit ef7c28c

Please sign in to comment.