diff mbox

[v6,3/8] tests/docker/docker.py: check and run .pre script

Message ID 1468916208-18668-4-git-send-email-famz@redhat.com
State Superseded
Headers show

Commit Message

Fam Zheng July 19, 2016, 8:16 a.m. UTC
From: Alex Bennée <alex.bennee@linaro.org>


The docker script will now search for an associated $dockerfile.pre
script which gets run in the same build context as the dockerfile will
be. This is to support pre-seeding the build context before running the
docker build.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

Message-id: 1468335639-24582-4-git-send-email-alex.bennee@linaro.org
---
 tests/docker/docker.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

-- 
2.7.4

Comments

Alex Bennée July 19, 2016, 9:29 a.m. UTC | #1
Fam Zheng <famz@redhat.com> writes:

> From: Alex Bennée <alex.bennee@linaro.org>

>

> The docker script will now search for an associated $dockerfile.pre

> script which gets run in the same build context as the dockerfile will

> be. This is to support pre-seeding the build context before running the

> docker build.

>

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> Message-id: 1468335639-24582-4-git-send-email-alex.bennee@linaro.org

> ---

>  tests/docker/docker.py | 12 ++++++++++++

>  1 file changed, 12 insertions(+)

>

> diff --git a/tests/docker/docker.py b/tests/docker/docker.py

> index 96d906e..b61d934 100755

> --- a/tests/docker/docker.py

> +++ b/tests/docker/docker.py

> @@ -221,6 +221,18 @@ class BuildCommand(SubCommand):

>              # Create a docker context directory for the build

>              docker_dir = tempfile.mkdtemp(prefix="docker_build")

>

> +            # Is there a .pre file to run in the build context?

> +            docker_pre = os.path.splitext(args.dockerfile)[0]+".pre"

> +            if os.path.exists(docker_pre):

> +                rc = subprocess.call(os.path.realpath(docker_pre),

> +                                     cwd=docker_dir)

> +                if rc == 3:

> +                    print "Skip"

> +                    return 0

> +                else:

> +                    print "%s exited with code %d" % (docker_pre, rc)

> +                    return 1

> +


We need to let an exit of 0 through ;-)

>              # Do we include a extra binary?

>              if args.include_executable:

>                  _copy_binary_with_libs(args.include_executable,



--
Alex Bennée
diff mbox

Patch

diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index 96d906e..b61d934 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -221,6 +221,18 @@  class BuildCommand(SubCommand):
             # Create a docker context directory for the build
             docker_dir = tempfile.mkdtemp(prefix="docker_build")
 
+            # Is there a .pre file to run in the build context?
+            docker_pre = os.path.splitext(args.dockerfile)[0]+".pre"
+            if os.path.exists(docker_pre):
+                rc = subprocess.call(os.path.realpath(docker_pre),
+                                     cwd=docker_dir)
+                if rc == 3:
+                    print "Skip"
+                    return 0
+                else:
+                    print "%s exited with code %d" % (docker_pre, rc)
+                    return 1
+
             # Do we include a extra binary?
             if args.include_executable:
                 _copy_binary_with_libs(args.include_executable,