-
Notifications
You must be signed in to change notification settings - Fork 453
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding user namespaces tests for covering the `UsernamespaceMode` supported by the CRI. Fixes #1348 Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
- Loading branch information
1 parent
8463eae
commit a662a96
Showing
8 changed files
with
255 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ on: | |
- "*" | ||
branches: | ||
- master | ||
pull_request: | ||
#pull_request: | ||
jobs: | ||
images: | ||
runs-on: ubuntu-latest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ on: | |
- "*" | ||
branches: | ||
- master | ||
pull_request: | ||
#pull_request: | ||
jobs: | ||
# | ||
# Run CRI tests against CRI-O | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ on: | |
- "*" | ||
branches: | ||
- master | ||
pull_request: | ||
#pull_request: | ||
jobs: | ||
test-e2e: | ||
name: ${{ matrix.os }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"strings" | ||
) | ||
|
||
func main() { | ||
path := os.Args[1] | ||
fmt.Printf("Using path: %v\n", path) | ||
if err := traversePath(path); err != nil { | ||
panic(err) | ||
} | ||
} | ||
|
||
func traversePath(tPath string) error { | ||
tempBase := os.TempDir() | ||
if !strings.HasPrefix(tPath, tempBase) { | ||
return fmt.Errorf("traversePath: %q is not a descendant of %q", tPath, tempBase) | ||
} | ||
|
||
var path string | ||
for _, p := range strings.SplitAfter(tPath, "/") { | ||
path = path + p | ||
stats, err := os.Stat(path) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
perm := stats.Mode().Perm() | ||
if perm&0o5 == 0o5 { | ||
continue | ||
} | ||
if strings.HasPrefix(tempBase, path) { | ||
return fmt.Errorf("traversePath: directory %q MUST have read+exec permissions for others", path) | ||
} | ||
|
||
if err := os.Chmod(path, perm|0o755); err != nil { | ||
return err | ||
} | ||
} | ||
|
||
return nil | ||
} |