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

Append UID to config name #69

Merged
merged 1 commit into from
May 28, 2024
Merged

Append UID to config name #69

merged 1 commit into from
May 28, 2024

Conversation

ArangoGutierrez
Copy link
Collaborator

When running parallel workflows we need to have UID for each instance to avoid them having the same name

Signed-off-by: Carlos Eduardo Arango Gutierrez <[email protected]>
@ArangoGutierrez
Copy link
Collaborator Author

Inspired by NVIDIA/gpu-operator#721 that is proposing parallel runs

@ArangoGutierrez ArangoGutierrez self-assigned this May 23, 2024
@ArangoGutierrez ArangoGutierrez requested a review from elezar May 23, 2024 14:42
@@ -18,10 +18,13 @@ package ci

import (
"fmt"
"math/rand" //nolint:all
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to add a comment as to why this is done?

Suggested change
"math/rand" //nolint:all
"math/rand" //nolint:gosec // We use randomization for appending unique suffixes and this need not be cryptographically secure.


b := make([]byte, 8)
for i := range b {
b[i] = charset[rand.Intn(len(charset))]
Copy link
Member

Choose a reason for hiding this comment

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

Question: Is the lint error reported here or at the import?

Copy link
Member

Choose a reason for hiding this comment

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

It would be reported here. Tested in the device plugin:

 ✗ make check
golangci-lint run ./...
tests/e2e/framework/framework.go:149:53: G404: Use of weak random number generator (math/rand instead of crypto/rand) (gosec)
                f.UniqueName = fmt.Sprintf("%s-%08x", f.BaseName, rand.Int31())
                                                                  ^
tests/e2e/framework/util.go:50:22: G404: Use of weak random number generator (math/rand instead of crypto/rand) (gosec)
        return strconv.Itoa(rand.Intn(10000))
                            ^
make: *** [Makefile:81: lint] Error 1

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

Copy link
Member

@elezar elezar May 28, 2024

Choose a reason for hiding this comment

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

I mean, do we want to add the nolint here and NOT at the import.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did a run without the comment on both

❯ golangci-lint run ./... |grep weak

and golangci-lint didn't complained

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have edited it to only have the lint comment on the code and not the import.

Copy link
Member

Choose a reason for hiding this comment

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

This project doesn't seem to have a .golangci file. Could that be why we're not seeing the issue?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I copied the one from device-plug repo thinking the same, and got no error

❯ golangci-lint --version
golangci-lint has version 1.59.0 built with go1.22.3 from 2059b18 on 2024-05-25T11:38:08Z

@ArangoGutierrez ArangoGutierrez requested a review from elezar May 28, 2024 13:26
@ArangoGutierrez ArangoGutierrez force-pushed the err_log_ci branch 2 times, most recently from eb4e8a3 to 654f3d4 Compare May 28, 2024 15:06
@ArangoGutierrez
Copy link
Collaborator Author

Updated as discussed @elezar

@elezar elezar merged commit 58fe703 into main May 28, 2024
5 checks passed
@elezar elezar deleted the err_log_ci branch May 28, 2024 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants