Skip to content

Commit

Permalink
Fix Bottlerocket host container metadata files (#3075)
Browse files Browse the repository at this point in the history
  • Loading branch information
abhay-krishna authored Apr 11, 2024
1 parent e1a3cbf commit 0f1d8d6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ImageDigest: sha256:2f884ebc34c0f54b6d75493ba2ad645f42525d6c90fe2099ae50708de6f86152
Tag: v0.11.6
imageDigest: sha256:2f884ebc34c0f54b6d75493ba2ad645f42525d6c90fe2099ae50708de6f86152
tag: v0.11.6
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ImageDigest: sha256:0ed73c9a2e35fab4287f3cbf18de084b740cace3234628c5e215adc407e52750
Tag: v0.7.10
imageDigest: sha256:0ed73c9a2e35fab4287f3cbf18de084b740cace3234628c5e215adc407e52750
tag: v0.7.10
8 changes: 4 additions & 4 deletions tools/version-tracker/pkg/commands/upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func Run(upgradeOptions *types.UpgradeOptions) error {
projectHasPatches = true
patchFiles, err := os.ReadDir(filepath.Join(projectRootFilepath, constants.PatchesDirectory))
if err != nil {
return fmt.Errorf("reading patch directory", err)
return fmt.Errorf("reading patch directory: %v", err)
}
totalPatchCount = len(patchFiles)
}
Expand Down Expand Up @@ -445,13 +445,13 @@ func getLatestEKSDistroRelease(client *gogithub.Client, branch string) (int, str
eksDistroProdReleaseNumberFile := fmt.Sprintf(constants.EKSDistroProdReleaseNumberFileFormat, branch)
releaseNumber, err := github.GetFileContents(client, "aws", "eks-distro", eksDistroProdReleaseNumberFile, constants.MainBranchName)
if err != nil {
return 0, "", fmt.Errorf("getting contents of EKS Distro prod release number file: %v", eksDistroProdReleaseNumberFile, err)
return 0, "", fmt.Errorf("getting contents of EKS Distro prod release number file: %v", err)
}

kubernetesGitTagFile := fmt.Sprintf(constants.KubernetesGitTagFileFormat, branch)
kubeVersion, err := github.GetFileContents(client, "aws", "eks-distro", kubernetesGitTagFile, constants.MainBranchName)
if err != nil {
return 0, "", fmt.Errorf("getting contents of Kubernetes Git tag file: %v", eksDistroProdReleaseNumberFile, err)
return 0, "", fmt.Errorf("getting contents of Kubernetes Git tag file: %v", err)
}

releaseNumberInt, err := strconv.Atoi(strings.TrimRight(string(releaseNumber), "\n"))
Expand Down Expand Up @@ -777,7 +777,7 @@ func updateBottlerocketHostContainerMetadata(client *gogithub.Client, projectRoo
updatedHostContainerFiles := []string{}
hostContainersTOMLContents, err := github.GetFileContents(client, "bottlerocket-os", "bottlerocket", constants.BottlerocketHostContainersTOMLFile, latestBottlerocketVersion)
if err != nil {
return nil, fmt.Errorf("getting contents of Bottlerocket host containers file: %v", constants.BottlerocketHostContainersTOMLFile, err)
return nil, fmt.Errorf("getting contents of Bottlerocket host containers file: %v", err)
}

var hostContainersTOMLMap interface{}
Expand Down
4 changes: 2 additions & 2 deletions tools/version-tracker/pkg/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,15 +361,15 @@ func CreatePullRequest(client *github.Client, org, repo, title, body, baseRepoOw
pullRequest.Body = github.String(body)
pullRequest, _, err = client.PullRequests.Edit(context.Background(), baseRepoOwner, constants.BuildToolingRepoName, *pullRequest.Number, pullRequest)
if err != nil {
return fmt.Errorf("editing existing pull request %s: %v", pullRequest.HTMLURL, err)
return fmt.Errorf("editing existing pull request %s: %v", *pullRequest.HTMLURL, err)
}

// If patches to the project failed to apply, check if the PR already has a comment warning about
// the incomplete PR and patches needing to be regenerated.
if addPatchWarningComment {
pullRequestComments, _, err := client.Issues.ListComments(context.Background(), baseRepoOwner, constants.BuildToolingRepoName, *pullRequest.Number, nil)
if err != nil {
return fmt.Errorf("listing comments on pull request [%s]: %v", pullRequest.HTMLURL, err)
return fmt.Errorf("listing comments on pull request [%s]: %v", *pullRequest.HTMLURL, err)
}

for _, comment := range pullRequestComments {
Expand Down
4 changes: 2 additions & 2 deletions tools/version-tracker/pkg/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ type GoVersionSourceOfTruth struct {
}

type ImageMetadata struct {
Tag string `yaml:"tag,omitempty"`
ImageDigest string `yaml:"imageDigest,omitempty"`
Tag string `json:"tag,omitempty"`
ImageDigest string `json:"imageDigest,omitempty"`
}

type EKSDistroRelease struct {
Expand Down

0 comments on commit 0f1d8d6

Please sign in to comment.