[release] version 0.5.0-unstable15
This commit is contained in:
parent
4de4f572ea
commit
a1a16f5bc9
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "cosmos-server",
|
"name": "cosmos-server",
|
||||||
"version": "0.5.0-unstable14",
|
"version": "0.5.0-unstable15",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "test-server.js",
|
"main": "test-server.js",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
|
|
|
@ -328,6 +328,12 @@ func CheckUpdatesAvailable() map[string]bool {
|
||||||
for _, container := range containers {
|
for _, container := range containers {
|
||||||
utils.Log("Checking for updates for " + container.Image)
|
utils.Log("Checking for updates for " + container.Image)
|
||||||
|
|
||||||
|
fullContainer, err := DockerClient.ContainerInspect(DockerContext, container.ID)
|
||||||
|
if err != nil {
|
||||||
|
utils.Error("CheckUpdatesAvailable", err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// check container is running
|
// check container is running
|
||||||
if container.State != "running" {
|
if container.State != "running" {
|
||||||
utils.Log("Container " + container.Names[0] + " is not running, skipping")
|
utils.Log("Container " + container.Names[0] + " is not running, skipping")
|
||||||
|
@ -351,27 +357,30 @@ func CheckUpdatesAvailable() map[string]bool {
|
||||||
if strings.Contains(newStr, "\"status\":\"Pulling fs layer\"") {
|
if strings.Contains(newStr, "\"status\":\"Pulling fs layer\"") {
|
||||||
utils.Log("Updates available for " + container.Image)
|
utils.Log("Updates available for " + container.Image)
|
||||||
|
|
||||||
if !IsLabel(container, "cosmos-auto-update") {
|
if !IsLabel(fullContainer, "cosmos-auto-update") {
|
||||||
result[container.Names[0]] = true
|
result[container.Names[0]] = true
|
||||||
rc.Close()
|
rc.Close()
|
||||||
break
|
break
|
||||||
} else {
|
} else {
|
||||||
needsUpdate = true
|
needsUpdate = true
|
||||||
}
|
}
|
||||||
} else if strings.Contains(newStr, "\"status\":\"Status: Image is up to date\"") {
|
} else if strings.Contains(newStr, "\"status\":\"Status: Image is up to date") {
|
||||||
utils.Log("No updates available for " + container.Image)
|
utils.Log("No updates available for " + container.Image)
|
||||||
|
|
||||||
if !IsLabel(container, "cosmos-auto-update") {
|
if !IsLabel(fullContainer, "cosmos-auto-update") {
|
||||||
rc.Close()
|
rc.Close()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
utils.Log(newStr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// no new image to pull, see if local image is matching
|
// no new image to pull, see if local image is matching
|
||||||
if !result[container.Names[0]] && !needsUpdate {
|
if !result[container.Names[0]] && !needsUpdate {
|
||||||
// check sum of local vs container image
|
// check sum of local vs container image
|
||||||
localImage, _, err := cli.ImageInspectWithRaw(context.Background(), container.Image)
|
utils.Log("CheckUpdatesAvailable - Checking local image for change for " + container.Image)
|
||||||
|
localImage, _, err := DockerClient.ImageInspectWithRaw(DockerContext, container.Image)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
utils.Error("CheckUpdatesAvailable - local image - ", err)
|
utils.Error("CheckUpdatesAvailable - local image - ", err)
|
||||||
continue
|
continue
|
||||||
|
@ -379,12 +388,16 @@ func CheckUpdatesAvailable() map[string]bool {
|
||||||
|
|
||||||
if localImage.ID != container.ImageID {
|
if localImage.ID != container.ImageID {
|
||||||
result[container.Names[0]] = true
|
result[container.Names[0]] = true
|
||||||
|
needsUpdate = true
|
||||||
|
utils.Log("CheckUpdatesAvailable - Local updates available for " + container.Image)
|
||||||
|
} else {
|
||||||
|
utils.Log("CheckUpdatesAvailable - No local updates available for " + container.Image)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if needsUpdate && IsLabel(container, "cosmos-auto-update") {
|
if needsUpdate && IsLabel(fullContainer, "cosmos-auto-update") {
|
||||||
utils.Log("Downlaoded new update for " + container.Image + " ready to install")
|
utils.Log("Downlaoded new update for " + container.Image + " ready to install")
|
||||||
_, err := EditContainer(container.ID, container)
|
_, err := EditContainer(container.ID, fullContainer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
utils.Error("CheckUpdatesAvailable - Failed to update - ", err)
|
utils.Error("CheckUpdatesAvailable - Failed to update - ", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,10 @@ func main() {
|
||||||
|
|
||||||
docker.BootstrapAllContainersFromTags()
|
docker.BootstrapAllContainersFromTags()
|
||||||
|
|
||||||
|
// TODO DELET THIS BEFORE RELEASE
|
||||||
|
|
||||||
|
docker.CheckUpdatesAvailable()
|
||||||
|
|
||||||
version, err := docker.DockerClient.ServerVersion(context.Background())
|
version, err := docker.DockerClient.ServerVersion(context.Background())
|
||||||
if err == nil {
|
if err == nil {
|
||||||
utils.Log("Docker API version: " + version.APIVersion)
|
utils.Log("Docker API version: " + version.APIVersion)
|
||||||
|
|
Loading…
Reference in a new issue