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

[docker]:[feature] - Validate Docker version from the Docker API #965

Merged
merged 5 commits into from
Feb 1, 2022

Conversation

luiguip
Copy link
Contributor

@luiguip luiguip commented Jan 31, 2022

Signed-off-by: Luis Guilherme de A luisguilhermepdea@gmail.com

- What I did

I changed the way the version of docker is retrieved, from a shell command execution to Docker API.
This pull-request solves the issue #757

- How to verify it

With the docker running, run the horusec and it will validate the Docker version, from the Docker API.

- Description for the changelog
The log error message of an error with the docker validation had changed. Now few steps of preprocessing are necessary to retrieve the version.

Signed-off-by: Luis Guilherme de A <luisguilhermepdea@gmail.com>
Copy link
Contributor

@matheusalcantarazup matheusalcantarazup left a comment

Choose a reason for hiding this comment

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

The Validate function could be simplified to this:

	version, err := validateIfDockerIsInstalled()
	if err != nil {
		return err
	}
	return validateIfDockerIsRunningInMinVersion(version)
}

And validateIfDockerIsSupported could be removed.

internal/controllers/requirements/docker/docker.go Outdated Show resolved Hide resolved
internal/controllers/requirements/docker/docker.go Outdated Show resolved Hide resolved
internal/controllers/requirements/docker/docker.go Outdated Show resolved Hide resolved
Signed-off-by: Luis Guilherme de A <luisguilhermepdea@gmail.com>
…getDockerVersion

Signed-off-by: Luis Guilherme de A <luisguilhermepdea@gmail.com>
Signed-off-by: Luis Guilherme de A <luisguilhermepdea@gmail.com>
Signed-off-by: Luis Guilherme de A <luisguilhermepdea@gmail.com>
@luiguip
Copy link
Contributor Author

luiguip commented Jan 31, 2022

Requested changes done.

Copy link
Contributor

@matheusalcantarazup matheusalcantarazup left a comment

Choose a reason for hiding this comment

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

LGTM

Thanks very much for your contribution @luiguip

@matheusalcantarazup matheusalcantarazup merged commit f0df9f4 into ZupIT:main Feb 1, 2022
@iancardosozup
Copy link
Contributor

closes #963

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.

4 participants