Skip to content

Commit

Permalink
try triggering ci again?
Browse files Browse the repository at this point in the history
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
  • Loading branch information
vsoch committed Jun 20, 2022
2 parents c8dc6fc + 986f0cb commit d0e7237
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
sparse ext3 overlay image.
- Support for `DOCKER_HOST` parsing when using `docker-daemon://`
- `DOCKER_USERNAME` and `DOCKER_PASSWORD` supported without `SINGULARITY_` prefix.
- The `--no-mount` flag now accepts the value `bind-paths` to disable mounting of
all `bind path` entries in `singularity.conf.

### Bug Fixes

Expand Down
2 changes: 1 addition & 1 deletion cmd/internal/cli/action_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ var actionNoMountFlag = cmdline.Flag{
Value: &NoMount,
DefaultValue: []string{},
Name: "no-mount",
Usage: "disable one or more 'mount xxx' options set in singularity.conf, specify absolute destination path to disable a 'bind path' entry",
Usage: "disable one or more 'mount xxx' options set in singularity.conf, specify absolute destination path to disable a bind path entry, or 'bind-paths' to disable all bind path entries.",
EnvKeys: []string{"NO_MOUNT"},
}

Expand Down
4 changes: 4 additions & 0 deletions cmd/internal/cli/actions_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,11 @@ func setNoMountFlags(c *singularityConfig.EngineConfig) {
c.SetNoHostfs(true)
case "cwd":
c.SetNoCwd(true)
// All bind path singularity.conf entries
case "bind-paths":
skipBinds = append(skipBinds, "*")
default:
// Single bind path singularity.conf entry by abs path
if filepath.IsAbs(v) {
skipBinds = append(skipBinds, v)
continue
Expand Down
17 changes: 17 additions & 0 deletions e2e/actions/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -2239,6 +2239,23 @@ func (c actionTests) actionNoMount(t *testing.T) {
testContained: true,
exit: 0,
},
// bind-paths should disable all of the bind path mounts - including both defaults
{
name: "binds-paths-hosts",
noMount: "bind-paths",
noMatch: "on /etc/hosts",
testDefault: true,
testContained: true,
exit: 0,
},
{
name: "bind-paths-localtime",
noMount: "bind-paths",
noMatch: "on /etc/localtime",
testDefault: true,
testContained: true,
exit: 0,
},
}

for _, tt := range tests {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ require (
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
gopkg.in/yaml.v2 v2.4.0
gotest.tools/v3 v3.2.0
gotest.tools/v3 v3.3.0
mvdan.cc/sh/v3 v3.5.1
oras.land/oras-go v1.2.0
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1869,8 +1869,8 @@ gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8=
gotest.tools/v3 v3.2.0 h1:I0DwBVMGAx26dttAj1BtJLAkVGncrkkUXfJLC4Flt/I=
gotest.tools/v3 v3.2.0/go.mod h1:Mcr9QNxkg0uMvy/YElmo4SpXgJKWgQvYrT7Kw5RzJ1A=
gotest.tools/v3 v3.3.0 h1:MfDY1b1/0xN1CyMlQDac0ziEy9zJQd9CXBRRDHw2jJo=
gotest.tools/v3 v3.3.0/go.mod h1:Mcr9QNxkg0uMvy/YElmo4SpXgJKWgQvYrT7Kw5RzJ1A=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
Expand Down
9 changes: 5 additions & 4 deletions internal/pkg/runtime/engine/singularity/container_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -1527,7 +1527,8 @@ func (c *container) addBindsMount(system *mount.System) error {
localtimePath = "/etc/localtime"
)

noBinds := c.engine.EngineConfig.GetNoBinds()
skipBinds := c.engine.EngineConfig.GetSkipBinds()
skipAllBinds := slice.ContainsString(skipBinds, "*")

if c.engine.EngineConfig.GetContain() {
hosts := hostsPath
Expand All @@ -1548,7 +1549,7 @@ func (c *container) addBindsMount(system *mount.System) error {
hosts, _ = c.session.GetPath(hostsPath)
}

if !slice.ContainsString(noBinds, hostsPath) {
if !skipAllBinds && !slice.ContainsString(skipBinds, hostsPath) {
// #5465 If hosts/localtime mount fails, it should not be fatal so skip-on-error
if err := system.Points.AddBind(mount.BindsTag, hosts, hostsPath, flags, "skip-on-error"); err != nil {
return fmt.Errorf("unable to add %s to mount list: %s", hosts, err)
Expand All @@ -1557,7 +1558,7 @@ func (c *container) addBindsMount(system *mount.System) error {
return fmt.Errorf("unable to add %s for remount: %s", hostsPath, err)
}
}
if !slice.ContainsString(noBinds, localtimePath) {
if !skipAllBinds && !slice.ContainsString(skipBinds, localtimePath) {
if err := system.Points.AddBind(mount.BindsTag, localtimePath, localtimePath, flags, "skip-on-error"); err != nil {
return fmt.Errorf("unable to add %s to mount list: %s", localtimePath, err)
}
Expand All @@ -1580,7 +1581,7 @@ func (c *container) addBindsMount(system *mount.System) error {

sylog.Verbosef("Found 'bind path' = %s, %s", src, dst)

if slice.ContainsString(noBinds, dst) {
if skipAllBinds || slice.ContainsString(skipBinds, dst) {
sylog.Debugf("Skipping bind to %s at user request", dst)
continue
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/runtime/engine/singularity/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ func (e *EngineConfig) SetSkipBinds(val []string) {
}

// GetSkipBinds gets bind paths to skip
func (e *EngineConfig) GetNoBinds() []string {
func (e *EngineConfig) GetSkipBinds() []string {
return e.JSON.SkipBinds
}

Expand Down

0 comments on commit d0e7237

Please sign in to comment.