mirror of
https://github.com/openshift/source-to-image.git
synced 2026-02-05 12:44:54 +01:00
Integrated all images' scripts into one common directory
This commit is contained in:
@@ -11,7 +11,16 @@ STI_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
# Go to the top of the tree.
|
||||
cd "${STI_ROOT}"
|
||||
|
||||
docker build -t sti_test/sti-fake test/integration/images/sti-fake
|
||||
docker build -t sti_test/sti-fake-broken test/integration/images/sti-fake-broken
|
||||
docker build -t sti_test/sti-fake-user test/integration/images/sti-fake-user
|
||||
docker build -t sti_test/sti-fake-with-scripts test/integration/images/sti-fake-with-scripts
|
||||
|
||||
function buildimage()
|
||||
{
|
||||
tag=$1
|
||||
src=$2
|
||||
cp -R test/integration/scripts $src
|
||||
docker build -t "${tag}" "${src}"
|
||||
rm -rf $src/scripts
|
||||
}
|
||||
|
||||
buildimage sti_test/sti-fake test/integration/images/sti-fake
|
||||
buildimage sti_test/sti-fake-user test/integration/images/sti-fake-user
|
||||
buildimage sti_test/sti-fake-with-scripts test/integration/images/sti-fake-with-scripts
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#
|
||||
# This is fake image used for testing STI. It tests running build as non-root user.
|
||||
#
|
||||
FROM sti_test/sti-fake
|
||||
|
||||
RUN mkdir -p /sti-fake && \
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
touch /sti-fake/run-invoked
|
||||
@@ -2,16 +2,18 @@
|
||||
# This is fake image used for testing STI. It tests scripts baked inside image.
|
||||
#
|
||||
FROM busybox
|
||||
RUN mkdir -p /sti-fake/src && mkdir -p /tmp/scripts
|
||||
|
||||
RUN mkdir -p /sti-fake/src && \
|
||||
mkdir -p /tmp/scripts && \
|
||||
# FIXME: The 'default' user has conflicting UID (1000). This should be fixed in
|
||||
# how source-to-image handles UID's during isolation.
|
||||
#
|
||||
RUN deluser default
|
||||
deluser default
|
||||
|
||||
WORKDIR /
|
||||
|
||||
ADD sti-helper /tmp/sti-helper
|
||||
ADD .sti/bin/ /tmp/scripts/
|
||||
ADD scripts/sti-helper /tmp/sti-helper
|
||||
ADD scripts/.sti/bin/ /tmp/scripts/
|
||||
|
||||
# Scripts are already in the image and this is their location
|
||||
ENV STI_SCRIPTS_URL image:///sti-fake/.sti/bin
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "No command specified, exiting. For details see https://github.com/openshift/source-to-image."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$1" != "run" -a "$1" != "save-artifacts" ]; then
|
||||
tar -C /tmp -xf -
|
||||
fi
|
||||
|
||||
exec /tmp/scripts/$1
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
cp -Rf /tmp/src /sti-fake/
|
||||
touch /sti-fake/assemble-invoked
|
||||
|
||||
if [ -e /tmp/artifacts/save-artifacts-invoked ]; then
|
||||
touch /sti-fake/save-artifacts-invoked
|
||||
fi
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
touch /tmp/src/save-artifacts-invoked
|
||||
|
||||
cd /tmp/src
|
||||
tar cf - .
|
||||
@@ -1,20 +1,23 @@
|
||||
#
|
||||
# This is basic fake image used for testing STI.
|
||||
#
|
||||
FROM busybox
|
||||
RUN mkdir -p /sti-fake/src
|
||||
|
||||
RUN mkdir -p /sti-fake/src && \
|
||||
# FIXME: The 'default' user has conflicting UID (1000). This should be fixed in
|
||||
# how source-to-image handles UID's during isolation.
|
||||
#
|
||||
RUN deluser default
|
||||
deluser default
|
||||
|
||||
WORKDIR /
|
||||
|
||||
ADD sti-helper /tmp/sti-helper
|
||||
|
||||
ADD scripts/sti-helper /tmp/sti-helper
|
||||
|
||||
# Need to serve the scripts from localhost so any potential changes to the
|
||||
# scripts are made available for integration testing.
|
||||
#
|
||||
# Port 23456 must match the port used in the http server in STI's
|
||||
# integration_test.go
|
||||
ENV STI_SCRIPTS_URL http://127.0.0.1:23456/sti-fake/.sti/bin
|
||||
ENV STI_SCRIPTS_URL http://127.0.0.1:23456/.sti/bin
|
||||
|
||||
CMD ["/tmp/sti-helper"]
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
sti-fake
|
||||
========
|
||||
@@ -63,8 +63,8 @@ func (i *integrationTest) setup() {
|
||||
// get the full path to this .go file so we can construct the file url
|
||||
// using this file's dirname
|
||||
_, filename, _, _ := runtime.Caller(0)
|
||||
testImagesDir := path.Join(path.Dir(filename), "images")
|
||||
FakeScriptsFileUrl = "file://" + path.Join(testImagesDir, "sti-fake", ".sti", "bin")
|
||||
testImagesDir := path.Join(path.Dir(filename), "scripts")
|
||||
FakeScriptsFileUrl = "file://" + path.Join(testImagesDir, ".sti", "bin")
|
||||
|
||||
for _, image := range []string{TagCleanBuild, TagCleanBuildUser, TagIncrementalBuild, TagIncrementalBuildUser} {
|
||||
i.dockerClient.RemoveImage(image)
|
||||
|
||||
Reference in New Issue
Block a user