travis2docker 6.4.23__tar.gz → 6.4.25__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.23 → travis2docker-6.4.25}/.bumpversion.cfg +1 -1
- {travis2docker-6.4.23 → travis2docker-6.4.25}/PKG-INFO +83 -5
- {travis2docker-6.4.23 → travis2docker-6.4.25}/README.rst +80 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/docs/conf.py +1 -1
- travis2docker-6.4.25/setup.py +70 -0
- travis2docker-6.4.25/src/travis2docker/__init__.py +1 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker/__main__.py +1 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker/cli.py +102 -110
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker/docker_helper/build.py +16 -8
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker/git_run.py +27 -28
- travis2docker-6.4.25/src/travis2docker/templates/20-run.sh +17 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker/templates/Dockerfile_deployv +1 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker/templates/build.sh +24 -8
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker/travis2docker.py +114 -104
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker.egg-info/PKG-INFO +83 -5
- travis2docker-6.4.25/tests/test_travis2docker.py +156 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/tox.ini +1 -1
- travis2docker-6.4.23/setup.py +0 -74
- travis2docker-6.4.23/src/travis2docker/__init__.py +0 -1
- travis2docker-6.4.23/src/travis2docker/templates/20-run.sh +0 -4
- travis2docker-6.4.23/tests/test_travis2docker.py +0 -144
- {travis2docker-6.4.23 → travis2docker-6.4.25}/.coveragerc +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/AUTHORS.rst +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/CHANGELOG.rst +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/CONTRIBUTING.rst +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/LICENSE +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/MANIFEST.in +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/docs/authors.rst +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/docs/changelog.rst +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/docs/contributing.rst +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/docs/index.rst +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/docs/installation.rst +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/docs/readme.rst +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/docs/reference/index.rst +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/docs/reference/travis2docker.rst +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/docs/requirements.txt +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/docs/spelling_wordlist.txt +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/docs/usage.rst +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/examples/example_1.yml +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/examples/example_2.yml +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/examples/example_3.yml +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/examples/example_4.yml +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/examples/example_5.yml +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/requirements.txt +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/setup.cfg +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker/exceptions.py +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker/templates/.coveragerc +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker/templates/.vscode/extensions.json +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker/templates/.vscode/launch.json +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker/templates/.vscode/settings.json +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker/templates/10-build.sh +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker/templates/Dockerfile +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker/templates/entrypoint.sh +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker/templates/entrypoint_deployv.sh +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker/templates/rvm_env.sh +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker/travis-ci-apt-source-whitelist/.git +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker/travis-ci-apt-source-whitelist/.gitignore +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker/travis-ci-apt-source-whitelist/.travis.yml +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker/travis-ci-apt-source-whitelist/LICENSE +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker/travis-ci-apt-source-whitelist/README.md +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker/travis-ci-apt-source-whitelist/add_all.rb +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker/travis-ci-apt-source-whitelist/bin/travis-add-source +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker/travis-ci-apt-source-whitelist/ubuntu.json +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker.egg-info/SOURCES.txt +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker.egg-info/dependency_links.txt +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker.egg-info/entry_points.txt +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker.egg-info/not-zip-safe +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker.egg-info/requires.txt +0 -0
- {travis2docker-6.4.23 → travis2docker-6.4.25}/src/travis2docker.egg-info/top_level.txt +0 -0
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: travis2docker
|
|
3
|
-
Version: 6.4.
|
|
3
|
+
Version: 6.4.25
|
|
4
4
|
Summary: Script to generate Dockerfile from .travis.yml file
|
|
5
5
|
Home-page: https://github.com/vauxoo/travis2docker
|
|
6
6
|
Author: Vauxoo
|
|
7
7
|
Author-email: info@vauxoo.com
|
|
8
|
-
License: BSD
|
|
8
|
+
License: BSD-3-Clause
|
|
9
9
|
Classifier: Development Status :: 5 - Production/Stable
|
|
10
10
|
Classifier: Intended Audience :: Developers
|
|
11
|
-
Classifier: License :: OSI Approved :: BSD License
|
|
12
11
|
Classifier: Operating System :: Unix
|
|
13
12
|
Classifier: Operating System :: POSIX
|
|
14
13
|
Classifier: Operating System :: Microsoft :: Windows
|
|
15
14
|
Classifier: Programming Language :: Python
|
|
16
15
|
Classifier: Programming Language :: Python :: 3
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.5
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
19
16
|
Classifier: Programming Language :: Python :: 3.8
|
|
20
17
|
Classifier: Programming Language :: Python :: 3.9
|
|
21
18
|
Classifier: Programming Language :: Python :: 3.10
|
|
22
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
23
20
|
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
22
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
25
23
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
26
24
|
Classifier: Topic :: Utilities
|
|
@@ -153,6 +151,86 @@ Note, to combine the coverage data from all the tox environments run:
|
|
|
153
151
|
PYTEST_ADDOPTS=--cov-append tox
|
|
154
152
|
|
|
155
153
|
|
|
154
|
+
Release process
|
|
155
|
+
===============
|
|
156
|
+
|
|
157
|
+
This project uses `bump2version <https://github.com/c4urself/bump2version>`_ to
|
|
158
|
+
manage version bumps across ``.bumpversion.cfg``, ``docs/conf.py``,
|
|
159
|
+
``setup.py`` and ``src/travis2docker/__init__.py``.
|
|
160
|
+
|
|
161
|
+
Requirements
|
|
162
|
+
************
|
|
163
|
+
|
|
164
|
+
* Write access to push to ``main`` and to push tags.
|
|
165
|
+
* A GPG key configured for signing git tags. The CI pipeline that publishes
|
|
166
|
+
the package to PyPI only builds from **signed** tags::
|
|
167
|
+
|
|
168
|
+
git config --global user.signingkey <YOUR_GPG_KEY_ID>
|
|
169
|
+
|
|
170
|
+
* ``bump2version`` installed::
|
|
171
|
+
|
|
172
|
+
pip install bump2version
|
|
173
|
+
|
|
174
|
+
Steps to release a new version
|
|
175
|
+
******************************
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
1. Make sure you are on ``main`` and it is up to date, with no local commits
|
|
179
|
+
ahead of ``origin``::
|
|
180
|
+
|
|
181
|
+
git checkout main
|
|
182
|
+
git pull origin main
|
|
183
|
+
git status # must be clean
|
|
184
|
+
|
|
185
|
+
2. Bump the version. This creates a commit and a tag automatically
|
|
186
|
+
(choose ``patch``, ``minor`` or ``major`` as needed)::
|
|
187
|
+
|
|
188
|
+
bump2version patch
|
|
189
|
+
|
|
190
|
+
This updates::
|
|
191
|
+
|
|
192
|
+
.bumpversion.cfg
|
|
193
|
+
docs/conf.py
|
|
194
|
+
setup.py
|
|
195
|
+
src/travis2docker/__init__.py
|
|
196
|
+
|
|
197
|
+
3. Verify the tag was created and that it is **signed**::
|
|
198
|
+
|
|
199
|
+
git tag -v vX.Y.Z
|
|
200
|
+
|
|
201
|
+
If ``sign_tags`` is not enabled in ``.bumpversion.cfg``, the tag created
|
|
202
|
+
in step 2 will **not** be signed and the CI build/publish step will not
|
|
203
|
+
run. In that case, re-create the tag manually before pushing::
|
|
204
|
+
|
|
205
|
+
git tag -d vX.Y.Z
|
|
206
|
+
git tag -s vX.Y.Z -m "vX.Y.Z"
|
|
207
|
+
|
|
208
|
+
To avoid this every time, add the following to ``.bumpversion.cfg``::
|
|
209
|
+
|
|
210
|
+
[bumpversion]
|
|
211
|
+
current_version = X.Y.Z
|
|
212
|
+
commit = True
|
|
213
|
+
tag = True
|
|
214
|
+
sign_tags = True
|
|
215
|
+
|
|
216
|
+
4. Push the branch and the tag::
|
|
217
|
+
|
|
218
|
+
git push origin main --tags
|
|
219
|
+
|
|
220
|
+
Pushing the signed tag is what triggers the CI job that builds and
|
|
221
|
+
publishes the package to PyPI.
|
|
222
|
+
|
|
223
|
+
Troubleshooting
|
|
224
|
+
***************
|
|
225
|
+
|
|
226
|
+
* **"tag already exists" / dirty working tree**: make sure ``git status`` is
|
|
227
|
+
clean and ``git pull origin main`` was run before ``bump2version``,
|
|
228
|
+
otherwise the bump commit/tag will be based on stale history.
|
|
229
|
+
* **CI does not trigger a PyPI build**: check that the pushed tag is signed
|
|
230
|
+
(``git tag -v vX.Y.Z`` should show a valid GPG signature) and that
|
|
231
|
+
``user.signingkey`` is configured correctly.
|
|
232
|
+
|
|
233
|
+
|
|
156
234
|
Changelog
|
|
157
235
|
=========
|
|
158
236
|
|
|
@@ -156,3 +156,83 @@ Note, to combine the coverage data from all the tox environments run:
|
|
|
156
156
|
- ::
|
|
157
157
|
|
|
158
158
|
PYTEST_ADDOPTS=--cov-append tox
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
Release process
|
|
162
|
+
===============
|
|
163
|
+
|
|
164
|
+
This project uses `bump2version <https://github.com/c4urself/bump2version>`_ to
|
|
165
|
+
manage version bumps across ``.bumpversion.cfg``, ``docs/conf.py``,
|
|
166
|
+
``setup.py`` and ``src/travis2docker/__init__.py``.
|
|
167
|
+
|
|
168
|
+
Requirements
|
|
169
|
+
************
|
|
170
|
+
|
|
171
|
+
* Write access to push to ``main`` and to push tags.
|
|
172
|
+
* A GPG key configured for signing git tags. The CI pipeline that publishes
|
|
173
|
+
the package to PyPI only builds from **signed** tags::
|
|
174
|
+
|
|
175
|
+
git config --global user.signingkey <YOUR_GPG_KEY_ID>
|
|
176
|
+
|
|
177
|
+
* ``bump2version`` installed::
|
|
178
|
+
|
|
179
|
+
pip install bump2version
|
|
180
|
+
|
|
181
|
+
Steps to release a new version
|
|
182
|
+
******************************
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
1. Make sure you are on ``main`` and it is up to date, with no local commits
|
|
186
|
+
ahead of ``origin``::
|
|
187
|
+
|
|
188
|
+
git checkout main
|
|
189
|
+
git pull origin main
|
|
190
|
+
git status # must be clean
|
|
191
|
+
|
|
192
|
+
2. Bump the version. This creates a commit and a tag automatically
|
|
193
|
+
(choose ``patch``, ``minor`` or ``major`` as needed)::
|
|
194
|
+
|
|
195
|
+
bump2version patch
|
|
196
|
+
|
|
197
|
+
This updates::
|
|
198
|
+
|
|
199
|
+
.bumpversion.cfg
|
|
200
|
+
docs/conf.py
|
|
201
|
+
setup.py
|
|
202
|
+
src/travis2docker/__init__.py
|
|
203
|
+
|
|
204
|
+
3. Verify the tag was created and that it is **signed**::
|
|
205
|
+
|
|
206
|
+
git tag -v vX.Y.Z
|
|
207
|
+
|
|
208
|
+
If ``sign_tags`` is not enabled in ``.bumpversion.cfg``, the tag created
|
|
209
|
+
in step 2 will **not** be signed and the CI build/publish step will not
|
|
210
|
+
run. In that case, re-create the tag manually before pushing::
|
|
211
|
+
|
|
212
|
+
git tag -d vX.Y.Z
|
|
213
|
+
git tag -s vX.Y.Z -m "vX.Y.Z"
|
|
214
|
+
|
|
215
|
+
To avoid this every time, add the following to ``.bumpversion.cfg``::
|
|
216
|
+
|
|
217
|
+
[bumpversion]
|
|
218
|
+
current_version = X.Y.Z
|
|
219
|
+
commit = True
|
|
220
|
+
tag = True
|
|
221
|
+
sign_tags = True
|
|
222
|
+
|
|
223
|
+
4. Push the branch and the tag::
|
|
224
|
+
|
|
225
|
+
git push origin main --tags
|
|
226
|
+
|
|
227
|
+
Pushing the signed tag is what triggers the CI job that builds and
|
|
228
|
+
publishes the package to PyPI.
|
|
229
|
+
|
|
230
|
+
Troubleshooting
|
|
231
|
+
***************
|
|
232
|
+
|
|
233
|
+
* **"tag already exists" / dirty working tree**: make sure ``git status`` is
|
|
234
|
+
clean and ``git pull origin main`` was run before ``bump2version``,
|
|
235
|
+
otherwise the bump commit/tag will be based on stale history.
|
|
236
|
+
* **CI does not trigger a PyPI build**: check that the pushed tag is signed
|
|
237
|
+
(``git tag -v vX.Y.Z`` should show a valid GPG signature) and that
|
|
238
|
+
``user.signingkey`` is configured correctly.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
from glob import glob
|
|
5
|
+
from os.path import basename, dirname, join, splitext
|
|
6
|
+
|
|
7
|
+
from setuptools import find_packages, setup
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def read(*names, **kwargs):
|
|
11
|
+
return open(join(dirname(__file__), *names), encoding=kwargs.get("encoding", "utf8")).read()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
setup(
|
|
15
|
+
name="travis2docker",
|
|
16
|
+
version="6.4.25",
|
|
17
|
+
license="BSD-3-Clause",
|
|
18
|
+
description="Script to generate Dockerfile from .travis.yml file",
|
|
19
|
+
long_description="%s\n%s"
|
|
20
|
+
% (
|
|
21
|
+
re.compile("^.. start-badges.*^.. end-badges", re.M | re.S).sub("", read("README.rst")),
|
|
22
|
+
re.sub(":[a-z]+:`~?(.*?)`", r"``\1``", read("CHANGELOG.rst")),
|
|
23
|
+
),
|
|
24
|
+
long_description_content_type="text/x-rst",
|
|
25
|
+
author="Vauxoo",
|
|
26
|
+
author_email="info@vauxoo.com",
|
|
27
|
+
url="https://github.com/vauxoo/travis2docker",
|
|
28
|
+
packages=find_packages("src"),
|
|
29
|
+
package_dir={"": "src"},
|
|
30
|
+
py_modules=[splitext(basename(path))[0] for path in glob("src/*.py")],
|
|
31
|
+
include_package_data=True,
|
|
32
|
+
zip_safe=False,
|
|
33
|
+
classifiers=[
|
|
34
|
+
# complete classifier list: http://pypi.python.org/pypi?%3Aaction=list_classifiers
|
|
35
|
+
"Development Status :: 5 - Production/Stable",
|
|
36
|
+
"Intended Audience :: Developers",
|
|
37
|
+
"Operating System :: Unix",
|
|
38
|
+
"Operating System :: POSIX",
|
|
39
|
+
"Operating System :: Microsoft :: Windows",
|
|
40
|
+
"Programming Language :: Python",
|
|
41
|
+
"Programming Language :: Python :: 3",
|
|
42
|
+
"Programming Language :: Python :: 3.8",
|
|
43
|
+
"Programming Language :: Python :: 3.9",
|
|
44
|
+
"Programming Language :: Python :: 3.10",
|
|
45
|
+
"Programming Language :: Python :: 3.11",
|
|
46
|
+
"Programming Language :: Python :: 3.12",
|
|
47
|
+
"Programming Language :: Python :: 3.13",
|
|
48
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
49
|
+
"Programming Language :: Python :: Implementation :: PyPy",
|
|
50
|
+
# uncomment if you test on these interpreters:
|
|
51
|
+
# 'Programming Language :: Python :: Implementation :: IronPython',
|
|
52
|
+
# 'Programming Language :: Python :: Implementation :: Jython',
|
|
53
|
+
# 'Programming Language :: Python :: Implementation :: Stackless',
|
|
54
|
+
"Topic :: Utilities",
|
|
55
|
+
],
|
|
56
|
+
keywords=[
|
|
57
|
+
# eg: 'keyword1', 'keyword2', 'keyword3',
|
|
58
|
+
],
|
|
59
|
+
install_requires=read("requirements.txt").split("\n"),
|
|
60
|
+
extras_require={
|
|
61
|
+
# eg:
|
|
62
|
+
# 'rst': ['docutils>=0.11'],
|
|
63
|
+
# ':python_version=="2.6"': ['argparse'],
|
|
64
|
+
},
|
|
65
|
+
entry_points={
|
|
66
|
+
"console_scripts": [
|
|
67
|
+
"travisfile2dockerfile = travis2docker.cli:main",
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "6.4.25"
|
|
@@ -12,6 +12,7 @@ Why does this file exist, and why not put this in __main__?
|
|
|
12
12
|
there's no ``travis2docker.__main__`` in ``sys.modules``.
|
|
13
13
|
|
|
14
14
|
"""
|
|
15
|
+
|
|
15
16
|
import argparse
|
|
16
17
|
import os
|
|
17
18
|
from os.path import expanduser, expandvars, isdir, isfile, join
|
|
@@ -27,15 +28,15 @@ def get_git_data(project, path, revision):
|
|
|
27
28
|
git_obj = GitRun(project, path, path_prefix_repo=True)
|
|
28
29
|
git_obj.update()
|
|
29
30
|
data = {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
"sha": git_obj.get_sha(revision),
|
|
32
|
+
"content": git_obj.show_file(".travis.yml", revision) or git_obj.show_file(".t2d.yml", revision),
|
|
33
|
+
"variables_sh": git_obj.show_file("variables.sh", revision),
|
|
34
|
+
"repo_owner": git_obj.owner,
|
|
35
|
+
"repo_project": git_obj.repo,
|
|
36
|
+
"git_email": git_obj.get_config_data("user.email"),
|
|
37
|
+
"git_user": git_obj.get_config_data("user.name"),
|
|
38
|
+
"revision": revision,
|
|
39
|
+
"project": project,
|
|
39
40
|
}
|
|
40
41
|
return data
|
|
41
42
|
|
|
@@ -44,14 +45,14 @@ def yml_read(yml_path):
|
|
|
44
45
|
yml_path_expanded = expandvars(expanduser(yml_path))
|
|
45
46
|
alt_yml_path_expanded = None
|
|
46
47
|
if isdir(yml_path_expanded):
|
|
47
|
-
yml_path_expanded = join(yml_path_expanded,
|
|
48
|
-
alt_yml_path_expanded = join(yml_path_expanded,
|
|
48
|
+
yml_path_expanded = join(yml_path_expanded, ".travis.yml")
|
|
49
|
+
alt_yml_path_expanded = join(yml_path_expanded, ".t2d.yml")
|
|
49
50
|
if not isfile(yml_path_expanded):
|
|
50
51
|
if alt_yml_path_expanded and isfile(alt_yml_path_expanded):
|
|
51
52
|
yml_path_expanded = alt_yml_path_expanded
|
|
52
53
|
else:
|
|
53
54
|
return
|
|
54
|
-
with open(yml_path_expanded
|
|
55
|
+
with open(yml_path_expanded) as f_yml:
|
|
55
56
|
return f_yml.read()
|
|
56
57
|
|
|
57
58
|
|
|
@@ -75,122 +76,122 @@ def main(return_result=False):
|
|
|
75
76
|
"NOTE: A sha e.g. b48228 NOT IMPLEMENTED YET",
|
|
76
77
|
)
|
|
77
78
|
parser.add_argument(
|
|
78
|
-
|
|
79
|
-
dest=
|
|
79
|
+
"--docker-user",
|
|
80
|
+
dest="docker_user",
|
|
80
81
|
help="User of work into Dockerfile." "\nBased on your docker image." "\nDefault: root",
|
|
81
82
|
)
|
|
82
83
|
parser.add_argument(
|
|
83
|
-
|
|
84
|
-
dest=
|
|
84
|
+
"--docker-image",
|
|
85
|
+
dest="default_docker_image",
|
|
85
86
|
help="Docker image to use by default in Dockerfile."
|
|
86
87
|
"\nUse this parameter if don't "
|
|
87
88
|
"exists value: 'build_image: IMAGE_NAME' "
|
|
88
89
|
"in .travis.yml"
|
|
89
90
|
"\nDefault: 'vauxoo/odoo-80-image-shippable-auto'",
|
|
90
91
|
)
|
|
91
|
-
default_root_path = os.environ.get(
|
|
92
|
+
default_root_path = os.environ.get("TRAVIS2DOCKER_ROOT_PATH")
|
|
92
93
|
if not default_root_path:
|
|
93
94
|
default_root_path = os.path.expanduser("~")
|
|
94
|
-
default_root_path = join(default_root_path,
|
|
95
|
+
default_root_path = join(default_root_path, ".t2d")
|
|
95
96
|
parser.add_argument(
|
|
96
|
-
|
|
97
|
-
dest=
|
|
97
|
+
"--root-path",
|
|
98
|
+
dest="root_path",
|
|
98
99
|
help=f"Root path to save scripts generated.\nDefault: {default_root_path}",
|
|
99
100
|
default=default_root_path,
|
|
100
101
|
)
|
|
101
102
|
parser.add_argument(
|
|
102
|
-
|
|
103
|
-
dest=
|
|
104
|
-
help=
|
|
103
|
+
"--add-remote",
|
|
104
|
+
dest="remotes",
|
|
105
|
+
help="Add git remote to git of build path, separated by a comma." "\nUse remote name. E.g. 'Vauxoo,moylop260'",
|
|
105
106
|
)
|
|
106
107
|
parser.add_argument(
|
|
107
|
-
|
|
108
|
-
dest=
|
|
109
|
-
action=
|
|
108
|
+
"--exclude-after-success",
|
|
109
|
+
dest="exclude_after_success",
|
|
110
|
+
action="store_true",
|
|
110
111
|
default=False,
|
|
111
|
-
help=
|
|
112
|
+
help="Exclude `travis_after_success` section to entrypoint",
|
|
112
113
|
)
|
|
113
114
|
parser.add_argument(
|
|
114
|
-
|
|
115
|
-
dest=
|
|
115
|
+
"--run-extra-args",
|
|
116
|
+
dest="run_extra_args",
|
|
116
117
|
help="Extra arguments to `docker run RUN_EXTRA_ARGS` command",
|
|
117
|
-
default=
|
|
118
|
+
default="-itP -e LANG=C.UTF-8",
|
|
118
119
|
)
|
|
119
120
|
parser.add_argument(
|
|
120
|
-
|
|
121
|
-
dest=
|
|
122
|
-
nargs=
|
|
121
|
+
"--run-extra-cmds",
|
|
122
|
+
dest="run_extra_cmds",
|
|
123
|
+
nargs="*",
|
|
123
124
|
default="",
|
|
124
125
|
help='Extra commands to run after "run" script. '
|
|
125
|
-
|
|
126
|
+
"Note: You can use \\$IMAGE escaped environment variable."
|
|
126
127
|
'E.g. "docker rmi -f \\$IMAGE"',
|
|
127
128
|
)
|
|
128
129
|
parser.add_argument(
|
|
129
|
-
|
|
130
|
-
dest=
|
|
130
|
+
"--build-extra-args",
|
|
131
|
+
dest="build_extra_args",
|
|
131
132
|
help="Extra arguments to `docker build BUILD_EXTRA_ARGS` command",
|
|
132
|
-
default=
|
|
133
|
+
default="--rm",
|
|
133
134
|
)
|
|
134
135
|
parser.add_argument(
|
|
135
|
-
|
|
136
|
-
dest=
|
|
137
|
-
nargs=
|
|
136
|
+
"--build-extra-cmds",
|
|
137
|
+
dest="build_extra_cmds",
|
|
138
|
+
nargs="*",
|
|
138
139
|
default="",
|
|
139
|
-
help='Extra commands to run after "build" script. '
|
|
140
|
+
help='Extra commands to run after "build" script. ' "Note: You can use \\$IMAGE escaped environment variable.",
|
|
140
141
|
)
|
|
141
142
|
parser.add_argument(
|
|
142
|
-
|
|
143
|
-
dest=
|
|
143
|
+
"--travis-yml-path",
|
|
144
|
+
dest="travis_yml_path",
|
|
144
145
|
help="Optional path of file .travis.yml to use.\n" "Default: Extracted from git repo and git revision.",
|
|
145
146
|
default=None,
|
|
146
147
|
)
|
|
147
148
|
parser.add_argument(
|
|
148
|
-
|
|
149
|
-
dest=
|
|
150
|
-
action=
|
|
149
|
+
"--no-clone",
|
|
150
|
+
dest="no_clone",
|
|
151
|
+
action="store_true",
|
|
151
152
|
help="Avoid clone the repository. It will require travis-yml-path",
|
|
152
153
|
default=False,
|
|
153
154
|
)
|
|
154
155
|
parser.add_argument(
|
|
155
|
-
|
|
156
|
-
dest=
|
|
156
|
+
"--add-rcfile",
|
|
157
|
+
dest="add_rcfile",
|
|
157
158
|
default="",
|
|
158
|
-
help=
|
|
159
|
-
|
|
159
|
+
help="Optional paths of configuration files to "
|
|
160
|
+
"copy for user's HOME path into container, separated by a comma.",
|
|
160
161
|
)
|
|
161
|
-
parser.add_argument(
|
|
162
|
+
parser.add_argument("-v", "--version", action="version", version="%(prog)s " + __version__)
|
|
162
163
|
parser.add_argument(
|
|
163
|
-
|
|
164
|
-
dest=
|
|
165
|
-
nargs=
|
|
164
|
+
"--runs-at-the-end-script",
|
|
165
|
+
dest="runs_at_the_end_script",
|
|
166
|
+
nargs="*",
|
|
166
167
|
default="",
|
|
167
|
-
help='Extra commands to run after "script" file. '
|
|
168
|
+
help='Extra commands to run after "script" file. ' "Note: You can use \\$IMAGE escaped environment variable.",
|
|
168
169
|
)
|
|
169
170
|
parser.add_argument(
|
|
170
|
-
|
|
171
|
-
dest=
|
|
172
|
-
nargs=
|
|
173
|
-
action=
|
|
171
|
+
"--build-env-args",
|
|
172
|
+
dest="build_env_args",
|
|
173
|
+
nargs="*",
|
|
174
|
+
action="append",
|
|
174
175
|
default=[],
|
|
175
|
-
help=
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
176
|
+
help="Args used as environment variables "
|
|
177
|
+
"More info about: https://vsupalov.com/docker-build-time-env-values\n"
|
|
178
|
+
"E.g. --build-env-args ENVAR1\n"
|
|
179
|
+
"It generates the following line for Dockerfile:\n"
|
|
180
|
+
"ARG ENVVAR1\nENV ENVVAR1=$ENVVAR1",
|
|
180
181
|
)
|
|
181
182
|
parser.add_argument(
|
|
182
|
-
|
|
183
|
-
dest=
|
|
184
|
-
action=
|
|
183
|
+
"--deployv",
|
|
184
|
+
dest="deployv",
|
|
185
|
+
action="store_true",
|
|
185
186
|
default=False,
|
|
186
|
-
help=
|
|
187
|
+
help="Use the image generated from the CI and used in deployV",
|
|
187
188
|
)
|
|
188
189
|
parser.add_argument(
|
|
189
|
-
|
|
190
|
-
nargs=
|
|
190
|
+
"--build-extra-steps",
|
|
191
|
+
nargs="*",
|
|
191
192
|
default="",
|
|
192
|
-
dest=
|
|
193
|
-
help=
|
|
193
|
+
dest="build_extra_steps",
|
|
194
|
+
help="Append these extra steps at the end of the Dockerfile",
|
|
194
195
|
)
|
|
195
196
|
|
|
196
197
|
args = parser.parse_args()
|
|
@@ -200,40 +201,40 @@ def main(return_result=False):
|
|
|
200
201
|
docker_user = args.docker_user
|
|
201
202
|
root_path = args.root_path
|
|
202
203
|
default_docker_image = args.default_docker_image
|
|
203
|
-
remotes = args.remotes and args.remotes.split(
|
|
204
|
+
remotes = args.remotes and args.remotes.split(",")
|
|
204
205
|
exclude_after_success = args.exclude_after_success
|
|
205
206
|
run_extra_args = args.run_extra_args
|
|
206
207
|
build_extra_args = args.build_extra_args
|
|
207
208
|
travis_yml_path = args.travis_yml_path
|
|
208
|
-
build_extra_cmds =
|
|
209
|
-
run_extra_cmds =
|
|
209
|
+
build_extra_cmds = "\n".join(args.build_extra_cmds)
|
|
210
|
+
run_extra_cmds = "\n".join(args.run_extra_cmds)
|
|
210
211
|
no_clone = args.no_clone
|
|
211
212
|
deployv = args.deployv
|
|
212
|
-
rcfiles_args = args.add_rcfile and args.add_rcfile.split(
|
|
213
|
+
rcfiles_args = args.add_rcfile and args.add_rcfile.split(",")
|
|
213
214
|
runs_at_the_end_script = args.runs_at_the_end_script or None
|
|
214
215
|
build_env_args = [build_env_args[0] for build_env_args in args.build_env_args]
|
|
215
|
-
rcfiles = [(expanduser(rc_file), os.path.join(
|
|
216
|
+
rcfiles = [(expanduser(rc_file), os.path.join("$HOME", os.path.basename(rc_file))) for rc_file in rcfiles_args]
|
|
216
217
|
if no_clone:
|
|
217
218
|
os_kwargs = {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
219
|
+
"repo_owner": "local_file",
|
|
220
|
+
"repo_project": "local_file",
|
|
221
|
+
"revision": revision,
|
|
222
|
+
"sha": "local_file",
|
|
223
|
+
"project": git_repo,
|
|
223
224
|
}
|
|
224
225
|
else:
|
|
225
|
-
os_kwargs = get_git_data(git_repo, join(root_path,
|
|
226
|
+
os_kwargs = get_git_data(git_repo, join(root_path, "repo"), revision)
|
|
226
227
|
|
|
227
228
|
if travis_yml_path:
|
|
228
229
|
yml_content = yml_read(travis_yml_path)
|
|
229
230
|
else:
|
|
230
|
-
yml_content = os_kwargs[
|
|
231
|
+
yml_content = os_kwargs["content"]
|
|
231
232
|
|
|
232
233
|
if not yml_content and os_kwargs.get("variables_sh"):
|
|
233
234
|
deployv = True
|
|
234
235
|
yml_content = "deployv: True"
|
|
235
236
|
if not default_docker_image and not deployv:
|
|
236
|
-
default_docker_image =
|
|
237
|
+
default_docker_image = "vauxoo/odoo-80-image-shippable-auto"
|
|
237
238
|
|
|
238
239
|
if not yml_content:
|
|
239
240
|
msg = (
|
|
@@ -246,12 +247,12 @@ def main(return_result=False):
|
|
|
246
247
|
+ "\nverify exists .travis.yml"
|
|
247
248
|
)
|
|
248
249
|
raise InvalidRepoBranchError(msg)
|
|
249
|
-
os_kwargs.update({
|
|
250
|
+
os_kwargs.update({"remotes": remotes, "git_base": git_base})
|
|
250
251
|
if docker_user:
|
|
251
|
-
os_kwargs.update({
|
|
252
|
+
os_kwargs.update({"user": docker_user})
|
|
252
253
|
t2d = Travis2Docker(
|
|
253
254
|
yml_buffer=yml_content,
|
|
254
|
-
work_path=join(root_path,
|
|
255
|
+
work_path=join(root_path, "script", GitRun.url2dirname(git_repo), revision),
|
|
255
256
|
image=default_docker_image,
|
|
256
257
|
os_kwargs=os_kwargs,
|
|
257
258
|
copy_paths=[(expanduser("~/.ssh"), "$HOME/.ssh")] + rcfiles,
|
|
@@ -261,37 +262,28 @@ def main(return_result=False):
|
|
|
261
262
|
build_extra_steps=args.build_extra_steps,
|
|
262
263
|
)
|
|
263
264
|
t2d.build_extra_params = {
|
|
264
|
-
|
|
265
|
-
|
|
265
|
+
"extra_params": build_extra_args,
|
|
266
|
+
"extra_cmds": build_extra_cmds,
|
|
266
267
|
}
|
|
267
268
|
t2d.run_extra_params = {
|
|
268
|
-
|
|
269
|
-
|
|
269
|
+
"extra_params": run_extra_args,
|
|
270
|
+
"extra_cmds": run_extra_cmds,
|
|
270
271
|
}
|
|
271
272
|
fname_scripts = t2d.compute_dockerfile(skip_after_success=exclude_after_success)
|
|
272
273
|
if fname_scripts:
|
|
273
|
-
fname_list =
|
|
274
|
-
stdout.write(
|
|
275
|
-
if deployv:
|
|
274
|
+
fname_list = "- " + "\n- ".join(fname_scripts)
|
|
275
|
+
stdout.write("\nGenerated scripts:\n%s\n" % fname_list)
|
|
276
|
+
if deployv and not default_docker_image:
|
|
276
277
|
stdout.write("=" * 80)
|
|
278
|
+
# TODO: Add the URL to open the pipelines
|
|
277
279
|
stdout.write(
|
|
278
|
-
'\
|
|
279
|
-
'
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
'\ndocker exec -it --user=root CONTAINER '
|
|
283
|
-
'find /home/odoo -maxdepth 1 -not -user odoo -exec chown -R odoo:odoo {} \\;\n'
|
|
280
|
+
'\nTIP: Use the parameter "--docker-image=quay.io/vauxoo/PROJECT:TAG" '
|
|
281
|
+
'get the PROJECT:TAG info in your "build_docker" pipeline similar to '
|
|
282
|
+
'\n"... INFO - deployv.deployv_addon_gitlab_tools.common.common.push_image - '
|
|
283
|
+
'Pushing image ... to quay.io/vauxoo/PROJECT:TAG"\n'
|
|
284
284
|
)
|
|
285
|
-
if not default_docker_image:
|
|
286
|
-
# TODO: Add the URL to open the pipelines
|
|
287
|
-
stdout.write(
|
|
288
|
-
'\nTIP: Use the parameter "--docker-image=quay.io/vauxoo/PROJECT:TAG" '
|
|
289
|
-
'get the PROJECT:TAG info in your "build_docker" pipeline similar to '
|
|
290
|
-
'\n"... INFO - deployv.deployv_addon_gitlab_tools.common.common.push_image - '
|
|
291
|
-
'Pushing image ... to quay.io/vauxoo/PROJECT:TAG"\n'
|
|
292
|
-
)
|
|
293
285
|
stdout.write("=" * 80)
|
|
294
286
|
else:
|
|
295
|
-
stdout.write(
|
|
287
|
+
stdout.write("\nNo scripts were generated.")
|
|
296
288
|
if return_result:
|
|
297
289
|
return fname_scripts
|