mirror of
https://github.com/openshift/source-to-image.git
synced 2026-02-05 12:44:54 +01:00
ensure created directories are readable/executable
bug 1467819 https://bugzilla.redhat.com/show_bug.cgi?id=1467819 add test repo for overriding scripts
This commit is contained in:
@@ -115,7 +115,7 @@ grep "Copying sources" "${WORK_DIR}/s2i-non-repo.log"
|
|||||||
check_result $? "${WORK_DIR}/s2i-non-repo.log"
|
check_result $? "${WORK_DIR}/s2i-non-repo.log"
|
||||||
|
|
||||||
test_debug "s2i rebuild"
|
test_debug "s2i rebuild"
|
||||||
s2i build https://github.com/openshift/sti-php.git --context-dir=5.5/test/test-app registry.access.redhat.com/openshift3/php-55-rhel7 rack-test-app --incremental=true --loglevel=5 &> "${WORK_DIR}/s2i-pre-rebuild.log"
|
s2i build https://github.com/sclorg/s2i-php-container.git --context-dir=5.5/test/test-app registry.access.redhat.com/openshift3/php-55-rhel7 rack-test-app --incremental=true --loglevel=5 &> "${WORK_DIR}/s2i-pre-rebuild.log"
|
||||||
check_result $? "${WORK_DIR}/s2i-pre-rebuild.log"
|
check_result $? "${WORK_DIR}/s2i-pre-rebuild.log"
|
||||||
s2i rebuild rack-test-app:latest rack-test-app:v1 -p never --loglevel=5 &> "${WORK_DIR}/s2i-rebuild.log"
|
s2i rebuild rack-test-app:latest rack-test-app:v1 -p never --loglevel=5 &> "${WORK_DIR}/s2i-rebuild.log"
|
||||||
check_result $? "${WORK_DIR}/s2i-rebuild.log"
|
check_result $? "${WORK_DIR}/s2i-rebuild.log"
|
||||||
@@ -127,9 +127,16 @@ check_result $? ""
|
|||||||
grep "Sample invocation" "${WORK_DIR}/s2i-usage.log"
|
grep "Sample invocation" "${WORK_DIR}/s2i-usage.log"
|
||||||
check_result $? "${WORK_DIR}/s2i-usage.log"
|
check_result $? "${WORK_DIR}/s2i-usage.log"
|
||||||
|
|
||||||
test_debug "s2i build with git proto"
|
test_debug "s2i build with overriding assemble/run scripts"
|
||||||
|
s2i build https://github.com/openshift/source-to-image openshift/php-55-centos7 test --context-dir=test_apprepo >& "${WORK_DIR}/s2i-override-build.log"
|
||||||
|
grep "Running custom assemble" "${WORK_DIR}/s2i-override-build.log"
|
||||||
|
check_result $? "${WORK_DIR}/s2i-override-build.log"
|
||||||
|
docker run test >& "${WORK_DIR}/s2i-override-run.log"
|
||||||
|
grep "Running custom run" "${WORK_DIR}/s2i-override-run.log"
|
||||||
|
check_result $? "${WORK_DIR}/s2i-override-run.log"
|
||||||
|
|
||||||
s2i build https://github.com/openshift/cakephp-ex openshift/php-55-centos7 test --run=true --loglevel=5 &> "${WORK_DIR}/s2i-git-proto.log" &
|
test_debug "s2i build with remote git repo"
|
||||||
|
s2i build https://github.com/openshift/cakephp-ex openshift/php-55-centos7 test --loglevel=5 &> "${WORK_DIR}/s2i-git-proto.log"
|
||||||
check_result $? "${WORK_DIR}/s2i-git-proto.log"
|
check_result $? "${WORK_DIR}/s2i-git-proto.log"
|
||||||
|
|
||||||
test_debug "s2i build with --run==true option"
|
test_debug "s2i build with --run==true option"
|
||||||
|
|||||||
@@ -339,7 +339,7 @@ func (builder *STI) Prepare(config *api.Config) error {
|
|||||||
|
|
||||||
// Setup working directories
|
// Setup working directories
|
||||||
for _, v := range workingDirs {
|
for _, v := range workingDirs {
|
||||||
if err = builder.fs.MkdirAll(filepath.Join(config.WorkingDir, v)); err != nil {
|
if err = builder.fs.MkdirAllWithPermissions(filepath.Join(config.WorkingDir, v), 0755); err != nil {
|
||||||
builder.result.BuildInfo.FailureReason = utilstatus.NewFailureReason(
|
builder.result.BuildInfo.FailureReason = utilstatus.NewFailureReason(
|
||||||
utilstatus.ReasonFSOperationFailed,
|
utilstatus.ReasonFSOperationFailed,
|
||||||
utilstatus.ReasonMessageFSOperationFailed,
|
utilstatus.ReasonMessageFSOperationFailed,
|
||||||
|
|||||||
@@ -106,6 +106,12 @@ func (f *FakeFileSystem) MkdirAll(dirname string) error {
|
|||||||
return f.MkdirAllError
|
return f.MkdirAllError
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MkdirAllWithPermissions creates a new directories on the fake filesystem
|
||||||
|
func (f *FakeFileSystem) MkdirAllWithPermissions(dirname string, perm os.FileMode) error {
|
||||||
|
f.MkdirAllDir = append(f.MkdirAllDir, dirname)
|
||||||
|
return f.MkdirAllError
|
||||||
|
}
|
||||||
|
|
||||||
// Mkdir creates a new directory on the fake filesystem
|
// Mkdir creates a new directory on the fake filesystem
|
||||||
func (f *FakeFileSystem) Mkdir(dirname string) error {
|
func (f *FakeFileSystem) Mkdir(dirname string) error {
|
||||||
f.MkdirDir = dirname
|
f.MkdirDir = dirname
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ type FileSystem interface {
|
|||||||
Chmod(file string, mode os.FileMode) error
|
Chmod(file string, mode os.FileMode) error
|
||||||
Rename(from, to string) error
|
Rename(from, to string) error
|
||||||
MkdirAll(dirname string) error
|
MkdirAll(dirname string) error
|
||||||
|
MkdirAllWithPermissions(dirname string, perm os.FileMode) error
|
||||||
Mkdir(dirname string) error
|
Mkdir(dirname string) error
|
||||||
Exists(file string) bool
|
Exists(file string) bool
|
||||||
Copy(sourcePath, targetPath string) error
|
Copy(sourcePath, targetPath string) error
|
||||||
@@ -149,6 +150,11 @@ func (h *fs) MkdirAll(dirname string) error {
|
|||||||
return os.MkdirAll(dirname, 0700)
|
return os.MkdirAll(dirname, 0700)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MkdirAllWithPermissions creates the directory and all its parents with the provided permissions
|
||||||
|
func (h *fs) MkdirAllWithPermissions(dirname string, perm os.FileMode) error {
|
||||||
|
return os.MkdirAll(dirname, perm)
|
||||||
|
}
|
||||||
|
|
||||||
// Mkdir creates the specified directory
|
// Mkdir creates the specified directory
|
||||||
func (h *fs) Mkdir(dirname string) error {
|
func (h *fs) Mkdir(dirname string) error {
|
||||||
return os.Mkdir(dirname, 0700)
|
return os.Mkdir(dirname, 0700)
|
||||||
|
|||||||
4
test_apprepo/.s2i/bin/assemble
Executable file
4
test_apprepo/.s2i/bin/assemble
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo "Running custom assemble"
|
||||||
|
|
||||||
4
test_apprepo/.s2i/bin/run
Executable file
4
test_apprepo/.s2i/bin/run
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Running custom run"
|
||||||
|
|
||||||
Reference in New Issue
Block a user