travis2docker 6.4.28__tar.gz → 7.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {travis2docker-6.4.28 → travis2docker-7.0.0}/.bumpversion.cfg +1 -1
- {travis2docker-6.4.28 → travis2docker-7.0.0}/MANIFEST.in +0 -1
- {travis2docker-6.4.28 → travis2docker-7.0.0}/PKG-INFO +16 -30
- {travis2docker-6.4.28 → travis2docker-7.0.0}/README.rst +9 -22
- {travis2docker-6.4.28 → travis2docker-7.0.0}/docs/conf.py +1 -1
- travis2docker-7.0.0/requirements.txt +1 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/setup.cfg +0 -3
- {travis2docker-6.4.28 → travis2docker-7.0.0}/setup.py +10 -9
- travis2docker-7.0.0/src/travis2docker/__init__.py +1 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/src/travis2docker/cli.py +55 -63
- {travis2docker-6.4.28 → travis2docker-7.0.0}/src/travis2docker/docker_helper/build.py +6 -6
- {travis2docker-6.4.28 → travis2docker-7.0.0}/src/travis2docker/git_run.py +14 -14
- travis2docker-7.0.0/src/travis2docker/travis2docker.py +162 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/src/travis2docker.egg-info/PKG-INFO +16 -30
- {travis2docker-6.4.28 → travis2docker-7.0.0}/src/travis2docker.egg-info/SOURCES.txt +0 -16
- travis2docker-7.0.0/src/travis2docker.egg-info/requires.txt +1 -0
- travis2docker-7.0.0/tests/test_travis2docker.py +170 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/tox.ini +3 -4
- travis2docker-6.4.28/examples/example_1.yml +0 -22
- travis2docker-6.4.28/examples/example_2.yml +0 -30
- travis2docker-6.4.28/examples/example_3.yml +0 -37
- travis2docker-6.4.28/examples/example_4.yml +0 -41
- travis2docker-6.4.28/examples/example_5.yml +0 -42
- travis2docker-6.4.28/requirements.txt +0 -4
- travis2docker-6.4.28/src/travis2docker/__init__.py +0 -1
- travis2docker-6.4.28/src/travis2docker/templates/Dockerfile +0 -89
- travis2docker-6.4.28/src/travis2docker/templates/entrypoint.sh +0 -10
- travis2docker-6.4.28/src/travis2docker/templates/rvm_env.sh +0 -18
- travis2docker-6.4.28/src/travis2docker/travis-ci-apt-source-whitelist/.git +0 -1
- travis2docker-6.4.28/src/travis2docker/travis-ci-apt-source-whitelist/.gitignore +0 -34
- travis2docker-6.4.28/src/travis2docker/travis-ci-apt-source-whitelist/.travis.yml +0 -10
- travis2docker-6.4.28/src/travis2docker/travis-ci-apt-source-whitelist/LICENSE +0 -22
- travis2docker-6.4.28/src/travis2docker/travis-ci-apt-source-whitelist/README.md +0 -15
- travis2docker-6.4.28/src/travis2docker/travis-ci-apt-source-whitelist/add_all.rb +0 -16
- travis2docker-6.4.28/src/travis2docker/travis-ci-apt-source-whitelist/bin/travis-add-source +0 -47
- travis2docker-6.4.28/src/travis2docker/travis-ci-apt-source-whitelist/ubuntu.json +0 -317
- travis2docker-6.4.28/src/travis2docker/travis2docker.py +0 -416
- travis2docker-6.4.28/src/travis2docker.egg-info/requires.txt +0 -8
- travis2docker-6.4.28/tests/test_travis2docker.py +0 -156
- {travis2docker-6.4.28 → travis2docker-7.0.0}/.coveragerc +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/AUTHORS.rst +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/CHANGELOG.rst +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/CONTRIBUTING.rst +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/LICENSE +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/docs/authors.rst +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/docs/changelog.rst +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/docs/contributing.rst +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/docs/index.rst +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/docs/installation.rst +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/docs/readme.rst +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/docs/reference/index.rst +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/docs/reference/travis2docker.rst +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/docs/requirements.txt +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/docs/spelling_wordlist.txt +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/docs/usage.rst +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/src/travis2docker/__main__.py +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/src/travis2docker/exceptions.py +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/src/travis2docker/templates/.coveragerc +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/src/travis2docker/templates/.vscode/extensions.json +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/src/travis2docker/templates/.vscode/launch.json +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/src/travis2docker/templates/.vscode/settings.json +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/src/travis2docker/templates/10-build.sh +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/src/travis2docker/templates/20-run.sh +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/src/travis2docker/templates/Dockerfile_deployv +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/src/travis2docker/templates/build.sh +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/src/travis2docker/templates/entrypoint_deployv.sh +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/src/travis2docker.egg-info/dependency_links.txt +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/src/travis2docker.egg-info/entry_points.txt +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/src/travis2docker.egg-info/not-zip-safe +0 -0
- {travis2docker-6.4.28 → travis2docker-7.0.0}/src/travis2docker.egg-info/top_level.txt +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: travis2docker
|
|
3
|
-
Version:
|
|
4
|
-
Summary: Script to generate Dockerfile from
|
|
3
|
+
Version: 7.0.0
|
|
4
|
+
Summary: Script to generate a development Dockerfile from the deployv image of a repository
|
|
5
5
|
Home-page: https://github.com/vauxoo/travis2docker
|
|
6
6
|
Author: Vauxoo
|
|
7
7
|
Author-email: info@vauxoo.com
|
|
@@ -13,22 +13,20 @@ Classifier: Operating System :: POSIX
|
|
|
13
13
|
Classifier: Operating System :: Microsoft :: Windows
|
|
14
14
|
Classifier: Programming Language :: Python
|
|
15
15
|
Classifier: Programming Language :: Python :: 3
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
18
16
|
Classifier: Programming Language :: Python :: 3.10
|
|
19
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
21
19
|
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
22
22
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
23
23
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
24
24
|
Classifier: Topic :: Utilities
|
|
25
|
+
Requires-Python: >=3.10
|
|
25
26
|
Description-Content-Type: text/x-rst
|
|
26
27
|
License-File: LICENSE
|
|
27
28
|
License-File: AUTHORS.rst
|
|
28
|
-
Requires-Dist:
|
|
29
|
-
Requires-Dist: PyYAML==6.0.*; python_version >= "3.7"
|
|
30
|
-
Requires-Dist: Jinja2==2.11.3; python_version < "3.7"
|
|
31
|
-
Requires-Dist: Jinja2==3.1.*; python_version >= "3.7"
|
|
29
|
+
Requires-Dist: Jinja2==3.1.*
|
|
32
30
|
Dynamic: author
|
|
33
31
|
Dynamic: author-email
|
|
34
32
|
Dynamic: classifier
|
|
@@ -38,6 +36,7 @@ Dynamic: home-page
|
|
|
38
36
|
Dynamic: license
|
|
39
37
|
Dynamic: license-file
|
|
40
38
|
Dynamic: requires-dist
|
|
39
|
+
Dynamic: requires-python
|
|
41
40
|
Dynamic: summary
|
|
42
41
|
|
|
43
42
|
========
|
|
@@ -46,7 +45,7 @@ Overview
|
|
|
46
45
|
|
|
47
46
|
|
|
48
47
|
|
|
49
|
-
Script to generate Dockerfile from .
|
|
48
|
+
Script to generate a development Dockerfile from the deployv image of a repository (based on its ``variables.sh`` file)
|
|
50
49
|
|
|
51
50
|
* Free software: BSD license
|
|
52
51
|
|
|
@@ -74,19 +73,19 @@ Example:
|
|
|
74
73
|
`travisfile2dockerfile --root-path=$HOME/t2d git@github.com:Vauxoo/forecast.git 8.0`
|
|
75
74
|
|
|
76
75
|
The output is:
|
|
77
|
-
`${HOME}/t2d/script/git_github.com_Vauxoo_forecast.git/8.0
|
|
78
|
-
`${HOME}/t2d/script/git_github.com_Vauxoo_forecast.git/8.0/2`
|
|
79
|
-
|
|
80
|
-
The first one is the build for env `TESTS=1`, the second one is for env with `LINT_CHECK=1`
|
|
76
|
+
`${HOME}/t2d/script/git_github.com_Vauxoo_forecast.git/8.0`
|
|
81
77
|
|
|
82
78
|
To build image:
|
|
83
|
-
`${HOME}/t2d/script/git_github.com_Vauxoo_forecast.git/8.0/
|
|
79
|
+
`${HOME}/t2d/script/git_github.com_Vauxoo_forecast.git/8.0/10-build.sh`
|
|
84
80
|
|
|
85
81
|
To create container:
|
|
86
|
-
`${HOME}/t2d/script/git_github.com_Vauxoo_forecast.git/8.0/
|
|
82
|
+
`${HOME}/t2d/script/git_github.com_Vauxoo_forecast.git/8.0/20-run.sh --entrypoint=bash`
|
|
87
83
|
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
The repository needs a ``variables.sh`` file in its root path (the one used by
|
|
85
|
+
the deployv images built from the CI). By default the docker image is built
|
|
86
|
+
from its values as ``DOCKER_IMAGE_REPO:MAIN_APP-VERSION-SHA_SHORT``; use
|
|
87
|
+
``--docker-image=quay.io/vauxoo/PROJECT:TAG`` to pick the image pushed by the
|
|
88
|
+
``build_docker`` pipeline instead.
|
|
90
89
|
|
|
91
90
|
Optional tools (``--build-env-args``)
|
|
92
91
|
=====================================
|
|
@@ -145,19 +144,6 @@ Dockerfile doesn't support a prompt to enter your password, so you need to remov
|
|
|
145
144
|
openssl rsa -in ${fname} -out ${fname}_without_pwd
|
|
146
145
|
cp ${fname}_without_pwd ${fname}
|
|
147
146
|
|
|
148
|
-
Download the big image
|
|
149
|
-
**********************
|
|
150
|
-
|
|
151
|
-
Travis2docker uses a default image with many packages pre-installed.
|
|
152
|
-
|
|
153
|
-
`docker pull vauxoo/odoo-80-image-shippable-auto`
|
|
154
|
-
|
|
155
|
-
Note: You can define a custom image to use with `--docker-image` parameter.
|
|
156
|
-
|
|
157
|
-
For example if you want use the original image of travis you can add the following parameters:
|
|
158
|
-
|
|
159
|
-
`--docker-image=quay.io/travisci/travis-python --docker-user=travis`
|
|
160
|
-
|
|
161
147
|
Install docker
|
|
162
148
|
**************
|
|
163
149
|
|
|
@@ -53,7 +53,7 @@ Overview
|
|
|
53
53
|
|
|
54
54
|
.. end-badges
|
|
55
55
|
|
|
56
|
-
Script to generate Dockerfile from .
|
|
56
|
+
Script to generate a development Dockerfile from the deployv image of a repository (based on its ``variables.sh`` file)
|
|
57
57
|
|
|
58
58
|
* Free software: BSD license
|
|
59
59
|
|
|
@@ -81,19 +81,19 @@ Example:
|
|
|
81
81
|
`travisfile2dockerfile --root-path=$HOME/t2d git@github.com:Vauxoo/forecast.git 8.0`
|
|
82
82
|
|
|
83
83
|
The output is:
|
|
84
|
-
`${HOME}/t2d/script/git_github.com_Vauxoo_forecast.git/8.0
|
|
85
|
-
`${HOME}/t2d/script/git_github.com_Vauxoo_forecast.git/8.0/2`
|
|
86
|
-
|
|
87
|
-
The first one is the build for env `TESTS=1`, the second one is for env with `LINT_CHECK=1`
|
|
84
|
+
`${HOME}/t2d/script/git_github.com_Vauxoo_forecast.git/8.0`
|
|
88
85
|
|
|
89
86
|
To build image:
|
|
90
|
-
`${HOME}/t2d/script/git_github.com_Vauxoo_forecast.git/8.0/
|
|
87
|
+
`${HOME}/t2d/script/git_github.com_Vauxoo_forecast.git/8.0/10-build.sh`
|
|
91
88
|
|
|
92
89
|
To create container:
|
|
93
|
-
`${HOME}/t2d/script/git_github.com_Vauxoo_forecast.git/8.0/
|
|
90
|
+
`${HOME}/t2d/script/git_github.com_Vauxoo_forecast.git/8.0/20-run.sh --entrypoint=bash`
|
|
94
91
|
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
The repository needs a ``variables.sh`` file in its root path (the one used by
|
|
93
|
+
the deployv images built from the CI). By default the docker image is built
|
|
94
|
+
from its values as ``DOCKER_IMAGE_REPO:MAIN_APP-VERSION-SHA_SHORT``; use
|
|
95
|
+
``--docker-image=quay.io/vauxoo/PROJECT:TAG`` to pick the image pushed by the
|
|
96
|
+
``build_docker`` pipeline instead.
|
|
97
97
|
|
|
98
98
|
Optional tools (``--build-env-args``)
|
|
99
99
|
=====================================
|
|
@@ -152,19 +152,6 @@ Dockerfile doesn't support a prompt to enter your password, so you need to remov
|
|
|
152
152
|
openssl rsa -in ${fname} -out ${fname}_without_pwd
|
|
153
153
|
cp ${fname}_without_pwd ${fname}
|
|
154
154
|
|
|
155
|
-
Download the big image
|
|
156
|
-
**********************
|
|
157
|
-
|
|
158
|
-
Travis2docker uses a default image with many packages pre-installed.
|
|
159
|
-
|
|
160
|
-
`docker pull vauxoo/odoo-80-image-shippable-auto`
|
|
161
|
-
|
|
162
|
-
Note: You can define a custom image to use with `--docker-image` parameter.
|
|
163
|
-
|
|
164
|
-
For example if you want use the original image of travis you can add the following parameters:
|
|
165
|
-
|
|
166
|
-
`--docker-image=quay.io/travisci/travis-python --docker-user=travis`
|
|
167
|
-
|
|
168
155
|
Install docker
|
|
169
156
|
**************
|
|
170
157
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Jinja2==3.1.*
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
|
|
3
|
+
import pathlib
|
|
3
4
|
import re
|
|
4
5
|
from glob import glob
|
|
5
|
-
from os.path import basename, dirname, join, splitext
|
|
6
6
|
|
|
7
7
|
from setuptools import find_packages, setup
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
def read(*names, **kwargs):
|
|
11
|
-
return
|
|
11
|
+
return pathlib.Path(__file__).parent.joinpath(*names).read_text(encoding=kwargs.get("encoding", "utf8"))
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
setup(
|
|
15
15
|
name="travis2docker",
|
|
16
|
-
version="
|
|
16
|
+
version="7.0.0",
|
|
17
17
|
license="BSD-3-Clause",
|
|
18
|
-
description="Script to generate Dockerfile from
|
|
18
|
+
description="Script to generate a development Dockerfile from the deployv image of a repository",
|
|
19
19
|
long_description="%s\n%s"
|
|
20
20
|
% (
|
|
21
|
-
re.compile("^.. start-badges.*^.. end-badges", re.
|
|
22
|
-
re.sub(":[a-z]+:`~?(.*?)`", r"``\1``", read("CHANGELOG.rst")),
|
|
21
|
+
re.compile(r"^.. start-badges.*^.. end-badges", re.MULTILINE | re.DOTALL).sub("", read("README.rst")),
|
|
22
|
+
re.sub(r":[a-z]+:`~?(.*?)`", r"``\1``", read("CHANGELOG.rst")),
|
|
23
23
|
),
|
|
24
24
|
long_description_content_type="text/x-rst",
|
|
25
25
|
author="Vauxoo",
|
|
@@ -27,7 +27,7 @@ setup(
|
|
|
27
27
|
url="https://github.com/vauxoo/travis2docker",
|
|
28
28
|
packages=find_packages("src"),
|
|
29
29
|
package_dir={"": "src"},
|
|
30
|
-
py_modules=[
|
|
30
|
+
py_modules=[pathlib.Path(path).stem for path in glob("src/*.py")],
|
|
31
31
|
include_package_data=True,
|
|
32
32
|
zip_safe=False,
|
|
33
33
|
classifiers=[
|
|
@@ -39,12 +39,12 @@ setup(
|
|
|
39
39
|
"Operating System :: Microsoft :: Windows",
|
|
40
40
|
"Programming Language :: Python",
|
|
41
41
|
"Programming Language :: Python :: 3",
|
|
42
|
-
"Programming Language :: Python :: 3.8",
|
|
43
|
-
"Programming Language :: Python :: 3.9",
|
|
44
42
|
"Programming Language :: Python :: 3.10",
|
|
45
43
|
"Programming Language :: Python :: 3.11",
|
|
46
44
|
"Programming Language :: Python :: 3.12",
|
|
47
45
|
"Programming Language :: Python :: 3.13",
|
|
46
|
+
"Programming Language :: Python :: 3.14",
|
|
47
|
+
"Programming Language :: Python :: 3.15",
|
|
48
48
|
"Programming Language :: Python :: Implementation :: CPython",
|
|
49
49
|
"Programming Language :: Python :: Implementation :: PyPy",
|
|
50
50
|
# uncomment if you test on these interpreters:
|
|
@@ -56,6 +56,7 @@ setup(
|
|
|
56
56
|
keywords=[
|
|
57
57
|
# eg: 'keyword1', 'keyword2', 'keyword3',
|
|
58
58
|
],
|
|
59
|
+
python_requires=">=3.10",
|
|
59
60
|
install_requires=read("requirements.txt").split("\n"),
|
|
60
61
|
extras_require={
|
|
61
62
|
# eg:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "7.0.0"
|
|
@@ -15,7 +15,7 @@ Why does this file exist, and why not put this in __main__?
|
|
|
15
15
|
|
|
16
16
|
import argparse
|
|
17
17
|
import os
|
|
18
|
-
|
|
18
|
+
import pathlib
|
|
19
19
|
from sys import stdout
|
|
20
20
|
|
|
21
21
|
from . import __version__
|
|
@@ -24,12 +24,20 @@ from .git_run import GitRun
|
|
|
24
24
|
from .travis2docker import Travis2Docker
|
|
25
25
|
|
|
26
26
|
|
|
27
|
+
def variables_sh_read(variables_sh_path):
|
|
28
|
+
variables_sh_path = pathlib.Path(variables_sh_path).expanduser()
|
|
29
|
+
if variables_sh_path.is_dir():
|
|
30
|
+
variables_sh_path /= "variables.sh"
|
|
31
|
+
if not variables_sh_path.is_file():
|
|
32
|
+
return None
|
|
33
|
+
return variables_sh_path.read_text()
|
|
34
|
+
|
|
35
|
+
|
|
27
36
|
def get_git_data(project, path, revision):
|
|
28
37
|
git_obj = GitRun(project, path, path_prefix_repo=True)
|
|
29
38
|
git_obj.update()
|
|
30
39
|
data = {
|
|
31
40
|
"sha": git_obj.get_sha(revision),
|
|
32
|
-
"content": git_obj.show_file(".travis.yml", revision) or git_obj.show_file(".t2d.yml", revision),
|
|
33
41
|
"variables_sh": git_obj.show_file("variables.sh", revision),
|
|
34
42
|
"repo_owner": git_obj.owner,
|
|
35
43
|
"repo_project": git_obj.repo,
|
|
@@ -41,28 +49,13 @@ def get_git_data(project, path, revision):
|
|
|
41
49
|
return data
|
|
42
50
|
|
|
43
51
|
|
|
44
|
-
def yml_read(yml_path):
|
|
45
|
-
yml_path_expanded = expandvars(expanduser(yml_path))
|
|
46
|
-
alt_yml_path_expanded = None
|
|
47
|
-
if isdir(yml_path_expanded):
|
|
48
|
-
yml_path_expanded = join(yml_path_expanded, ".travis.yml")
|
|
49
|
-
alt_yml_path_expanded = join(yml_path_expanded, ".t2d.yml")
|
|
50
|
-
if not isfile(yml_path_expanded):
|
|
51
|
-
if alt_yml_path_expanded and isfile(alt_yml_path_expanded):
|
|
52
|
-
yml_path_expanded = alt_yml_path_expanded
|
|
53
|
-
else:
|
|
54
|
-
return
|
|
55
|
-
with open(yml_path_expanded) as f_yml:
|
|
56
|
-
return f_yml.read()
|
|
57
|
-
|
|
58
|
-
|
|
59
52
|
def main(return_result=False):
|
|
60
53
|
parser = argparse.ArgumentParser()
|
|
61
54
|
parser.add_argument(
|
|
62
55
|
"git_repo_url",
|
|
63
56
|
help="Specify repository git of work."
|
|
64
57
|
"\nThis is used to clone it "
|
|
65
|
-
"and get
|
|
58
|
+
"and get the variables.sh file of the deployv image"
|
|
66
59
|
"\nIf your repository is private, "
|
|
67
60
|
"don't use https url, "
|
|
68
61
|
"use ssh url",
|
|
@@ -78,21 +71,19 @@ def main(return_result=False):
|
|
|
78
71
|
parser.add_argument(
|
|
79
72
|
"--docker-user",
|
|
80
73
|
dest="docker_user",
|
|
81
|
-
help="User of work into Dockerfile
|
|
74
|
+
help="User of work into Dockerfile.\nBased on your docker image.\nDefault: odoo",
|
|
82
75
|
)
|
|
83
76
|
parser.add_argument(
|
|
84
77
|
"--docker-image",
|
|
85
78
|
dest="default_docker_image",
|
|
86
79
|
help="Docker image to use by default in Dockerfile."
|
|
87
|
-
"\
|
|
88
|
-
"
|
|
89
|
-
"in .travis.yml"
|
|
90
|
-
"\nDefault: 'vauxoo/odoo-80-image-shippable-auto'",
|
|
80
|
+
"\nDefault: built from variables.sh as "
|
|
81
|
+
"'DOCKER_IMAGE_REPO:MAIN_APP-VERSION-SHA_SHORT'",
|
|
91
82
|
)
|
|
92
83
|
default_root_path = os.environ.get("TRAVIS2DOCKER_ROOT_PATH")
|
|
93
84
|
if not default_root_path:
|
|
94
|
-
default_root_path =
|
|
95
|
-
default_root_path =
|
|
85
|
+
default_root_path = pathlib.Path("~").expanduser()
|
|
86
|
+
default_root_path = str(pathlib.Path(default_root_path) / ".t2d")
|
|
96
87
|
parser.add_argument(
|
|
97
88
|
"--root-path",
|
|
98
89
|
dest="root_path",
|
|
@@ -102,14 +93,14 @@ def main(return_result=False):
|
|
|
102
93
|
parser.add_argument(
|
|
103
94
|
"--add-remote",
|
|
104
95
|
dest="remotes",
|
|
105
|
-
help="Add git remote to git of build path, separated by a comma
|
|
96
|
+
help="Add git remote to git of build path, separated by a comma.\nUse remote name. E.g. 'Vauxoo,moylop260'",
|
|
106
97
|
)
|
|
107
98
|
parser.add_argument(
|
|
108
99
|
"--exclude-after-success",
|
|
109
100
|
dest="exclude_after_success",
|
|
110
101
|
action="store_true",
|
|
111
102
|
default=False,
|
|
112
|
-
help="
|
|
103
|
+
help="Deprecated. Ignored: the travis_after_success section does not exist anymore",
|
|
113
104
|
)
|
|
114
105
|
parser.add_argument(
|
|
115
106
|
"--run-extra-args",
|
|
@@ -137,20 +128,27 @@ def main(return_result=False):
|
|
|
137
128
|
dest="build_extra_cmds",
|
|
138
129
|
nargs="*",
|
|
139
130
|
default="",
|
|
140
|
-
help='Extra commands to run after "build" script.
|
|
131
|
+
help='Extra commands to run after "build" script. Note: You can use \\$IMAGE escaped environment variable.',
|
|
141
132
|
)
|
|
142
133
|
parser.add_argument(
|
|
143
134
|
"--travis-yml-path",
|
|
144
135
|
dest="travis_yml_path",
|
|
145
|
-
help="Optional path of file .travis.yml to use.\n" "Default: Extracted from git repo and git revision.",
|
|
146
136
|
default=None,
|
|
137
|
+
help="Deprecated. Ignored: the .travis.yml file is not used anymore",
|
|
138
|
+
)
|
|
139
|
+
parser.add_argument(
|
|
140
|
+
"--variables-sh-path",
|
|
141
|
+
dest="variables_sh_path",
|
|
142
|
+
default=None,
|
|
143
|
+
help="Optional path of the variables.sh file (or the directory containing it) to use.\n"
|
|
144
|
+
"Default: Extracted from git repo and git revision.",
|
|
147
145
|
)
|
|
148
146
|
parser.add_argument(
|
|
149
147
|
"--no-clone",
|
|
150
148
|
dest="no_clone",
|
|
151
149
|
action="store_true",
|
|
152
|
-
help="Avoid clone the repository. It will require travis-yml-path",
|
|
153
150
|
default=False,
|
|
151
|
+
help="Avoid cloning the repository. It requires --variables-sh-path",
|
|
154
152
|
)
|
|
155
153
|
parser.add_argument(
|
|
156
154
|
"--add-rcfile",
|
|
@@ -165,7 +163,7 @@ def main(return_result=False):
|
|
|
165
163
|
dest="runs_at_the_end_script",
|
|
166
164
|
nargs="*",
|
|
167
165
|
default="",
|
|
168
|
-
help=
|
|
166
|
+
help="Deprecated. Ignored: the script section of .travis.yml does not exist anymore",
|
|
169
167
|
)
|
|
170
168
|
parser.add_argument(
|
|
171
169
|
"--build-env-args",
|
|
@@ -183,8 +181,8 @@ def main(return_result=False):
|
|
|
183
181
|
"--deployv",
|
|
184
182
|
dest="deployv",
|
|
185
183
|
action="store_true",
|
|
186
|
-
default=
|
|
187
|
-
help="
|
|
184
|
+
default=True,
|
|
185
|
+
help="Deprecated. The deployv image is now the only supported mode",
|
|
188
186
|
)
|
|
189
187
|
parser.add_argument(
|
|
190
188
|
"--build-extra-steps",
|
|
@@ -195,6 +193,14 @@ def main(return_result=False):
|
|
|
195
193
|
)
|
|
196
194
|
|
|
197
195
|
args = parser.parse_args()
|
|
196
|
+
deprecated_args = {
|
|
197
|
+
"--exclude-after-success": args.exclude_after_success,
|
|
198
|
+
"--travis-yml-path": args.travis_yml_path,
|
|
199
|
+
"--runs-at-the-end-script": args.runs_at_the_end_script,
|
|
200
|
+
}
|
|
201
|
+
for deprecated_arg, value in deprecated_args.items():
|
|
202
|
+
if value:
|
|
203
|
+
stdout.write("WARNING: %s is deprecated and its value will be ignored\n" % deprecated_arg)
|
|
198
204
|
revision = args.git_revision
|
|
199
205
|
git_repo = args.git_repo_url
|
|
200
206
|
git_base = GitRun.get_data_url(git_repo, False)[0]
|
|
@@ -202,19 +208,16 @@ def main(return_result=False):
|
|
|
202
208
|
root_path = args.root_path
|
|
203
209
|
default_docker_image = args.default_docker_image
|
|
204
210
|
remotes = args.remotes and args.remotes.split(",")
|
|
205
|
-
exclude_after_success = args.exclude_after_success
|
|
206
211
|
run_extra_args = args.run_extra_args
|
|
207
212
|
build_extra_args = args.build_extra_args
|
|
208
|
-
travis_yml_path = args.travis_yml_path
|
|
209
213
|
build_extra_cmds = "\n".join(args.build_extra_cmds)
|
|
210
214
|
run_extra_cmds = "\n".join(args.run_extra_cmds)
|
|
211
|
-
no_clone = args.no_clone
|
|
212
|
-
deployv = args.deployv
|
|
213
215
|
rcfiles_args = args.add_rcfile and args.add_rcfile.split(",")
|
|
214
|
-
runs_at_the_end_script = args.runs_at_the_end_script or None
|
|
215
216
|
build_env_args = [build_env_args[0] for build_env_args in args.build_env_args]
|
|
216
|
-
rcfiles = [
|
|
217
|
-
|
|
217
|
+
rcfiles = [
|
|
218
|
+
(pathlib.Path(rc_file).expanduser(), "$HOME/%s" % pathlib.Path(rc_file).name) for rc_file in rcfiles_args
|
|
219
|
+
]
|
|
220
|
+
if args.no_clone:
|
|
218
221
|
os_kwargs = {
|
|
219
222
|
"repo_owner": "local_file",
|
|
220
223
|
"repo_project": "local_file",
|
|
@@ -223,42 +226,31 @@ def main(return_result=False):
|
|
|
223
226
|
"project": git_repo,
|
|
224
227
|
}
|
|
225
228
|
else:
|
|
226
|
-
os_kwargs = get_git_data(git_repo,
|
|
227
|
-
|
|
228
|
-
if travis_yml_path:
|
|
229
|
-
yml_content = yml_read(travis_yml_path)
|
|
230
|
-
else:
|
|
231
|
-
yml_content = os_kwargs["content"]
|
|
229
|
+
os_kwargs = get_git_data(git_repo, pathlib.Path(root_path) / "repo", revision)
|
|
232
230
|
|
|
233
|
-
if
|
|
234
|
-
|
|
235
|
-
yml_content = "deployv: True"
|
|
236
|
-
if not default_docker_image and not deployv:
|
|
237
|
-
default_docker_image = "vauxoo/odoo-80-image-shippable-auto"
|
|
231
|
+
if args.variables_sh_path:
|
|
232
|
+
os_kwargs["variables_sh"] = variables_sh_read(args.variables_sh_path)
|
|
238
233
|
|
|
239
|
-
if not
|
|
234
|
+
if not os_kwargs.get("variables_sh"):
|
|
240
235
|
msg = (
|
|
241
|
-
"The file %s is empty." %
|
|
242
|
-
if
|
|
236
|
+
"The file %s is empty or does not exist." % args.variables_sh_path
|
|
237
|
+
if args.variables_sh_path
|
|
243
238
|
else "The repo or the branch is incorrect value, because "
|
|
244
|
-
+ "It can not got the
|
|
239
|
+
+ "It can not got the variables.sh content from %s %s. " % (git_repo, revision)
|
|
245
240
|
+ "\nPlease, verify access repository,"
|
|
246
241
|
+ "\nverify exists url and revision, "
|
|
247
|
-
+ "\nverify exists .
|
|
242
|
+
+ "\nverify exists variables.sh"
|
|
248
243
|
)
|
|
249
244
|
raise InvalidRepoBranchError(msg)
|
|
250
245
|
os_kwargs.update({"remotes": remotes, "git_base": git_base})
|
|
251
246
|
if docker_user:
|
|
252
247
|
os_kwargs.update({"user": docker_user})
|
|
253
248
|
t2d = Travis2Docker(
|
|
254
|
-
|
|
255
|
-
work_path=join(root_path, "script", GitRun.url2dirname(git_repo), revision),
|
|
249
|
+
work_path=pathlib.Path(root_path) / "script" / GitRun.url2dirname(git_repo) / revision,
|
|
256
250
|
image=default_docker_image,
|
|
257
251
|
os_kwargs=os_kwargs,
|
|
258
|
-
copy_paths=[(
|
|
259
|
-
runs_at_the_end_script=runs_at_the_end_script,
|
|
252
|
+
copy_paths=[(pathlib.Path("~/.ssh").expanduser(), "$HOME/.ssh")] + rcfiles,
|
|
260
253
|
build_env_args=build_env_args,
|
|
261
|
-
deployv=deployv,
|
|
262
254
|
build_extra_steps=args.build_extra_steps,
|
|
263
255
|
)
|
|
264
256
|
t2d.build_extra_params = {
|
|
@@ -269,11 +261,11 @@ def main(return_result=False):
|
|
|
269
261
|
"extra_params": run_extra_args,
|
|
270
262
|
"extra_cmds": run_extra_cmds,
|
|
271
263
|
}
|
|
272
|
-
fname_scripts = t2d.compute_dockerfile(
|
|
264
|
+
fname_scripts = t2d.compute_dockerfile()
|
|
273
265
|
if fname_scripts:
|
|
274
266
|
fname_list = "- " + "\n- ".join(fname_scripts)
|
|
275
267
|
stdout.write("\nGenerated scripts:\n%s\n" % fname_list)
|
|
276
|
-
if
|
|
268
|
+
if not default_docker_image:
|
|
277
269
|
stdout.write("=" * 80)
|
|
278
270
|
# TODO: Add the URL to open the pipelines
|
|
279
271
|
stdout.write(
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# pylint: disable=print-used
|
|
3
3
|
|
|
4
4
|
import glob
|
|
5
|
-
import
|
|
5
|
+
import pathlib
|
|
6
6
|
import re
|
|
7
7
|
import subprocess
|
|
8
8
|
import sys
|
|
@@ -11,7 +11,7 @@ import sys
|
|
|
11
11
|
def ssh_keyscan2known_hosts(url, known_hosts_path=None):
|
|
12
12
|
# python3 -c "import build;build.ssh_keyscan2known_hosts('url')"
|
|
13
13
|
if known_hosts_path is None:
|
|
14
|
-
known_hosts_path =
|
|
14
|
+
known_hosts_path = pathlib.Path("~/.ssh/known_hosts").expanduser()
|
|
15
15
|
|
|
16
16
|
# Clear current known hosts
|
|
17
17
|
cmd = ["ssh-keygen", "-R", url]
|
|
@@ -22,7 +22,7 @@ def ssh_keyscan2known_hosts(url, known_hosts_path=None):
|
|
|
22
22
|
cmd = ["ssh-keyscan", "-p", "22", url]
|
|
23
23
|
print(" ".join(cmd))
|
|
24
24
|
keys_scanned = subprocess.check_output(cmd).decode(sys.stdout.encoding).strip()
|
|
25
|
-
with open(
|
|
25
|
+
with pathlib.Path(known_hosts_path).open("r+") as known_hosts_f:
|
|
26
26
|
known_hosts_f.write("\n" + keys_scanned)
|
|
27
27
|
|
|
28
28
|
|
|
@@ -31,14 +31,14 @@ def git_set_remote(path=None):
|
|
|
31
31
|
if path is None:
|
|
32
32
|
# /home/odoo/instance/odoo spends a lot of time
|
|
33
33
|
path = "/home/odoo/instance/extra_addons"
|
|
34
|
-
git_re = re.compile("([^/|@]+)/([^/]+)/([^/.]+(.git)?)")
|
|
34
|
+
git_re = re.compile(r"([^/|@]+)/([^/]+)/([^/.]+(.git)?)")
|
|
35
35
|
# TODO: Support ssh url
|
|
36
|
-
path =
|
|
36
|
+
path = str(pathlib.Path(path) / "*" / "**" / ".git")
|
|
37
37
|
hosts_scanned = set()
|
|
38
38
|
for git_dir in glob.glob(path, recursive=True):
|
|
39
39
|
git_cmd = [
|
|
40
40
|
"git",
|
|
41
|
-
"--work-tree=%s" %
|
|
41
|
+
"--work-tree=%s" % pathlib.Path(git_dir).parent,
|
|
42
42
|
"--git-dir=%s" % git_dir,
|
|
43
43
|
]
|
|
44
44
|
cmd = git_cmd + ["remote", "get-url", "--push", "origin"]
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# pylint: disable=useless-object-inheritance,print-used,except-pass
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import contextlib
|
|
4
|
+
import pathlib
|
|
4
5
|
import re
|
|
5
6
|
import subprocess
|
|
6
7
|
|
|
@@ -15,8 +16,9 @@ def decode_utf(field):
|
|
|
15
16
|
class GitRun:
|
|
16
17
|
def __init__(self, repo_git, path, path_prefix_repo=False):
|
|
17
18
|
self.repo_git = repo_git
|
|
19
|
+
path = pathlib.Path(path)
|
|
18
20
|
if path_prefix_repo:
|
|
19
|
-
path
|
|
21
|
+
path /= self.url2dirname(repo_git)
|
|
20
22
|
self.path = path
|
|
21
23
|
self.host, self.owner, self.repo = self.get_data_url(repo_git)
|
|
22
24
|
|
|
@@ -25,22 +27,22 @@ class GitRun:
|
|
|
25
27
|
host, owner, repo = False, False, False
|
|
26
28
|
repo_git_sub = repo_git.replace(":", "/")
|
|
27
29
|
if no_user:
|
|
28
|
-
repo_git_sub = re.sub(".+@", "", repo_git_sub)
|
|
29
|
-
repo_git_sub = re.sub(".git$", "", repo_git_sub)
|
|
30
|
+
repo_git_sub = re.sub(r".+@", "", repo_git_sub)
|
|
31
|
+
repo_git_sub = re.sub(r".git$", "", repo_git_sub)
|
|
30
32
|
match_object = re.search(r"(?P<host>[^/]+)/(?P<owner>[^/]+)/(?P<repo>[^/]+)", repo_git_sub)
|
|
31
33
|
if match_object:
|
|
32
34
|
host = match_object.group("host")
|
|
33
35
|
owner = match_object.group("owner")
|
|
34
36
|
repo = match_object.group("repo")
|
|
35
|
-
elif
|
|
37
|
+
elif pathlib.Path(repo_git).is_dir():
|
|
36
38
|
host = "local"
|
|
37
|
-
owner =
|
|
38
|
-
repo =
|
|
39
|
+
owner = pathlib.Path(repo_git).name
|
|
40
|
+
repo = pathlib.Path(repo_git).parent.name
|
|
39
41
|
return host, owner, repo
|
|
40
42
|
|
|
41
43
|
@staticmethod
|
|
42
44
|
def url2dirname(url):
|
|
43
|
-
for invalid_char in "
|
|
45
|
+
for invalid_char in "@:/#\\":
|
|
44
46
|
url = url.replace(invalid_char, "_")
|
|
45
47
|
return url
|
|
46
48
|
|
|
@@ -61,10 +63,8 @@ class GitRun:
|
|
|
61
63
|
print("cmd list", cmd)
|
|
62
64
|
print("cmd", " ".join(cmd))
|
|
63
65
|
res = None
|
|
64
|
-
|
|
66
|
+
with contextlib.suppress(BaseException):
|
|
65
67
|
res = subprocess.check_output(cmd)
|
|
66
|
-
except BaseException:
|
|
67
|
-
pass
|
|
68
68
|
if res:
|
|
69
69
|
try:
|
|
70
70
|
res = res.decode()
|
|
@@ -94,9 +94,9 @@ class GitRun:
|
|
|
94
94
|
|
|
95
95
|
def update(self):
|
|
96
96
|
"""Get a repository git or update it"""
|
|
97
|
-
if not
|
|
98
|
-
|
|
99
|
-
if not
|
|
97
|
+
if not self.path.is_dir():
|
|
98
|
+
self.path.mkdir(parents=True)
|
|
99
|
+
if not (self.path / "refs").is_dir():
|
|
100
100
|
subprocess.check_output(["git", "clone", "--bare", self.repo_git, self.path])
|
|
101
101
|
self.run(["gc", "--auto", "--prune=all"])
|
|
102
102
|
self.run(["fetch", "-p", "origin", "+refs/heads/*:refs/heads/*"])
|