Skip to content
This repository was archived by the owner on Apr 15, 2023. It is now read-only.

Commit 69a6cd9

Browse files
Get latest processed version from env var
I know this is not nice but it works for now
1 parent ad4c78d commit 69a6cd9

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ Below you find a list with all required and optional variables.
1919
### Optional
2020

2121
- **DISCORD_WEBHOOK_URL**: Discord webhook url for announcements
22+
- **VERSION_FIX**: If the watchdog fails cause the repository is already on the latest version set this variable to the latest version

Diff for: factorio-docker-watchdog.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,13 @@ var latestVersionProceeded map[string]string
1313

1414
func main() {
1515
latestVersionProceeded = map[string]string{}
16+
versionFill, err := semver.Make(os.Getenv("VERSION_FIX"))
17+
if err != nil {
18+
logrus.Error(err)
19+
}
20+
latestVersionProceeded[fmt.Sprintf("%d.%d", versionFill.Major, versionFill.Minor)] = versionFill.String()
1621

17-
err := gitSetupCredentials()
22+
err = gitSetupCredentials()
1823
if err != nil {
1924
logrus.Panic(err)
2025
}
@@ -46,6 +51,7 @@ func checkVersion() {
4651
versions = append(versions, v)
4752
}
4853
semver.Sort(versions)
54+
logrus.Debug("Available versions from Factorio.com ", versions)
4955

5056
// Filter only latest version based on minor
5157
var lastVersion semver.Version
@@ -62,9 +68,9 @@ func checkVersion() {
6268
} else if i+1 == len(versions) {
6369
lastVersions = append(lastVersions, version)
6470
}
65-
6671
lastVersion = version
6772
}
73+
logrus.Info("last version of each major", lastVersions)
6874

6975
// Remove all tags which are published on docker
7076
tags, err := getTags()

0 commit comments

Comments
 (0)