update docs, and production urls
Signed-off-by: James Strong <strong.james.e@gmail.com>
This commit is contained in:
parent
a4fd7c8096
commit
9d4b81ca2a
2 changed files with 59 additions and 55 deletions
|
@ -104,7 +104,7 @@ func updateChartReleaseNotes(releasesNotes []string) {
|
||||||
for i := range releasesNotes {
|
for i := range releasesNotes {
|
||||||
releaseNoteString = fmt.Sprintf("%s - %s\n", releaseNoteString, releasesNotes[i])
|
releaseNoteString = fmt.Sprintf("%s - %s\n", releaseNoteString, releasesNotes[i])
|
||||||
}
|
}
|
||||||
Info("HLEM Release note string %s", releaseNoteString)
|
Info("HELM Release note string %s", releaseNoteString)
|
||||||
chart.Annotations["artifacthub.io/changes"] = releaseNoteString
|
chart.Annotations["artifacthub.io/changes"] = releaseNoteString
|
||||||
err = chartutil.SaveChartfile(HelmChartPath, chart)
|
err = chartutil.SaveChartfile(HelmChartPath, chart)
|
||||||
CheckIfError(err, "HELM Saving updated release notes for Chart")
|
CheckIfError(err, "HELM Saving updated release notes for Chart")
|
||||||
|
|
|
@ -40,22 +40,61 @@ import (
|
||||||
|
|
||||||
type Release mg.Namespace
|
type Release mg.Namespace
|
||||||
|
|
||||||
var INGRESS_ORG = "strongjz" // the owner so we can test from forks
|
var INGRESS_ORG = "kubernetes" // 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 = "strongjz" //the owner or organization for the k8s.io repo
|
var K8S_IO_ORG = "kubernetes" //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
|
||||||
|
|
||||||
// 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/kubernetes/k8s.io/main/k8s.gcr.io/images/k8s-staging-ingress-nginx/images.yaml"
|
var IMAGES_YAML = "https://raw.githubusercontent.com/kubernetes/k8s.io/main/k8s.gcr.io/images/k8s-staging-ingress-nginx/images.yaml"
|
||||||
var IMAGES_YAML = "https://raw.githubusercontent.com/strongjz/k8s.io/testing/k8s.gcr.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
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
//ControllerImage - struct with info about controllers
|
||||||
|
type ControllerImage struct {
|
||||||
|
Tag string
|
||||||
|
Digest string
|
||||||
|
Registry string
|
||||||
|
Name string
|
||||||
|
}
|
||||||
|
|
||||||
|
//IngressRelease All the information about an ingress-nginx release that gets updated
|
||||||
|
type IngressRelease struct {
|
||||||
|
ControllerVersion string
|
||||||
|
ControllerImage ControllerImage
|
||||||
|
ReleaseNote ReleaseNote
|
||||||
|
Release *github.RepositoryRelease
|
||||||
|
}
|
||||||
|
|
||||||
|
//ReleaseNote - All the pieces of information/documents that get updated during a release
|
||||||
|
type ReleaseNote struct {
|
||||||
|
Version string
|
||||||
|
NewControllerVersion string
|
||||||
|
PreviousControllerVersion string
|
||||||
|
ControllerImages []ControllerImage
|
||||||
|
DepUpdates []string
|
||||||
|
Updates []string
|
||||||
|
HelmUpdates []string
|
||||||
|
NewHelmChartVersion string
|
||||||
|
PreviousHelmChartVersion string
|
||||||
|
}
|
||||||
|
|
||||||
|
//IMAGES_YAML returns this data structure
|
||||||
|
type ImageYamls []ImageElement
|
||||||
|
|
||||||
|
//ImageElement - a specific image and it's data structure the dmap is a list of shas and container versions
|
||||||
|
type ImageElement struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Dmap map[string][]string `json:"dmap"`
|
||||||
|
}
|
||||||
|
|
||||||
|
//init will set the GitHub token from the committers/releasers env var
|
||||||
func init() {
|
func init() {
|
||||||
GITHUB_TOKEN = os.Getenv("GITHUB_TOKEN")
|
GITHUB_TOKEN = os.Getenv("GITHUB_TOKEN")
|
||||||
}
|
}
|
||||||
|
@ -79,7 +118,7 @@ func (Release) NewRelease(version string) {
|
||||||
|
|
||||||
Info("RELEASE Checking Current Version %s to New Version %s", tag, version)
|
Info("RELEASE Checking Current Version %s to New Version %s", tag, 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 != 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)
|
||||||
mg.Deps(mg.F(Tag.BumpNginx, fmt.Sprintf("v%s", version)))
|
mg.Deps(mg.F(Tag.BumpNginx, fmt.Sprintf("v%s", version)))
|
||||||
}
|
}
|
||||||
|
@ -122,22 +161,20 @@ func (Release) NewRelease(version string) {
|
||||||
//update static manifest
|
//update static manifest
|
||||||
CheckIfError(updateStaticManifest(), "Error Updating Static manifests")
|
CheckIfError(updateStaticManifest(), "Error Updating Static manifests")
|
||||||
|
|
||||||
////update e2e docs TODO
|
////update e2e docs
|
||||||
updateE2EDocs()
|
updateE2EDocs()
|
||||||
|
|
||||||
//update documentation with ingress-nginx version
|
//update documentation with ingress-nginx version
|
||||||
CheckIfError(updateIndexMD(releaseNotes.PreviousControllerVersion, releaseNotes.NewControllerVersion), "Error Updating %s", INDEX_DOCS)
|
CheckIfError(updateIndexMD(releaseNotes.PreviousControllerVersion, releaseNotes.NewControllerVersion), "Error Updating %s", INDEX_DOCS)
|
||||||
|
|
||||||
|
//keeping these manual for now
|
||||||
//git commit TODO
|
//git commit TODO
|
||||||
|
|
||||||
//make Pull Request TODO
|
//make Pull Request TODO
|
||||||
|
|
||||||
//make release TODO
|
//make release TODO
|
||||||
//mg.Deps(mg.F(Release.CreateRelease, version))
|
//mg.Deps(mg.F(Release.CreateRelease, version))
|
||||||
}
|
}
|
||||||
|
|
||||||
const INDEX_DOCS = "docs/deploy/index.md"
|
// the index.md doc needs the controller version updated
|
||||||
|
|
||||||
func updateIndexMD(old, new string) error {
|
func updateIndexMD(old, new string) error {
|
||||||
Info("Updating Deploy docs with new version")
|
Info("Updating Deploy docs with new version")
|
||||||
data, err := os.ReadFile(INDEX_DOCS)
|
data, err := os.ReadFile(INDEX_DOCS)
|
||||||
|
@ -152,29 +189,29 @@ func updateIndexMD(old, new string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//runs the hack/generate-deploy-scripts.sh
|
||||||
func updateE2EDocs() {
|
func updateE2EDocs() {
|
||||||
//hack/generate-deploy-scripts.sh
|
|
||||||
updates, err := sh.Output("./hack/generate-e2e-suite-doc.sh")
|
updates, err := sh.Output("./hack/generate-e2e-suite-doc.sh")
|
||||||
CheckIfError(err, "Could not run update hack script")
|
CheckIfError(err, "Could not run update hack script")
|
||||||
err = os.WriteFile("docs/e2e-tests.md", []byte(updates), 644)
|
err = os.WriteFile("docs/e2e-tests.md", []byte(updates), 644)
|
||||||
CheckIfError(err, "Could not write new e2e test file ")
|
CheckIfError(err, "Could not write new e2e test file ")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//The static deploy scripts use kustomize to generate them, this function ensures kustomize is installed
|
||||||
func installKustomize() error {
|
func installKustomize() error {
|
||||||
Info("Install Kustomize")
|
Info("Install Kustomize")
|
||||||
var g0 = sh.RunCmd("go")
|
var g0 = sh.RunCmd("go")
|
||||||
|
|
||||||
// somewhere in your main code
|
// somewhere in your main code
|
||||||
err := g0("install", "sigs.k8s.io/kustomize/kustomize/v4@v4.5.4")
|
err := g0("install", KUSTOMIZE_INSTALL_VERSION)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
func updateStaticManifest() error {
|
func updateStaticManifest() error {
|
||||||
CheckIfError(installKustomize(), "error installing kustomize")
|
CheckIfError(installKustomize(), "error installing kustomize")
|
||||||
|
|
||||||
//hack/generate-deploy-scripts.sh
|
//hack/generate-deploy-scripts.sh
|
||||||
err := sh.RunV("./hack/generate-deploy-scripts.sh")
|
err := sh.RunV("./hack/generate-deploy-scripts.sh")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -192,32 +229,6 @@ func updateStaticManifest() error {
|
||||||
// Info("New Release: Tag %v, ID: %v", newRelease.TagName, newRelease.ID)
|
// Info("New Release: Tag %v, ID: %v", newRelease.TagName, newRelease.ID)
|
||||||
//}
|
//}
|
||||||
|
|
||||||
type ControllerImage struct {
|
|
||||||
Tag string
|
|
||||||
Digest string
|
|
||||||
Registry string
|
|
||||||
Name string
|
|
||||||
}
|
|
||||||
|
|
||||||
type IngressRelease struct {
|
|
||||||
ControllerVersion string
|
|
||||||
ControllerImage ControllerImage
|
|
||||||
ReleaseNote ReleaseNote
|
|
||||||
Release *github.RepositoryRelease
|
|
||||||
}
|
|
||||||
|
|
||||||
type ReleaseNote struct {
|
|
||||||
Version string
|
|
||||||
NewControllerVersion string
|
|
||||||
PreviousControllerVersion string
|
|
||||||
ControllerImages []ControllerImage
|
|
||||||
DepUpdates []string
|
|
||||||
Updates []string
|
|
||||||
HelmUpdates []string
|
|
||||||
NewHelmChartVersion string
|
|
||||||
PreviousHelmChartVersion string
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns a GitHub client ready for use
|
// Returns a GitHub client ready for use
|
||||||
func githubClient() *github.Client {
|
func githubClient() *github.Client {
|
||||||
ts := oauth2.StaticTokenSource(
|
ts := oauth2.StaticTokenSource(
|
||||||
|
@ -428,13 +439,6 @@ func (r ReleaseNote) printRelease() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type ImageYamls []ImageElement
|
|
||||||
|
|
||||||
type ImageElement struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Dmap map[string][]string `json:"dmap"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func findImageDigest(yaml ImageYamls, image, version string) string {
|
func findImageDigest(yaml ImageYamls, image, version string) string {
|
||||||
version = fmt.Sprintf("v%s", version)
|
version = fmt.Sprintf("v%s", version)
|
||||||
Info("Searching Digest for %s:%s", image, version)
|
Info("Searching Digest for %s:%s", image, version)
|
||||||
|
|
Loading…
Reference in a new issue