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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make SecurityTests' timeout configurable #509

Open
rafaveira3 opened this issue Sep 30, 2020 · 4 comments
Open

Make SecurityTests' timeout configurable #509

rafaveira3 opened this issue Sep 30, 2020 · 4 comments
Labels
feature-request New feature request hacktoberfest2022 https://opensource.globo.com/hacktoberfest

Comments

@rafaveira3
Copy link
Contributor

rafaveira3 commented Sep 30, 2020

Motivation

We received this feedback from huskyCI users (thanks, @igorfernandes 馃槂) that suggests that the analysis could have a timeout configurable. Some repositories are "very large" take too long to finish, which impacts their CI somehow.

It would be great if

We add new logic to let developers set this on their side, and not from the hardcoded the API config.yaml.

What we expect

There are a few ways we can take this issue and a start suggestion is to add a new environment variable to the client code, as exemplified below:

stages:
    - huskyCI

huskyCI:
    stage: huskyCI
    variables:
        HUSKYCI_CLIENT_TESTS_TIMEOUT: 360
    script:
        - wget $HUSKYCI_CLIENT_URL/huskyci-client
        - chmod +x huskyci-client
        - ./huskyci-client

Tips

@rafaveira3 rafaveira3 added the hacktoberfest2022 https://opensource.globo.com/hacktoberfest label Sep 30, 2020
@raydwaipayan
Copy link

The timeout seems to be hardcoded in [analysis.go] (https://github.com/globocom/huskyCI/blob/master/client/analysis/analysis.go)

	timeout := time.After(60 * time.Minute)

Changing this should suffice perhaps.

I would like to take it up!

@rafaveira3
Copy link
Contributor Author

Great catch, @raydwaipayan! I will be very happy to review any PR regarding this one! :)

@raydwaipayan
Copy link

Great thanks! I will send in a PR once done.

@raydwaipayan
Copy link

raydwaipayan commented Oct 1, 2020

@rafaveira3 One problem I am facing is that the Timeout times are hardly coupled with security tests currenty.
I am looking at using a temporary timeout time which overrides the set timeOutInSeconds in SecurityTest:

type SecurityTest struct {
	Name             string `bson:"name" json:"name"`
	Image            string `bson:"image" json:"image"`
	ImageTag         string `bson:"imageTag" json:"imageTag"`
	Cmd              string `bson:"cmd" json:"cmd"`
	Type             string `bson:"type" json:"type"`
	Language         string `bson:"language" json:"language"`
	Default          bool   `bson:"default" json:"default"`
	TimeOutInSeconds int    `bson:"timeOutSeconds" json:"timeOutSeconds"`
}

This config is only loaded once, so overwriting it's values may cause further problems.

I was looking at modifying the Repository type like this:

type Repository struct {
	URL       string    `bson:"repositoryURL" json:"repositoryURL"`
	Branch    string    `json:"repositoryBranch"`
	TimeOut   string    `json:"timeOutInSeconds"`
	CreatedAt time.Time `bson:"createdAt" json:"createdAt"`
}

And probably override the security test timeouts for that repo temporarily to take the new
supplied value.

What do you think of this?

@Krlier Krlier added feature-request New feature request and removed hacktoberfest2022 https://opensource.globo.com/hacktoberfest labels Nov 9, 2020
@fguisso fguisso added the hacktoberfest2022 https://opensource.globo.com/hacktoberfest label Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature request hacktoberfest2022 https://opensource.globo.com/hacktoberfest
Projects
None yet
4 participants