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

feat: implement bldr update --dry command #63

Merged
merged 1 commit into from
Jul 13, 2021

Conversation

AlekSi
Copy link
Contributor

@AlekSi AlekSi commented Jul 12, 2021

Only for GitHub tags and releases for now.

Refs #48.

$ bldr update --dry
[...]
File                  Update   URL
open-iscsi/pkg.yaml   true     https://github.com/open-iscsi/open-iscsi/archive/refs/tags/2.1.4.tar.gz
open-isns/pkg.yaml    true     https://github.com/open-iscsi/open-isns/archive/refs/tags/v0.101.tar.gz

@AlekSi
Copy link
Contributor Author

AlekSi commented Jul 12, 2021

/approve

@Unix4ever
Copy link
Member

Unix4ever commented Jul 12, 2021

would be nice to see output example in the comment ;)

@AlekSi
Copy link
Contributor Author

AlekSi commented Jul 12, 2021

Updated description

@AlekSi
Copy link
Contributor Author

AlekSi commented Jul 12, 2021

/approve

)

func gitHubTokenFromEnv() string {
token := os.Getenv("BLDR_GITHUB_TOKEN")
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need both?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is just for convenience. BLDR_GITHUB_TOKEN is the bldr-specific token. If it is empty, we try GITHUB_TOKEN, which a common name for many tools that use GitHub API. We don't need any scope for it, so any working token will do.

internal/pkg/update/github_test.go Show resolved Hide resolved
}

concurrency := runtime.GOMAXPROCS(-1)
var wg sync.WaitGroup
Copy link
Member

Choose a reason for hiding this comment

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

Should we use an error group? Do we want to treat a failed update is an error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At the moment, all errors are treated as warnings and logged and ignored below. Once more cases are covered, and the distinction between hard errors and warnings is more clear, this code will be updated to use ErrGroup.

internal/pkg/update/github.go Show resolved Hide resolved
internal/pkg/update/github.go Show resolved Hide resolved
Only for GitHub tags and releases for now.

Refs siderolabs#48.

Signed-off-by: Alexey Palazhchenko <[email protected]>
@AlekSi AlekSi requested a review from smira July 13, 2021 08:07
@AlekSi
Copy link
Contributor Author

AlekSi commented Jul 13, 2021

/lgtm

@talos-bot talos-bot merged commit 07cd6ea into siderolabs:master Jul 13, 2021
@AlekSi AlekSi deleted the check-updates branch July 14, 2021 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants