Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.devtools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.devtools
Commits
ed703431
Commit
ed703431
authored
6 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
[ci] Remove environment variable parsing from library module
parent
66da3d77
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bob/devtools/ci.py
+5
-6
5 additions, 6 deletions
bob/devtools/ci.py
bob/devtools/scripts/ci.py
+2
-1
2 additions, 1 deletion
bob/devtools/scripts/ci.py
with
7 additions
and
7 deletions
bob/devtools/ci.py
+
5
−
6
View file @
ed703431
...
...
@@ -4,8 +4,6 @@
'''
Tools to help CI-based builds and artifact deployment
'''
import
os
import
logging
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -13,7 +11,7 @@ import git
import
distutils.version
def
is_master
(
refname
,
tag
):
def
is_master
(
refname
,
tag
,
repodir
):
'''
Tells if we
'
re on the master branch via ref_name or tag
This function checks if the name of the branch being built is
"
master
"
. If a
...
...
@@ -31,14 +29,14 @@ def is_master(refname, tag):
'''
if
tag
is
not
None
:
repo
=
git
.
Repo
(
os
.
environ
[
'
CI_PROJECT_DIR
'
]
)
repo
=
git
.
Repo
(
repodir
)
_tag
=
repo
.
tag
(
'
refs/tags/%s
'
%
tag
)
return
_tag
.
commit
in
repo
.
iter_commits
(
rev
=
'
master
'
)
return
refname
==
'
master
'
def
is_stable
(
package
,
refname
,
tag
):
def
is_stable
(
package
,
refname
,
tag
,
repodir
):
'''
Determines if the package being published is stable
This is done by checking if a tag was set for the package. If that is the
...
...
@@ -51,6 +49,7 @@ def is_stable(package, refname, tag):
refname: The current value of the environment ``CI_COMMIT_REF_NAME``
tag: The current value of the enviroment ``CI_COMMIT_TAG`` (may be
``None``)
repodir: The directory that contains the clone of the git repository
Returns: a boolean, indicating if the current build is for a stable release
'''
...
...
@@ -64,7 +63,7 @@ def is_stable(package, refname, tag):
logger
.
warn
(
'
Pre-release detected - not publishing to stable channels
'
)
return
False
if
is_master
(
os
.
environ
[
'
CI_COMMIT_REF_NAME
'
],
tag
):
if
is_master
(
refname
,
tag
,
repodir
):
return
True
else
:
logger
.
warn
(
'
Tag %s in non-master branch will be ignored
'
,
tag
)
...
...
This diff is collapsed.
Click to expand it.
bob/devtools/scripts/ci.py
+
2
−
1
View file @
ed703431
...
...
@@ -71,7 +71,8 @@ def deploy(dry_run):
from
..ci
import
is_stable
stable
=
is_stable
(
package
,
os
.
environ
[
'
CI_COMMIT_REF_NAME
'
],
os
.
environ
[
'
CI_COMMIT_TAG
'
])
os
.
environ
[
'
CI_COMMIT_TAG
'
],
os
.
environ
[
'
CI_PROJECT_DIR
'
])
from
..constants
import
WEBDAV_PATHS
server_info
=
WEBDAV_PATHS
[
stable
][
visible
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment