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

Add support for containers.conf #2011

Closed
wants to merge 1 commit into from

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Dec 7, 2019

This is a rework of Qi Wang's patches.
Import package pkg/config from containers/common to read containers.conf
This patch allows users to specify default values stored in containers.conf
that will modify the behaviour of buildah tool.

Signed-off-by: Qi Wang qiwan@redhat.com
Signed-off-by: Daniel J Walsh dwalsh@redhat.com

Replaces #1953

@rhatdan rhatdan changed the title Add support for containers.conf [WIP] Add support for containers.conf Dec 7, 2019
@rhatdan rhatdan force-pushed the containers.conf branch 6 times, most recently from c0979b6 to 13ddc21 Compare December 13, 2019 10:40
@rh-atomic-bot
Copy link
Collaborator

☔ The latest upstream changes (presumably #2025) made this pull request unmergeable. Please resolve the merge conflicts.

@rh-atomic-bot
Copy link
Collaborator

☔ The latest upstream changes (presumably #2026) made this pull request unmergeable. Please resolve the merge conflicts.

@rhatdan rhatdan force-pushed the containers.conf branch 2 times, most recently from 566bcac to 23e44ee Compare December 17, 2019 16:08
@rh-atomic-bot
Copy link
Collaborator

☔ The latest upstream changes (presumably 6941254) made this pull request unmergeable. Please resolve the merge conflicts.

@@ -220,6 +226,45 @@ func GetFromAndBudFlags(flags *FromAndBudResults, usernsResults *UserNSResults,
return fs
}

func SetDefaultConfig(cmd *cobra.Command, defaultConfig *config.Config) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do not need the function SetDefaultConfig because gloabl option --containers-conf was removed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed

@rhatdan rhatdan changed the title [WIP] Add support for containers.conf Add support for containers.conf Jan 3, 2020
@rhatdan rhatdan force-pushed the containers.conf branch 4 times, most recently from d7fa14f to 7452459 Compare January 3, 2020 21:58
@rhatdan rhatdan changed the title Add support for containers.conf [WIP] Add support for containers.conf Jan 3, 2020
@@ -0,0 +1,368 @@
# The containers configuration file specifies all of the available configuration
Copy link
Member

Choose a reason for hiding this comment

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

This looks a bit hard to maintain and understand as some options are commented out while others are not but it's very hard to figure out which are actually used.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes maybe we should remove all of the commented out ones.

@@ -279,3 +281,32 @@ func CheckAuthFile(authfile string) error {
}
return nil
}

// GetCapabilities returns the capabilities added to container
func GetCapabilities(defaultCapabilities, addCapabilities, dropCapabilities []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.

s/GetCapabilities/Capabilities/ ... go conventionally doesn't use getter or setter identifiers.

Copy link
Member

Choose a reason for hiding this comment

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

Is this func a potential candidate for c/common ? I guess that's something libpod needs as well. Based on an earlier comment from @mheon in c/common I am on the lookout for code we could further consolidate in c/common.

@@ -424,3 +428,13 @@ Flags:
{{end}}
`
}

func getDefaultConfig() *config.Config {
Copy link
Member

Choose a reason for hiding this comment

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

s/getDefaultConfig/defaultConfig/

defaultConfig, err := config.NewConfig("")
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(1)
Copy link
Member

Choose a reason for hiding this comment

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

I prefer setting defaultConfig in the main.go as I think it's more idiomatic (non-blocking).

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@@ -20,7 +21,10 @@ import (
"github.com/spf13/pflag"
)

var needToShutdownStore = false
var (
defaultConfig = getDefaultConfig()
Copy link
Member

Choose a reason for hiding this comment

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

s/defaultConfig/defaultContainersConfig/ ? A comment would be nice for package-global variables.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@@ -0,0 +1,92 @@
#!/usr/bin/env bats
Copy link
Member

Choose a reason for hiding this comment

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

💯 for the tests!


@test "containers.conf selinux test" {
if ! which selinuxenabled > /dev/null 2> /dev/null ; then
skip "No selinuxenabled"
Copy link
Member

Choose a reason for hiding this comment

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

s/selinuxenabled/selinux enabled/

Copy link
Member Author

Choose a reason for hiding this comment

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

That is saying the selinuxenabled program does not exists. So it should stay as a single name. I will add "No selinuxenabled application"

@rhatdan rhatdan force-pushed the containers.conf branch 3 times, most recently from 6823a42 to c390a19 Compare January 8, 2020 18:05
@vrothberg
Copy link
Member

"not ok 214 containers.conf additional devices test" see https://travis-ci.org/containers/buildah/jobs/634359720#L1031

@vrothberg
Copy link
Member

vrothberg commented Jan 9, 2020

# ls: /dev/fuse1: No such file or directory
# [ rc=1 (** EXPECTED 0 **) ]
# #/vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# #| FAIL: exit code is 1; expected 0
# #\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

@rh-atomic-bot
Copy link
Collaborator

☔ The latest upstream changes (presumably 720e5d6) made this pull request unmergeable. Please resolve the merge conflicts.

@rhatdan
Copy link
Member Author

rhatdan commented Jan 14, 2020

@vrothberg Now that I have this testing, can I bump containers/common version so we can merge this?

@vrothberg
Copy link
Member

@vrothberg Now that I have this testing, can I bump containers/common version so we can merge this?

@rhatdan as long as we strictly follow semantic versioning, sure. Any breaking change would mean a major version bump.

@rhatdan
Copy link
Member Author

rhatdan commented Jan 14, 2020

Since we are still a version 0, I don't believe this is true. We are still working towards a stable release.

@vrothberg
Copy link
Member

vrothberg commented Jan 15, 2020 via email

This is a rework of Qi Wang's patches.
Import package pkg/config from containers/common to read containers.conf
This patch allows users to specify default values stored in containers.conf
that will modify the behaviour of buildah tool.

Signed-off-by: Qi Wang <qiwan@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
@rhatdan rhatdan changed the title [WIP] Add support for containers.conf Add support for containers.conf Jan 15, 2020
Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

LGTM (there are some older nits but those are non-blocking)

@vrothberg
Copy link
Member

Nice work, @QiWang19 and @rhatdan !

@TomSweeneyRedHat
Copy link
Member

LGTM.
I ran into some issues testing the changes with one of the baseline tests, but have convinced myself it's not due to this change. Most likely a system error.

@rhatdan
Copy link
Member Author

rhatdan commented Jan 15, 2020

@rh-atomic-bot r=TomSweeneyRedHat

@rh-atomic-bot
Copy link
Collaborator

📌 Commit 798ebd8 has been approved by TomSweeneyRedHat

@rh-atomic-bot
Copy link
Collaborator

⚡ Test exempted: pull fully rebased and already tested.

@nalind nalind mentioned this pull request Feb 17, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants