summaryrefslogtreecommitdiff
path: root/checkReady.go
blob: 11c1fca653345b7b226e50abaa16c768ab74cff7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// This is a simple example
package main

import (
	"go.wit.com/log"
)

func CheckReady() bool {
	if release.current == nil {
		log.Info("find the next repo first")
		return false
	}
	goSumS := release.current.getGoSumStatus()
	dirtyS := release.current.dirtyLabel.String()
	lastS := release.current.status.GetLastTagVersion()
	log.Info("repo:", release.current.String(), goSumS, dirtyS, lastS)

	if dirtyS == "ready to tag version" {
		log.Info("\trepo is ready", release.current.String(), goSumS, dirtyS, lastS)
	} else {
		return false
	}

	if release.current.status.ReadOnly() {
		log.Info("\trepo is read only")
		return false
	}

	if release.versionS == lastS {
		log.Info("\trepo is already done")
		return false
	}

	if goSumS == "BAD" {
		log.Info("\trepo is ready", release.current.String(), goSumS, dirtyS, lastS)
	} else {
		log.Info("\trepo is ready maybe", release.current.String(), goSumS, dirtyS, lastS)
	}

	if release.current.status.CheckDirty() {
		log.Info("\trepo is dirty")
		return false
	} else {
		log.Info("\trepo is ready", release.current.String(), goSumS, dirtyS, lastS)
	}

	return true
}