Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
vauxoo
gitlab_tools
Commits
b7097778
Commit
b7097778
authored
May 02, 2017
by
Tulio Ruiz
Browse files
Merge branch 'master-bump_0913-truiz' into 'master'
Update env vars Closes
#6
See merge request
!19
parents
5d810845
bd4760bf
Pipeline
#4862
passed with stage
in 28 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.bumpversion.cfg
View file @
b7097778
[bumpversion]
current_version = 0.1.
3
current_version = 0.1.
4
commit = True
tag = False
...
...
README.rst
View file @
b7097778
...
...
@@ -24,9 +24,9 @@ Overview
:alt: PyPI Package latest release
:target: https://pypi.python.org/pypi/deployv-addon-gitlab-tools
.. |commits-since| image:: https://img.shields.io/github/commits-since/Vauxoo/deployv-addon-gitlab-tools/v0.1.
3
.svg
.. |commits-since| image:: https://img.shields.io/github/commits-since/Vauxoo/deployv-addon-gitlab-tools/v0.1.
4
.svg
:alt: Commits since latest release
:target: https://github.com/Vauxoo/deployv-addon-gitlab-tools/compare/v0.1.
3
...master
:target: https://github.com/Vauxoo/deployv-addon-gitlab-tools/compare/v0.1.
4
...master
.. |downloads| image:: https://img.shields.io/pypi/dm/deployv-addon-gitlab-tools.svg
:alt: PyPI Package monthly downloads
...
...
docs/conf.py
View file @
b7097778
...
...
@@ -26,7 +26,7 @@ project = u'Deployv addon: Gitlab tools'
year
=
'2017'
author
=
u
'Vauxoo'
copyright
=
'{0}, {1}'
.
format
(
year
,
author
)
version
=
release
=
u
'0.1.
3
'
version
=
release
=
u
'0.1.
4
'
pygments_style
=
'trac'
templates_path
=
[
'.'
]
...
...
setup.py
View file @
b7097778
...
...
@@ -74,7 +74,7 @@ class PyInstall(InstallCommand):
setup
(
name
=
'deployv-addon-gitlab-tools'
,
version
=
'0.1.
3
'
,
version
=
'0.1.
4
'
,
license
=
'BSD'
,
description
=
'Deployv addon: Gitlab tools. Generated by cookiecutter and cookiecutter-deploy-addon.'
,
long_description
=
'%s
\n
%s'
%
(
...
...
src/deployv_addon_gitlab_tools/__init__.py
View file @
b7097778
...
...
@@ -6,7 +6,7 @@ from deployv_addon_gitlab_tools.commands import (
check_keys
,
test_images
,
upload_image
,
deployv_tests
)
__version__
=
"0.1.
3
"
__version__
=
"0.1.
4
"
logger
=
logging
.
getLogger
(
'deployv.'
+
__name__
)
# pylint: disable=C0103
...
...
src/deployv_addon_gitlab_tools/commands/deployv_tests.py
View file @
b7097778
...
...
@@ -104,16 +104,16 @@ def cleanup(base_name):
@
click
.
option
(
'--ci_pipeline_id'
,
default
=
environ
.
get
(
'CI_PIPELINE_ID'
),
help
=
(
"The unique id of the current pipeline that GitLab CI"
" uses internally. Env var: CI_PIPELINE_ID."
))
@
click
.
option
(
'--ci_
build
_ref_name'
,
default
=
environ
.
get
(
'CI_
BUILD
_REF_NAME'
),
@
click
.
option
(
'--ci_
commit
_ref_name'
,
default
=
environ
.
get
(
'CI_
COMMIT
_REF_NAME'
),
help
=
(
"The branch or tag name for which project is built."
" Env var: CI_
BUILD
_REF_NAME."
))
@
click
.
option
(
'--ci_job_id'
,
default
=
environ
.
get
(
'CI_JOB_ID'
,
environ
.
get
(
'CI_BUILD_ID'
)
),
" Env var: CI_
COMMIT
_REF_NAME."
))
@
click
.
option
(
'--ci_job_id'
,
default
=
environ
.
get
(
'CI_JOB_ID'
),
help
=
(
"The unique id of the current job that GitLab CI uses internally."
" Env var: CI_JOB_ID."
))
def
deployv_tests
(
**
kwargs
):
check_env_vars
(
**
kwargs
)
base_name
=
generate_image_name
(
'{0}_{1}'
.
format
(
environ
[
'CI_BUILD_REF_NAME'
],
environ
[
'CI_JOB_ID'
]
))
kwargs
.
get
(
'ci_commit_ref_name'
),
kwargs
.
get
(
'ci_job_id'
)
))
postgres_image
=
'postgres:{0}'
.
format
(
environ
.
get
(
'PSQL_VERSION'
,
'9.6'
))
cleanup
(
base_name
)
configure_postgres
(
base_name
,
postgres_image
)
...
...
src/deployv_addon_gitlab_tools/commands/test_images.py
View file @
b7097778
...
...
@@ -29,7 +29,7 @@ def generate_image_name(name):
def
build_image
():
logger
.
info
(
'Building image'
)
cmd
=
(
'deployvcmd build -b {branch} -u {url} -v {version} -i {image} -O {repo}#{odoo_branch} -T {tag}'
.
format
(
branch
=
environ
[
'CI_
BUILD
_REF_NAME'
],
url
=
environ
[
'CI_
BUILD_REPO
'
],
repo
=
environ
[
'ODOO_REPO'
],
.
format
(
branch
=
environ
[
'CI_
COMMIT
_REF_NAME'
],
url
=
environ
[
'CI_
REPOSITORY_URL
'
],
repo
=
environ
[
'ODOO_REPO'
],
odoo_branch
=
environ
[
'ODOO_BRANCH'
],
version
=
environ
[
'VERSION'
],
image
=
environ
[
'BASE_IMAGE'
],
tag
=
environ
[
'_INSTANCE_IMAGE'
]))
subprocess
.
check_call
(
shlex
.
split
(
cmd
))
...
...
@@ -241,15 +241,15 @@ def is_running():
@
click
.
command
()
@
click
.
option
(
'--ci_
build
_ref_name'
,
default
=
environ
.
get
(
'CI_
BUILD
_REF_NAME'
),
@
click
.
option
(
'--ci_
commit
_ref_name'
,
default
=
environ
.
get
(
'CI_
COMMIT
_REF_NAME'
),
help
=
(
"The branch or tag name for which project is built."
" Env var: CI_
BUILD
_REF_NAME."
))
" Env var: CI_
COMMIT
_REF_NAME."
))
@
click
.
option
(
'--ci_pipeline_id'
,
default
=
environ
.
get
(
'CI_PIPELINE_ID'
),
help
=
(
"The unique id of the current pipeline that GitLab CI"
" uses internally. Env var: CI_PIPELINE_ID."
))
@
click
.
option
(
'--ci_
build_repo
'
,
default
=
environ
.
get
(
'CI_
BUILD_REPO
'
),
@
click
.
option
(
'--ci_
repository_url
'
,
default
=
environ
.
get
(
'CI_
REPOSITORY_URL
'
),
help
=
(
"The URL to clone the Git repository."
" Env var: CI_
BUILD_REPO
."
))
" Env var: CI_
REPOSITORY_URL
."
))
@
click
.
option
(
'--base_image'
,
default
=
environ
.
get
(
'BASE_IMAGE'
),
help
=
(
"Env var: BASE_IMAGE."
))
@
click
.
option
(
'--odoo_repo'
,
default
=
environ
.
get
(
'ODOO_REPO'
),
...
...
@@ -260,16 +260,16 @@ def is_running():
help
=
(
"Env var: VERSION."
))
@
click
.
option
(
'--install'
,
default
=
environ
.
get
(
'INSTALL'
),
help
=
(
"Env var: INSTALL."
))
@
click
.
option
(
'--ci_job_id'
,
default
=
environ
.
get
(
'CI_JOB_ID'
,
environ
.
get
(
'CI_BUILD_ID'
)
),
@
click
.
option
(
'--ci_job_id'
,
default
=
environ
.
get
(
'CI_JOB_ID'
),
help
=
(
"The unique id of the current job that GitLab CI uses internally."
" Env var: CI_JOB_ID."
))
def
test_images
(
**
kwargs
):
check_env_vars
(
**
kwargs
)
base_name
=
generate_image_name
(
'{0}_{1}'
.
format
(
environ
[
'CI_BUILD_REF_NAME'
],
environ
[
'CI_JOB_ID'
]
))
kwargs
.
get
(
'ci_commit_ref_name'
),
kwargs
.
get
(
'ci_job_id'
)
))
postgres_image
=
'postgres:{0}'
.
format
(
environ
.
get
(
'PSQL_VERSION'
,
'9.5'
))
instance_image
=
generate_image_name
(
'instance{0}_{1}'
.
format
(
base_name
,
environ
[
'CI_PIPELINE_ID'
]
))
base_name
,
kwargs
.
get
(
'ci_pipeline_id'
)
))
environ
.
update
({
'_BASE_NAME'
:
base_name
,
'_POSTGRES_IMAGE'
:
postgres_image
,
...
...
src/deployv_addon_gitlab_tools/commands/upload_image.py
View file @
b7097778
...
...
@@ -18,8 +18,8 @@ _cli = Client(timeout=600)
def
build_image
():
format_values
=
{
'url'
:
environ
[
'CI_
BUILD_REPO
'
],
'version'
:
environ
[
'CI_
BUILD
_REF_NAME'
],
'url'
:
environ
[
'CI_
REPOSITORY_URL
'
],
'version'
:
environ
[
'CI_
COMMIT
_REF_NAME'
],
'base'
:
environ
[
'BASE_IMAGE'
],
'odoo_repo'
:
environ
[
'ODOO_REPO'
],
'odoo_branch'
:
environ
[
'ODOO_BRANCH'
],
...
...
@@ -48,15 +48,15 @@ def push_image():
@
click
.
option
(
'--ci_project_name'
,
default
=
environ
.
get
(
'CI_PROJECT_NAME'
),
help
=
(
"The project name that is currently being built."
" Env var: CI_PROJECT_NAME."
))
@
click
.
option
(
'--
ci_build_ref
'
,
default
=
environ
.
get
(
'CI_
BUILD_REF
'
),
@
click
.
option
(
'--
CI_COMMIT_SHA
'
,
default
=
environ
.
get
(
'CI_
COMMIT_SHA
'
),
help
=
(
"The commit revision for which project is built."
" Env var: CI_
BUILD_REF
."
))
@
click
.
option
(
'--
ci_build_ref_name
'
,
default
=
environ
.
get
(
'CI_
BUILD
_REF_NAME'
),
" Env var: CI_
COMMIT_SHA
."
))
@
click
.
option
(
'--
CI_COMMIT_REF_NAME
'
,
default
=
environ
.
get
(
'CI_
COMMIT
_REF_NAME'
),
help
=
(
"The branch or tag name for which project is built."
" Env var: CI_
BUILD
_REF_NAME."
))
@
click
.
option
(
'--
ci_build_repo
'
,
default
=
environ
.
get
(
'CI_
BUILD_REPO
'
),
" Env var: CI_
COMMIT
_REF_NAME."
))
@
click
.
option
(
'--
CI_REPOSITORY_URL
'
,
default
=
environ
.
get
(
'CI_
REPOSITORY_URL
'
),
help
=
(
"The URL to clone the Git repository."
" Env var: CI_
BUILD_REPO
."
))
" Env var: CI_
REPOSITORY_URL
."
))
@
click
.
option
(
'--base_image'
,
default
=
environ
.
get
(
'BASE_IMAGE'
),
help
=
(
"Env var: BASE_IMAGE."
))
@
click
.
option
(
'--odoo_repo'
,
default
=
environ
.
get
(
'ODOO_REPO'
),
...
...
@@ -69,12 +69,12 @@ def push_image():
def
upload_image
(
**
kwargs
):
check_env_vars
(
**
kwargs
)
customer_names
=
environ
.
get
(
'CUSTOMER'
,
environ
.
get
(
'CI_PROJECT_NAME'
))
version_tag
=
environ
.
get
(
'CI_
BUILD
_REF_NAME'
).
replace
(
'.'
,
''
)
version_tag
=
environ
.
get
(
'CI_
COMMIT
_REF_NAME'
).
replace
(
'.'
,
''
)
image_name
=
'{customer}_{ver}'
.
format
(
customer
=
customer_names
.
replace
(
' '
,
''
).
replace
(
','
,
'_'
),
ver
=
version_tag
)
image_tag
=
environ
[
'CI_
BUILD_REF
'
][:
7
].
lower
()
image_tag
=
environ
[
'CI_
COMMIT_SHA
'
][:
7
].
lower
()
environ
.
update
({
'_IMAGE_NAME'
:
image_name
,
'_IMAGE_TAG'
:
image_tag
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment