working on release
Signed-off-by: James Strong <james.strong@chainguard.dev>
This commit is contained in:
parent
93d90a2cf8
commit
53fd4f8052
4 changed files with 24 additions and 26 deletions
|
@ -11,7 +11,7 @@ var DEBUG bool
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
DEBUG = false
|
DEBUG = false
|
||||||
debugENV := os.Getenv("MAGE_DEBUG")
|
debugENV := os.Getenv("DEBUG")
|
||||||
if debugENV == "true" {
|
if debugENV == "true" {
|
||||||
DEBUG = true
|
DEBUG = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,11 +41,6 @@ func updateAppVersion() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateVersion Update Helm Version of the Chart
|
|
||||||
func UpdateVersion(version string) {
|
|
||||||
updateVersion(version)
|
|
||||||
}
|
|
||||||
|
|
||||||
func currentChartVersion() string {
|
func currentChartVersion() string {
|
||||||
chart, err := chartutil.LoadChartfile(HelmChartPath)
|
chart, err := chartutil.LoadChartfile(HelmChartPath)
|
||||||
CheckIfError(err, "HELM Could not Load Chart")
|
CheckIfError(err, "HELM Could not Load Chart")
|
||||||
|
@ -58,19 +53,13 @@ func currentChartAppVersion() string {
|
||||||
return chart.AppVersion
|
return chart.AppVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateVersion(version string) {
|
// UpdateVersion Update Helm Version of the Chart
|
||||||
|
func UpdateVersion(appVersion string) {
|
||||||
Info("HELM Reading File %v", HelmChartPath)
|
Info("HELM Reading File %v", HelmChartPath)
|
||||||
|
|
||||||
chart, err := chartutil.LoadChartfile(HelmChartPath)
|
chart, err := chartutil.LoadChartfile(HelmChartPath)
|
||||||
CheckIfError(err, "HELM Could not Load Chart")
|
CheckIfError(err, "HELM Could not Load Chart")
|
||||||
|
|
||||||
//Get the current tag
|
|
||||||
//appVersionV, err := getIngressNGINXVersion()
|
|
||||||
//CheckIfError(err, "HELM Issue Retrieving the Current Ingress Nginx Version")
|
|
||||||
|
|
||||||
//remove the v from TAG
|
|
||||||
appVersion := version
|
|
||||||
|
|
||||||
Info("HELM Ingress-Nginx App Version: %s Chart AppVersion: %s", appVersion, chart.AppVersion)
|
Info("HELM Ingress-Nginx App Version: %s Chart AppVersion: %s", appVersion, chart.AppVersion)
|
||||||
if appVersion == chart.AppVersion {
|
if appVersion == chart.AppVersion {
|
||||||
Warning("HELM Ingress NGINX Version didnt change Ingress-Nginx App Version: %s Chart AppVersion: %s", appVersion, chart.AppVersion)
|
Warning("HELM Ingress NGINX Version didnt change Ingress-Nginx App Version: %s Chart AppVersion: %s", appVersion, chart.AppVersion)
|
||||||
|
|
|
@ -38,20 +38,20 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// var INGRESS_ORG = "kubernetes" // the owner so we can test from forks
|
// var INGRESS_ORG = "kubernetes" // the owner so we can test from forks
|
||||||
var INGRESS_ORG = "strongjz" // the owner so we can test from forks
|
var INGRESS_ORG = "strongjz" // the owner so we can test from forks
|
||||||
var INGRESS_REPO = "ingress-nginx" // the repo to pull from
|
var INGRESS_REPO = "ingress-nginx" // the repo to pull from
|
||||||
var RELEASE_BRANCH = "main" //we only release from main
|
var RELEASE_BRANCH = "main" //we only release from main
|
||||||
var GITHUB_TOKEN string // the Google/gogithub lib needs an PAT to access the GitHub API
|
var GITHUB_TOKEN string // the Google/gogithub lib needs an PAT to access the GitHub API
|
||||||
// var K8S_IO_ORG = "kubernetes" //the owner or organization for the k8s.io repo
|
|
||||||
var K8S_IO_ORG = "strongjz" //the owner or organization for the k8s.io repo
|
|
||||||
var K8S_IO_REPO = "k8s.io" //the repo that holds the images yaml for production promotion
|
var K8S_IO_REPO = "k8s.io" //the repo that holds the images yaml for production promotion
|
||||||
var INGRESS_REGISTRY = "registry.k8s.io" //Container registry for storage Ingress-nginx images
|
var INGRESS_REGISTRY = "registry.k8s.io" //Container registry for storage Ingress-nginx images
|
||||||
var KUSTOMIZE_INSTALL_VERSION = "sigs.k8s.io/kustomize/kustomize/v4@v4.5.4" //static deploys needs kustomize to generate the template
|
var KUSTOMIZE_INSTALL_VERSION = "sigs.k8s.io/kustomize/kustomize/v4@v4.5.4" //static deploys needs kustomize to generate the template
|
||||||
|
|
||||||
// ingress-nginx releases start with a TAG then a cloudbuild, then a promotion through a PR, this the location of that PR
|
// ingress-nginx releases start with a TAG then a cloudbuild, then a promotion through a PR, this the location of that PR
|
||||||
var IMAGES_YAML = "https://raw.githubusercontent.com/strongjz/k8s.io/main/registry.k8s.io/images/k8s-staging-ingress-nginx/images.yaml"
|
var IMAGES_YAML = "https://raw.githubusercontent.com/" + INGRESS_ORG + "/k8s.io/main/registry.k8s.io/images/k8s-staging-ingress-nginx/images.yaml"
|
||||||
var ctx = context.Background() // Context used for GitHub Client
|
var ctx = context.Background() // Context used for GitHub Client
|
||||||
|
|
||||||
|
var version string
|
||||||
|
|
||||||
const INDEX_DOCS = "docs/deploy/index.md" //index.md has a version of the controller and needs to updated
|
const INDEX_DOCS = "docs/deploy/index.md" //index.md has a version of the controller and needs to updated
|
||||||
const CHANGELOG = "Changelog.md" //Name of the changelog
|
const CHANGELOG = "Changelog.md" //Name of the changelog
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ var controllerReleaseCmd = &cobra.Command{
|
||||||
Short: "Release Ingress-nginx Controller",
|
Short: "Release Ingress-nginx Controller",
|
||||||
Long: "Release a new version of ingress-nginx controller",
|
Long: "Release a new version of ingress-nginx controller",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
NewRelease(version)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ func init() {
|
||||||
rootCmd.AddCommand(releaseCmd)
|
rootCmd.AddCommand(releaseCmd)
|
||||||
releaseCmd.AddCommand(helmReleaseCmd)
|
releaseCmd.AddCommand(helmReleaseCmd)
|
||||||
releaseCmd.AddCommand(controllerReleaseCmd)
|
releaseCmd.AddCommand(controllerReleaseCmd)
|
||||||
|
controllerReleaseCmd.Flags().StringVar(&version, "version", "v1.0.0-dev", "version of the controller to update")
|
||||||
}
|
}
|
||||||
|
|
||||||
// ControllerImage - struct with info about controllers
|
// ControllerImage - struct with info about controllers
|
||||||
|
@ -149,7 +149,7 @@ func NewRelease(version string) {
|
||||||
tag, err := getIngressNGINXVersion()
|
tag, err := getIngressNGINXVersion()
|
||||||
CheckIfError(err, "RELEASE Retrieving the current Ingress Nginx Version")
|
CheckIfError(err, "RELEASE Retrieving the current Ingress Nginx Version")
|
||||||
|
|
||||||
Info("RELEASE Checking Current Version %s to New Version %s", tag, version)
|
Info("RELEASE Checking Current Version %s to New Version %s", tag[1:], version)
|
||||||
//if the version were upgrading does not match the TAG file, lets update the TAG file
|
//if the version were upgrading does not match the TAG file, lets update the TAG file
|
||||||
if tag[1:] != version {
|
if tag[1:] != version {
|
||||||
Warning("RELEASE Ingress Nginx TAG %s and new version %s do not match", tag, version)
|
Warning("RELEASE Ingress Nginx TAG %s and new version %s do not match", tag, version)
|
||||||
|
@ -183,7 +183,7 @@ func NewRelease(version string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//update helm chart app version
|
//update helm chart app version
|
||||||
//mg.Deps(mg.F(Helm.UpdateVersion, version))
|
UpdateVersion(version)
|
||||||
|
|
||||||
releaseNotes.NewHelmChartVersion = currentChartVersion()
|
releaseNotes.NewHelmChartVersion = currentChartVersion()
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,15 @@ func BumpNginx(newTag string) {
|
||||||
currentTag, err := getIngressNGINXVersion()
|
currentTag, err := getIngressNGINXVersion()
|
||||||
CheckIfError(err, "Getting Ingress-nginx Version")
|
CheckIfError(err, "Getting Ingress-nginx Version")
|
||||||
bump(currentTag, newTag)
|
bump(currentTag, newTag)
|
||||||
|
|
||||||
|
if !checkSemVer(currentTag, newTag) {
|
||||||
|
ErrorF("ERROR: Semver is not valid %v", newTag)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
Info("Updating Tag %v to %v", currentTag, newTag)
|
||||||
|
err = os.WriteFile("../TAG", []byte(newTag), 0666)
|
||||||
|
CheckIfError(err, "Error Writing New Tag File")
|
||||||
}
|
}
|
||||||
|
|
||||||
func bump(currentTag, newTag string) {
|
func bump(currentTag, newTag string) {
|
||||||
|
@ -107,7 +116,7 @@ func bump(currentTag, newTag string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Info("Updating Tag %v to %v", currentTag, newTag)
|
Info("Updating Tag %v to %v", currentTag, newTag)
|
||||||
err := os.WriteFile("../TAG", []byte(newTag), 0666)
|
err := os.WriteFile("TAG", []byte(newTag), 0666)
|
||||||
CheckIfError(err, "Error Writing New Tag File")
|
CheckIfError(err, "Error Writing New Tag File")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue