Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added eks-a-releaser files #8617

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open

Conversation

ibix16
Copy link

@ibix16 ibix16 commented Aug 15, 2024

Issue #, if available:

Description of changes:

Testing (if applicable):

Documentation added/planned (if applicable):

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@eks-distro-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign tatlat for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@eks-distro-bot
Copy link
Collaborator

Hi @ibix16. Thanks for your PR.

I'm waiting for a aws member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@eks-distro-bot eks-distro-bot added needs-ok-to-test size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 15, 2024
@abhinavmpandey08
Copy link
Member

/ok-to-test

version: 0.2
env:
secrets-manager:
SECRET_PAT: "Secret:PAT"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change this secret to an existing one in the build account

pre_build:
commands:
- echo "Downloading compiled binary..."
- aws s3 cp s3://eka-a-releaser-build-output/eks-a-releaser-build .
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make the s3 bucket name configurable

@ibix16 ibix16 force-pushed the eks-a-releaser-push branch from 8e24aad to 126b86f Compare August 15, 2024 22:58
@ibix16 ibix16 force-pushed the eks-a-releaser-push branch from 126b86f to e649269 Compare August 15, 2024 23:16
@mitalipaygude
Copy link
Member

mitalipaygude commented Aug 16, 2024

Let's update the description section with details about the PR and testing.

Also this is a very large PR to review. We might end up missing things while reviewing. Can we break these PRs up into smaller PRs?

if RELEASE_TYPE == "minor" {
err := createMinorBranches()
if err != nil {
fmt.Printf("error calling createMinorBranches %s", err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's return these errors to the caller instead of using Printf statements throughout.

// else
err := createPatchBranch()
if err != nil {
fmt.Printf("error calling createPatchBranch %s", err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment about printing errors.


// else
//create client
accessToken := os.Getenv("SECRET_PAT")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we can define this as a constant instead of writing the string value at multiple places.

return rel, nil
}

func retrieveLatestProdCLIHash(releaseType string) string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func retrieveLatestProdCLIHash(releaseType string) string {
func retrieveLatestProdCLIHash(releaseType string) error {

Let's return error instead of the string


commits, _, err := client.Repositories.ListCommits(ctx, usersForkedRepoAccount, EKSAnyrepoName, opts)
if err != nil {
return "error fetching commits list"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return "error fetching commits list"
return fmt.Errorf("fetching commits list %v", err)

something like this


func createGitHubRelease(releaseTag *github.RepositoryRelease) (*github.RepositoryRelease, error) {

latestVersionValue := os.Getenv("LATEST_VERSION")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: constant for LATEST_VERSION

ctx := context.Background()
client := github.NewClient(nil).WithAuthToken(accessToken)

release, _, err := client.Repositories.GetReleaseByTag(ctx, upStreamRepoOwner, EKSAnyrepoName, latestVersionValue)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we also return here if we encounter an error?

Suggested change
release, _, err := client.Repositories.GetReleaseByTag(ctx, upStreamRepoOwner, EKSAnyrepoName, latestVersionValue)
release, _, err := client.Repositories.GetReleaseByTag(ctx, upStreamRepoOwner, EKSAnyrepoName, latestVersionValue)
if err != nil {
return nil, err
}


release, _, err := client.Repositories.GetReleaseByTag(ctx, upStreamRepoOwner, EKSAnyrepoName, latestVersionValue)
if err == nil {
fmt.Printf("Release %s already exists!\n", latestVersionValue)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend logging these statements rather than printing them.


pr, _, err := client.PullRequests.Create(ctx, upStreamRepoOwner, EKSAnyrepoName, newPR)
if err != nil {
return fmt.Errorf("error creating PR %s", err)
Copy link
Member

@mitalipaygude mitalipaygude Aug 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return fmt.Errorf("error creating PR %s", err)
return fmt.Errorf("creating PR %v", err)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants