Skip to content

Commit

Permalink
Add support for Cilium version in display command
Browse files Browse the repository at this point in the history
  • Loading branch information
sp1999 committed Sep 5, 2024
1 parent aec9600 commit 072fec6
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions tools/version-tracker/pkg/commands/display/display.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ import (
"gopkg.in/yaml.v3"

"github.com/aws/eks-anywhere-build-tooling/tools/version-tracker/pkg/constants"
"github.com/aws/eks-anywhere-build-tooling/tools/version-tracker/pkg/ecrpublic"
"github.com/aws/eks-anywhere-build-tooling/tools/version-tracker/pkg/git"
"github.com/aws/eks-anywhere-build-tooling/tools/version-tracker/pkg/github"
"github.com/aws/eks-anywhere-build-tooling/tools/version-tracker/pkg/types"
)

// Run contains the business logic to execute the `display` subcommand.
func Run(displayOptions *types.DisplayOptions) error {
projectName := displayOptions.ProjectName

// Check if branch name environment variable has been set.
branchName, ok := os.LookupEnv(constants.BranchNameEnvVar)
if !ok {
Expand Down Expand Up @@ -126,10 +129,18 @@ func Run(displayOptions *types.DisplayOptions) error {
isTrackedByCommitHash = true
}

// Get latest revision for the project from GitHub.
latestRevision, _, err := github.GetLatestRevision(client, org, repoName, currentRevision, branchName, isTrackedByCommitHash, releaseBranched)
if err != nil {
return fmt.Errorf("getting latest revision from GitHub: %v", err)
var latestRevision string
if projectName == "cilium/cilium" {
latestRevision, _, err = ecrpublic.GetLatestRevision(constants.CiliumImageRepository, currentRevision, branchName)
if err != nil {
return fmt.Errorf("getting latest revision from ECR Public: %v", err)
}
} else {
// Get latest revision for the project from GitHub.
latestRevision, _, err = github.GetLatestRevision(client, org, repoName, currentRevision, branchName, isTrackedByCommitHash, releaseBranched)
if err != nil {
return fmt.Errorf("getting latest revision from GitHub: %v", err)
}
}

// Check if we should print only the latest version of the project.
Expand Down

0 comments on commit 072fec6

Please sign in to comment.