-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update linuxserver/jackett Docker tag to v0.21.1084 (#62)
* Update linuxserver/jackett Docker tag to v0.21.1084 * Adding simple golang script to generate sed + commit message * jackett: update version to match docker image tag * Adding 'git add' * jackett: update version to match docker image tag * Increment version number --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: qjoly <[email protected]>
- Loading branch information
1 parent
894f533
commit bfd6833
Showing
3 changed files
with
83 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"os" | ||
"strconv" | ||
"strings" | ||
|
||
dig_yaml "github.com/esakat/dig-yaml" | ||
"gopkg.in/yaml.v2" | ||
) | ||
|
||
func main() { | ||
|
||
var chartName = os.Getenv("CHART") | ||
|
||
chartPath := fmt.Sprintf("charts/%s/Chart.yaml", chartName) | ||
valuePath := fmt.Sprintf("charts/%s/values.yaml", chartName) | ||
|
||
f, err := os.Open(chartPath) | ||
defer f.Close() | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
dec := yaml.NewDecoder(f) | ||
var y map[interface{}]interface{} | ||
dec.Decode(&y) | ||
|
||
chartVersion, err := dig_yaml.DigYaml(y, "appVersion") | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
chartRelease, err := dig_yaml.DigYaml(y, "version") | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
f, err = os.Open(valuePath) | ||
defer f.Close() | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
dec = yaml.NewDecoder(f) | ||
dec.Decode(&y) | ||
|
||
appVersion, err2 := dig_yaml.DigYaml(y, "common", "image", "tag") | ||
if err2 != nil { | ||
log.Fatal(err2) | ||
} | ||
|
||
if appVersion != chartVersion { | ||
fmt.Printf("✖️ Versions in 'Chart.yaml'(%s) and 'values.yaml'(%s) are differents.\n", chartVersion, appVersion) | ||
} else { | ||
fmt.Println("✔️ Versions are identicals.") | ||
os.Exit(0) | ||
} | ||
|
||
v := strings.Split(chartRelease.(string), ".") | ||
x, _ := strconv.ParseInt((v[len(v)-1]), 10, 0) | ||
x += 1 | ||
v = v[:len(v)-1] | ||
v = append(v, fmt.Sprint("", x)) | ||
|
||
newChartRelease := strings.Join(v, ".") | ||
|
||
var sedHelp = fmt.Sprintf(` | ||
If you want to replace the version in Chart.yaml file, please execute this command: | ||
sed -i 's/%s/%s/' -i %s | ||
sed -i 's/%s/%s/' -i %s | ||
git add %s | ||
git commit -m "%s: update version to match docker image tag" | ||
`, chartVersion, appVersion, chartPath, chartRelease, newChartRelease, chartPath, chartPath, chartName) | ||
|
||
fmt.Println(sedHelp) | ||
} |