Skip to content

Commit

Permalink
Update cert-manager manifest when bumping Git tag (#3861)
Browse files Browse the repository at this point in the history
  • Loading branch information
abhay-krishna authored Oct 6, 2024
1 parent 3545c83 commit 8523de4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
28 changes: 25 additions & 3 deletions tools/version-tracker/pkg/commands/upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,15 @@ func Run(upgradeOptions *types.UpgradeOptions) error {
updatedFiles = append(updatedFiles, updatedCiliumImageDigestFiles...)
}
}

if projectName == "cert-manager/cert-manager" {
err := updateCertManagerManifestFile(projectRootFilepath)
if err != nil {
failedSteps["Cert-manager manifest file update"] = err
} else {
updatedFiles = append(updatedFiles, filepath.Join(projectPath, constants.ManifestsDirectory, constants.CertManagerManifestYAMLFile))
}
}
}

if projectName == "kubernetes-sigs/image-builder" {
Expand Down Expand Up @@ -463,9 +472,11 @@ func Run(upgradeOptions *types.UpgradeOptions) error {
}
failedUpgradeComment := fmt.Sprintf(constants.FailedUpgradeCommentBody, strings.Join(failedStepsList, "\n"))

err = github.AddCommentOnPR(client, baseRepoOwner, failedUpgradeComment, pullRequest)
if err != nil {
return fmt.Errorf("commenting failed upgrade comment on pull request [%s]: %v", *pullRequest.HTMLURL, err)
if !upgradeOptions.DryRun {
err = github.AddCommentOnPR(client, baseRepoOwner, failedUpgradeComment, pullRequest)
if err != nil {
return fmt.Errorf("commenting failed upgrade comment on pull request [%s]: %v", *pullRequest.HTMLURL, err)
}
}

return errors.New(strings.Join(errorsList, "\n"))
Expand Down Expand Up @@ -750,6 +761,17 @@ func updateCiliumImageDigestFiles(projectRootFilepath, projectPath string) ([]st
return updateCiliumFiles, nil
}

func updateCertManagerManifestFile(projectRootFilepath string) error {
updateCertManagerManifestCommandSequence := fmt.Sprintf("make -C %s update-cert-manager-manifest", projectRootFilepath)
updateCertManagerManifestCmd := exec.Command("bash", "-c", updateCertManagerManifestCommandSequence)
_, err := command.ExecCommand(updateCertManagerManifestCmd)
if err != nil {
return fmt.Errorf("running update-cert-manager-manifest Make command: %v", err)
}

return nil
}

func updateBottlerocketVersionFiles(client *gogithub.Client, projectRootFilepath, projectPath, branchName string) (string, string, []string, error) {
updatedBRFiles := []string{}
var bottlerocketReleaseMap map[string]interface{}
Expand Down
2 changes: 2 additions & 0 deletions tools/version-tracker/pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const (
GoVersionFile = "GOLANG_VERSION"
ChecksumsFile = "CHECKSUMS"
AttributionsFilePattern = "*ATTRIBUTION.txt"
ManifestsDirectory = "manifests"
PatchesDirectory = "patches"
FailedPatchApplyMarker = "patch does not apply"
SemverRegex = `v?(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?`
Expand All @@ -39,6 +40,7 @@ const (
BottlerocketReleasesFile = "BOTTLEROCKET_RELEASES"
BottlerocketContainerMetadataFileFormat = "BOTTLEROCKET_%s_CONTAINER_METADATA"
BottlerocketHostContainersTOMLFile = "sources/shared-defaults/public-host-containers.toml"
CertManagerManifestYAMLFile = "cert-manager.yaml"
CiliumImageRepository = "public.ecr.aws/isovalent/cilium"
GithubPerPage = 100
datetimeFormat = "%Y-%m-%dT%H:%M:%SZ"
Expand Down

0 comments on commit 8523de4

Please sign in to comment.